summaryrefslogtreecommitdiffstats
path: root/nms-patches/IRecipe.patch
blob: 844b91e7e8ed452793a02fbeeec1e22aa93bd485 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- a/net/minecraft/server/IRecipe.java
+++ b/net/minecraft/server/IRecipe.java
@@ -3,6 +3,7 @@
 public abstract class IRecipe implements Comparable<IRecipe> {
 
     protected String a;
+    public MinecraftKey key; // CraftBukkit
 
     public IRecipe() {
         this("");
@@ -25,10 +26,24 @@
     }
 
     public int a(IRecipe irecipe) {
-        return ((MinecraftKey) CraftingManager.recipes.b(this)).toString().compareTo(((MinecraftKey) CraftingManager.recipes.b(irecipe)).toString());
+        return this.key.toString().compareTo(irecipe.key.toString()); // CraftBukkit
     }
 
-    public int compareTo(Object object) {
+    public int compareTo(IRecipe object) { // CraftBukkit - decompile error
         return this.a((IRecipe) object);
     }
+
+    // CraftBukkit start
+    @Override
+    public boolean equals(Object obj) {
+        return obj instanceof IRecipe && key.equals(((IRecipe) obj).key);
+    }
+
+    @Override
+    public int hashCode() {
+        return key.hashCode();
+    }
+
+    public abstract org.bukkit.inventory.Recipe toBukkitRecipe();
+    // CraftBukkit end
 }