PaperMC/nms-patches/RecipeRepair.patch

38 lines
1.7 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/RecipeRepair.java
+++ b/net/minecraft/server/RecipeRepair.java
2016-05-10 13:47:39 +02:00
@@ -4,9 +4,13 @@
import java.util.ArrayList;
2016-05-10 13:47:39 +02:00
import javax.annotation.Nullable;
-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();
2016-05-10 13:47:39 +02:00
@@ -64,7 +68,17 @@
i1 = 0;
}
2015-02-26 23:41:06 +01:00
- 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
}
}