diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/inventory/ShulkerBoxMenu.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/inventory/ShulkerBoxMenu.java.patch | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/inventory/ShulkerBoxMenu.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/inventory/ShulkerBoxMenu.java.patch new file mode 100644 index 0000000000..f1519aab85 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/inventory/ShulkerBoxMenu.java.patch @@ -0,0 +1,96 @@ +--- a/net/minecraft/world/inventory/ShulkerBoxMenu.java ++++ b/net/minecraft/world/inventory/ShulkerBoxMenu.java +@@ -6,20 +6,40 @@ + import net.minecraft.world.entity.player.Player; + import net.minecraft.world.item.ItemStack; + ++// CraftBukkit start ++import org.bukkit.craftbukkit.inventory.CraftInventory; ++import org.bukkit.craftbukkit.inventory.CraftInventoryView; ++// CraftBukkit end ++ + public class ShulkerBoxMenu extends AbstractContainerMenu { + + private static final int CONTAINER_SIZE = 27; + private final Container container; ++ // CraftBukkit start ++ private CraftInventoryView bukkitEntity; ++ private Inventory player; + +- public ShulkerBoxMenu(int i, Inventory inventory) { +- this(i, inventory, new SimpleContainer(27)); ++ @Override ++ public CraftInventoryView getBukkitView() { ++ if (bukkitEntity != null) { ++ return bukkitEntity; ++ } ++ ++ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), new CraftInventory(this.container), this); ++ return bukkitEntity; + } ++ // CraftBukkit end + +- public ShulkerBoxMenu(int i, Inventory inventory, Container container) { +- super(MenuType.SHULKER_BOX, i); ++ public ShulkerBoxMenu(int containerId, Inventory playerInventory) { ++ this(containerId, playerInventory, new SimpleContainer(27)); ++ } ++ ++ public ShulkerBoxMenu(int containerId, Inventory playerInventory, Container container) { ++ super(MenuType.SHULKER_BOX, containerId); + checkContainerSize(container, 27); + this.container = container; +- container.startOpen(inventory.player); ++ this.player = playerInventory; // CraftBukkit - save player ++ container.startOpen(playerInventory.player); + boolean flag = true; + boolean flag1 = true; + +@@ -34,33 +54,32 @@ + + for (j = 0; j < 3; ++j) { + for (k = 0; k < 9; ++k) { +- this.addSlot(new Slot(inventory, k + j * 9 + 9, 8 + k * 18, 84 + j * 18)); ++ this.addSlot(new Slot(playerInventory, k + j * 9 + 9, 8 + k * 18, 84 + j * 18)); + } + } + + for (j = 0; j < 9; ++j) { +- this.addSlot(new Slot(inventory, j, 8 + j * 18, 142)); ++ this.addSlot(new Slot(playerInventory, j, 8 + j * 18, 142)); + } + + } + + @Override +- @Override + public boolean stillValid(Player player) { ++ if (!this.checkReachable) return true; // CraftBukkit + return this.container.stillValid(player); + } + + @Override +- @Override +- public ItemStack quickMoveStack(Player player, int i) { ++ public ItemStack quickMoveStack(Player player, int index) { + ItemStack itemstack = ItemStack.EMPTY; +- Slot slot = (Slot) this.slots.get(i); ++ Slot slot = (Slot) this.slots.get(index); + + if (slot != null && slot.hasItem()) { + ItemStack itemstack1 = slot.getItem(); + + itemstack = itemstack1.copy(); +- if (i < this.container.getContainerSize()) { ++ if (index < this.container.getContainerSize()) { + if (!this.moveItemStackTo(itemstack1, this.container.getContainerSize(), this.slots.size(), true)) { + return ItemStack.EMPTY; + } +@@ -79,7 +98,6 @@ + } + + @Override +- @Override + public void removed(Player player) { + super.removed(player); + this.container.stopOpen(player); |