mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-25 02:17:35 +01:00
36 lines
1.8 KiB
Diff
36 lines
1.8 KiB
Diff
|
--- a/net/minecraft/server/RecipeRepair.java
|
||
|
+++ b/net/minecraft/server/RecipeRepair.java
|
||
|
@@ -2,12 +2,15 @@
|
||
|
|
||
|
import com.google.common.collect.Lists;
|
||
|
import java.util.List;
|
||
|
+import java.util.stream.Stream; // CraftBukkit
|
||
|
|
||
|
-public class RecipeRepair extends IRecipeComplex {
|
||
|
+public class RecipeRepair extends ShapelessRecipes { // CraftBukkit - added extends
|
||
|
|
||
|
+ // CraftBukkit start - Delegate to new parent class
|
||
|
public RecipeRepair(MinecraftKey minecraftkey) {
|
||
|
- super(minecraftkey);
|
||
|
+ super(minecraftkey, "", new ItemStack(Items.LEATHER_HELMET), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.LEATHER_HELMET)));
|
||
|
}
|
||
|
+ // CraftBukkit end
|
||
|
|
||
|
public boolean a(InventoryCrafting inventorycrafting, World world) {
|
||
|
List<ItemStack> list = Lists.newArrayList();
|
||
|
@@ -67,6 +70,14 @@
|
||
|
ItemStack itemstack3 = new ItemStack(itemstack2.getItem());
|
||
|
|
||
|
itemstack3.setDamage(i1);
|
||
|
+ // CraftBukkit start - Construct a dummy repair recipe
|
||
|
+ NonNullList<RecipeItemStack> ingredients = NonNullList.a();
|
||
|
+ ingredients.add(new RecipeItemStack(Stream.of(new RecipeItemStack.StackProvider(itemstack2.cloneItemStack()))));
|
||
|
+ ingredients.add(new RecipeItemStack(Stream.of(new RecipeItemStack.StackProvider(itemstack.cloneItemStack()))));
|
||
|
+ ShapelessRecipes recipe = new ShapelessRecipes(new MinecraftKey("repairitem"), "", itemstack3.cloneItemStack(), ingredients);
|
||
|
+ inventorycrafting.setCurrentRecipe(recipe);
|
||
|
+ itemstack3 = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(inventorycrafting, inventorycrafting.resultInventory, itemstack3, inventorycrafting.container.getBukkitView(), true);
|
||
|
+ // CraftBukkit end
|
||
|
return itemstack3;
|
||
|
}
|
||
|
}
|