Paper/nms-patches/CraftingManager.patch

58 lines
1.9 KiB
Diff

--- 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