From eb9a7dde029e15c538a9cd5f5ba818daa176bb8b Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 15 Jun 2024 12:48:38 +1000 Subject: [PATCH] SPIGOT-7757: Cannot set item in Stonecutter Inventory --- .../craftbukkit/inventory/CraftContainer.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java index 715c495b5..e2d9a7afc 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java @@ -229,7 +229,7 @@ public class CraftContainer extends Container { delegate = new ContainerGrindstone(windowId, bottom); break; case STONECUTTER: - delegate = new ContainerStonecutter(windowId, bottom); + setupStoneCutter(top, bottom); // SPIGOT-7757 - manual setup required for individual slots break; case MERCHANT: delegate = new ContainerMerchant(windowId, bottom); @@ -328,6 +328,26 @@ public class CraftContainer extends Container { // End copy from ContainerSmithing } + private void setupStoneCutter(IInventory top, IInventory bottom) { + // This code copied from ContainerStonecutter + this.addSlot(new Slot(top, 0, 20, 33)); + this.addSlot(new Slot(top, 1, 143, 33)); + + int row; + int col; + + for (row = 0; row < 3; ++row) { + for (col = 0; col < 9; ++col) { + this.addSlot(new Slot(bottom, col + row * 9 + 9, 8 + col * 18, 84 + row * 18)); + } + } + + for (row = 0; row < 9; ++row) { + this.addSlot(new Slot(bottom, row, 8 + row * 18, 142)); + } + // End copy from ContainerSmithing + } + @Override public ItemStack quickMoveStack(EntityHuman entityhuman, int i) { return (delegate != null) ? delegate.quickMoveStack(entityhuman, i) : ItemStack.EMPTY;