summaryrefslogtreecommitdiffstats
path: root/nms-patches/CraftingManager.patch
blob: dff26072fcf798d8e64b5db575e6c5d81fe3ee9a (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--- a/net/minecraft/server/CraftingManager.java
+++ b/net/minecraft/server/CraftingManager.java
@@ -34,6 +34,7 @@
 
     public static boolean init() {
         try {
+            CraftingManager.c = 0; // Reset recipe ID count
             a("armordye", new RecipeArmorDye());
             a("bookcloning", new RecipeBookClone());
             a("mapcloning", new RecipeMapClone());
@@ -147,6 +148,7 @@
         if (CraftingManager.recipes.d(minecraftkey)) {
             throw new IllegalStateException("Duplicate recipe ignored with ID " + minecraftkey);
         } else {
+            irecipe.key = minecraftkey; // CraftBukkit
             CraftingManager.recipes.a(CraftingManager.c++, minecraftkey, irecipe);
         }
     }
@@ -158,12 +160,14 @@
 
         do {
             if (!iterator.hasNext()) {
+                inventorycrafting.currentRecipe = null; // CraftBukkit - Clear recipe when no recipe is found
                 return ItemStack.a;
             }
 
             irecipe = (IRecipe) iterator.next();
         } while (!irecipe.a(inventorycrafting, world));
 
+        inventorycrafting.currentRecipe = irecipe; // CraftBukkit
         return irecipe.craftItem(inventorycrafting);
     }
 
@@ -175,12 +179,14 @@
 
         do {
             if (!iterator.hasNext()) {
+                inventorycrafting.currentRecipe = null; // CraftBukkit - Clear recipe when no recipe is found
                 return null;
             }
 
             irecipe = (IRecipe) iterator.next();
         } while (!irecipe.a(inventorycrafting, world));
 
+        inventorycrafting.currentRecipe = irecipe; // CraftBukkit
         return irecipe;
     }
 
@@ -210,7 +216,7 @@
     }
 
     public static int a(IRecipe irecipe) {
-        return CraftingManager.recipes.a((Object) irecipe);
+        return CraftingManager.recipes.a(irecipe); // CraftBukkit - decompile error
     }
 
     @Nullable