Paper/nms-patches/RecipeRepair.patch

39 lines
1.8 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-11-17 02:41:03 +01:00
@@ -3,9 +3,13 @@
import com.google.common.collect.Lists;
import java.util.ArrayList;
2017-05-30 13:25:59 +02:00
-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() {
2017-05-14 04:00:00 +02:00
+ super("", new ItemStack(Items.LEATHER_HELMET), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.LEATHER_HELMET)));
+ }
+ // CraftBukkit end
public boolean a(InventoryCrafting inventorycrafting, World world) {
ArrayList arraylist = Lists.newArrayList();
2017-05-14 04:00:00 +02:00
@@ -62,7 +66,18 @@
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);
2017-05-14 04:00:00 +02:00
+ NonNullList<RecipeItemStack> ingredients = NonNullList.a();
2017-05-19 13:00:13 +02:00
+ ingredients.add(RecipeItemStack.a(new ItemStack[]{itemstack2.cloneItemStack()}));
+ ingredients.add(RecipeItemStack.a(new ItemStack[]{itemstack.cloneItemStack()}));
2017-05-30 13:25:59 +02:00
+ ShapelessRecipes recipe = new ShapelessRecipes("", result.cloneItemStack(), ingredients);
2017-05-14 04:00:00 +02:00
+ recipe.key = new MinecraftKey("repairitem");
+ inventorycrafting.currentRecipe = recipe;
2017-05-14 04:00:00 +02:00
+ result = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(inventorycrafting, result, inventorycrafting.container.getBukkitView(), true);
+ return result;
+ // return new ItemStack(itemstack2.getItem(), 1, i1);
+ // CraftBukkit end
}
}