Paper/nms-patches/RecipeRepair.patch

40 lines
1.8 KiB
Diff
Raw Normal View History

--- ../work/decompile-8eb82bde//net/minecraft/server/RecipeRepair.java 2014-11-28 17:43:43.357707429 +0000
+++ src/main/java/net/minecraft/server/RecipeRepair.java 2014-11-28 17:38:23.000000000 +0000
@@ -3,9 +3,13 @@
import com.google.common.collect.Lists;
import java.util.ArrayList;
-public class RecipeRepair implements IRecipe {
+public class RecipeRepair extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends
- public RecipeRepair() {}
+ // CraftBukkit start - Delegate to new parent class
+ public RecipeRepair() {
+ super(new ItemStack(Items.LEATHER_HELMET), java.util.Arrays.asList(new ItemStack(Items.LEATHER_HELMET)));
+ }
+ // CraftBukkit end
public boolean a(InventoryCrafting inventorycrafting, World world) {
ArrayList arraylist = Lists.newArrayList();
@@ -61,8 +65,18 @@
if (i1 < 0) {
i1 = 0;
}
-
- return new ItemStack(itemstack2.getItem(), 1, i1);
+
+ // CraftBukkit start - Construct a dummy repair recipe
+ ItemStack result = new ItemStack(itemstack.getItem(), 1, i1);
+ java.util.List<ItemStack> ingredients = new ArrayList<ItemStack>();
+ ingredients.add(itemstack2.cloneItemStack());
+ ingredients.add(itemstack.cloneItemStack());
+ ShapelessRecipes recipe = new ShapelessRecipes(result.cloneItemStack(), ingredients);
+ inventorycrafting.currentRecipe = recipe;
+ result = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(inventorycrafting, result, CraftingManager.getInstance().lastCraftView, true);
+ return result;
+ // return new ItemStack(itemstack2.getItem(), 1, i1);
+ // CraftBukkit end
}
}