aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/inventory/ShulkerBoxMenu.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/inventory/ShulkerBoxMenu.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/inventory/ShulkerBoxMenu.java.patch115
1 files changed, 115 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/inventory/ShulkerBoxMenu.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/inventory/ShulkerBoxMenu.java.patch
new file mode 100644
index 0000000000..bd5d544366
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/inventory/ShulkerBoxMenu.java.patch
@@ -0,0 +1,115 @@
+--- a/net/minecraft/world/inventory/ShulkerBoxMenu.java
++++ b/net/minecraft/world/inventory/ShulkerBoxMenu.java
+@@ -6,10 +6,30 @@
+ 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;
+
++ @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 containerId, Inventory playerInventory) {
+ this(containerId, playerInventory, new SimpleContainer(27));
+ }
+@@ -18,55 +38,63 @@
+ super(MenuType.SHULKER_BOX, containerId);
+ checkContainerSize(container, 27);
+ this.container = container;
++ this.player = playerInventory; // CraftBukkit - save player
+ container.startOpen(playerInventory.player);
+- int i = 3;
+- int i1 = 9;
++ boolean flag = true;
++ boolean flag1 = true;
+
+- for (int i2 = 0; i2 < 3; i2++) {
+- for (int i3 = 0; i3 < 9; i3++) {
+- this.addSlot(new ShulkerBoxSlot(container, i3 + i2 * 9, 8 + i3 * 18, 18 + i2 * 18));
++ int j;
++ int k;
++
++ for (j = 0; j < 3; ++j) {
++ for (k = 0; k < 9; ++k) {
++ this.addSlot(new ShulkerBoxSlot(container, k + j * 9, 8 + k * 18, 18 + j * 18));
+ }
+ }
+
+- for (int i2 = 0; i2 < 3; i2++) {
+- for (int i3 = 0; i3 < 9; i3++) {
+- this.addSlot(new Slot(playerInventory, i3 + i2 * 9 + 9, 8 + i3 * 18, 84 + i2 * 18));
++ for (j = 0; j < 3; ++j) {
++ for (k = 0; k < 9; ++k) {
++ this.addSlot(new Slot(playerInventory, k + j * 9 + 9, 8 + k * 18, 84 + j * 18));
+ }
+ }
+
+- for (int i2 = 0; i2 < 9; i2++) {
+- this.addSlot(new Slot(playerInventory, i2, 8 + i2 * 18, 142));
++ for (j = 0; j < 9; ++j) {
++ this.addSlot(new Slot(playerInventory, j, 8 + j * 18, 142));
+ }
++
+ }
+
+ @Override
+ public boolean stillValid(Player player) {
++ if (!this.checkReachable) return true; // CraftBukkit
+ return this.container.stillValid(player);
+ }
+
+ @Override
+ public ItemStack quickMoveStack(Player player, int index) {
+- ItemStack itemStack = ItemStack.EMPTY;
+- Slot slot = this.slots.get(index);
++ ItemStack itemstack = ItemStack.EMPTY;
++ Slot slot = (Slot) this.slots.get(index);
++
+ if (slot != null && slot.hasItem()) {
+- ItemStack item = slot.getItem();
+- itemStack = item.copy();
++ ItemStack itemstack1 = slot.getItem();
++
++ itemstack = itemstack1.copy();
+ if (index < this.container.getContainerSize()) {
+- if (!this.moveItemStackTo(item, this.container.getContainerSize(), this.slots.size(), true)) {
++ if (!this.moveItemStackTo(itemstack1, this.container.getContainerSize(), this.slots.size(), true)) {
+ return ItemStack.EMPTY;
+ }
+- } else if (!this.moveItemStackTo(item, 0, this.container.getContainerSize(), false)) {
++ } else if (!this.moveItemStackTo(itemstack1, 0, this.container.getContainerSize(), false)) {
+ return ItemStack.EMPTY;
+ }
+
+- if (item.isEmpty()) {
++ if (itemstack1.isEmpty()) {
+ slot.setByPlayer(ItemStack.EMPTY);
+ } else {
+ slot.setChanged();
+ }
+ }
+
+- return itemStack;
++ return itemstack;
+ }
+
+ @Override