From 41524cf7264cb9881065631c6f68917615b7811e Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sun, 20 Jun 2021 09:03:27 +1000 Subject: [PATCH] Fix PrepareItemCraftEvent#isRepair By: md_5 --- .../world/inventory/ContainerWorkbench.patch | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerWorkbench.patch b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerWorkbench.patch index 8165f0a115..1750fc4c34 100644 --- a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerWorkbench.patch +++ b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerWorkbench.patch @@ -1,10 +1,11 @@ --- a/net/minecraft/world/inventory/ContainerWorkbench.java +++ b/net/minecraft/world/inventory/ContainerWorkbench.java -@@ -14,6 +14,11 @@ +@@ -14,6 +14,12 @@ import net.minecraft.world.level.World; import net.minecraft.world.level.block.Blocks; +// CraftBukkit start ++import net.minecraft.world.item.crafting.RecipeRepair; +import org.bukkit.craftbukkit.inventory.CraftInventoryCrafting; +import org.bukkit.craftbukkit.inventory.CraftInventoryView; +// CraftBukkit end @@ -12,7 +13,7 @@ public class ContainerWorkbench extends ContainerRecipeBook { public static final int RESULT_SLOT = 0; -@@ -27,6 +32,9 @@ +@@ -27,6 +33,9 @@ private final InventoryCraftResult resultSlots; public final ContainerAccess access; private final EntityHuman player; @@ -22,7 +23,7 @@ public ContainerWorkbench(int i, PlayerInventory playerinventory) { this(i, playerinventory, ContainerAccess.NULL); -@@ -34,8 +42,11 @@ +@@ -34,8 +43,11 @@ public ContainerWorkbench(int i, PlayerInventory playerinventory, ContainerAccess containeraccess) { super(Containers.CRAFTING, i); @@ -35,7 +36,7 @@ this.access = containeraccess; this.player = playerinventory.player; this.a((Slot) (new SlotResult(playerinventory.player, this.craftSlots, this.resultSlots, 0, 124, 35))); -@@ -71,9 +82,10 @@ +@@ -71,9 +83,10 @@ RecipeCrafting recipecrafting = (RecipeCrafting) optional.get(); if (inventorycraftresult.setRecipeUsed(world, entityplayer, recipecrafting)) { @@ -43,11 +44,11 @@ + itemstack = recipecrafting.a(inventorycrafting); // CraftBukkit - decompile error } } -+ itemstack = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(inventorycrafting, inventorycraftresult, itemstack, container.getBukkitView(), false); // CraftBukkit ++ itemstack = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(inventorycrafting, inventorycraftresult, itemstack, container.getBukkitView(), optional.orElse(null) instanceof RecipeRepair); // CraftBukkit inventorycraftresult.setItem(0, itemstack); container.a(0, itemstack); -@@ -114,6 +126,7 @@ +@@ -114,6 +127,7 @@ @Override public boolean canUse(EntityHuman entityhuman) { @@ -55,7 +56,7 @@ return a(this.access, entityhuman, Blocks.CRAFTING_TABLE); } -@@ -202,4 +215,17 @@ +@@ -202,4 +216,17 @@ public boolean d(int i) { return i != this.j(); }