diff --git a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerAnvilAbstract.patch b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerAnvilAbstract.patch index 78de61f7d0..422886eaf0 100644 --- a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerAnvilAbstract.patch +++ b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerAnvilAbstract.patch @@ -1,37 +1,6 @@ --- a/net/minecraft/world/inventory/ContainerAnvilAbstract.java +++ b/net/minecraft/world/inventory/ContainerAnvilAbstract.java -@@ -11,13 +11,7 @@ - public abstract class ContainerAnvilAbstract extends Container { - - protected final InventoryCraftResult resultInventory = new InventoryCraftResult(); -- protected final IInventory repairInventory = new InventorySubcontainer(2) { -- @Override -- public void update() { -- super.update(); -- ContainerAnvilAbstract.this.a((IInventory) this); -- } -- }; -+ protected final IInventory repairInventory; // CraftBukkit - instantiate repairInventory in the constructor - protected final ContainerAccess containerAccess; - protected final EntityHuman player; - -@@ -31,6 +25,15 @@ - super(containers, i); - this.containerAccess = containeraccess; - this.player = playerinventory.player; -+ // CraftBukkit start -+ this.repairInventory = new InventoryCrafting(this, 1, 2, player) { -+ @Override -+ public void update() { -+ super.update(); -+ ContainerAnvilAbstract.this.a((IInventory) this); -+ } -+ }; -+ // CraftBukkit end - this.a(new Slot(this.repairInventory, 0, 27, 47)); - this.a(new Slot(this.repairInventory, 1, 76, 47)); - this.a(new Slot(this.resultInventory, 2, 134, 47) { -@@ -85,6 +88,7 @@ +@@ -85,6 +85,7 @@ @Override public boolean canUse(EntityHuman entityhuman) { diff --git a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerSmithing.patch b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerSmithing.patch index d640809921..a64f52b1df 100644 --- a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerSmithing.patch +++ b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerSmithing.patch @@ -18,7 +18,7 @@ public ContainerSmithing(int i, PlayerInventory playerinventory) { this(i, playerinventory, ContainerAccess.a); -@@ -63,13 +68,16 @@ +@@ -63,13 +68,15 @@ List list = this.g.getCraftingManager().b(Recipes.SMITHING, this.repairInventory, this.g); if (list.isEmpty()) { @@ -31,13 +31,12 @@ this.resultInventory.a((IRecipe) this.h); - this.resultInventory.setItem(0, itemstack); + // CraftBukkit start -+ this.repairInventory.setCurrentRecipe(this.h); + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), itemstack); + // CraftBukkit end } } -@@ -85,4 +93,18 @@ +@@ -85,4 +92,18 @@ public boolean a(ItemStack itemstack, Slot slot) { return slot.inventory != this.resultInventory && super.a(itemstack, slot); } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventorySmithing.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventorySmithing.java index 4b1b617666..7004bd83c6 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventorySmithing.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventorySmithing.java @@ -1,6 +1,7 @@ package org.bukkit.craftbukkit.inventory; import net.minecraft.world.IInventory; +import net.minecraft.world.inventory.InventoryCraftResult; import net.minecraft.world.item.crafting.IRecipe; import org.bukkit.Location; import org.bukkit.inventory.ItemStack; @@ -11,11 +12,16 @@ public class CraftInventorySmithing extends CraftResultInventory implements Smit private final Location location; - public CraftInventorySmithing(Location location, IInventory inventory, IInventory resultInventory) { + public CraftInventorySmithing(Location location, IInventory inventory, InventoryCraftResult resultInventory) { super(inventory, resultInventory); this.location = location; } + @Override + public InventoryCraftResult getResultInventory() { + return (InventoryCraftResult) super.getResultInventory(); + } + @Override public Location getLocation() { return location; @@ -33,7 +39,7 @@ public class CraftInventorySmithing extends CraftResultInventory implements Smit @Override public Recipe getRecipe() { - IRecipe recipe = getInventory().getCurrentRecipe(); + IRecipe recipe = getResultInventory().ak_(); return (recipe == null) ? null : recipe.toBukkitRecipe(); } }