mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-15 07:01:36 +08:00
39 lines
1.8 KiB
Diff
39 lines
1.8 KiB
Diff
--- a/net/minecraft/server/RecipeRepair.java
|
|
+++ b/net/minecraft/server/RecipeRepair.java
|
|
@@ -3,9 +3,13 @@
|
|
import com.google.common.collect.Lists;
|
|
import java.util.ArrayList;
|
|
|
|
-public class RecipeRepair extends IRecipe {
|
|
+public class RecipeRepair extends ShapelessRecipes { // CraftBukkit
|
|
|
|
- public RecipeRepair() {}
|
|
+ // CraftBukkit start - Delegate to new parent class
|
|
+ public RecipeRepair() {
|
|
+ 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();
|
|
@@ -62,7 +66,18 @@
|
|
i1 = 0;
|
|
}
|
|
|
|
- return new ItemStack(itemstack2.getItem(), 1, i1);
|
|
+ // CraftBukkit start - Construct a dummy repair recipe
|
|
+ ItemStack result = new ItemStack(itemstack.getItem(), 1, i1);
|
|
+ NonNullList<RecipeItemStack> ingredients = NonNullList.a();
|
|
+ ingredients.add(RecipeItemStack.a(new ItemStack[]{itemstack2.cloneItemStack()}));
|
|
+ ingredients.add(RecipeItemStack.a(new ItemStack[]{itemstack.cloneItemStack()}));
|
|
+ ShapelessRecipes recipe = new ShapelessRecipes(this.a, result.cloneItemStack(), ingredients);
|
|
+ recipe.key = new MinecraftKey("repairitem");
|
|
+ inventorycrafting.currentRecipe = recipe;
|
|
+ result = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(inventorycrafting, result, inventorycrafting.container.getBukkitView(), true);
|
|
+ return result;
|
|
+ // return new ItemStack(itemstack2.getItem(), 1, i1);
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
|