aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/inventory/ContainerDispenser.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/og/net/minecraft/world/inventory/ContainerDispenser.patch')
-rw-r--r--patch-remap/og/net/minecraft/world/inventory/ContainerDispenser.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/inventory/ContainerDispenser.patch b/patch-remap/og/net/minecraft/world/inventory/ContainerDispenser.patch
new file mode 100644
index 0000000000..a678f092ce
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/inventory/ContainerDispenser.patch
@@ -0,0 +1,62 @@
+--- a/net/minecraft/world/inventory/ContainerDispenser.java
++++ b/net/minecraft/world/inventory/ContainerDispenser.java
+@@ -6,6 +6,11 @@
+ import net.minecraft.world.entity.player.PlayerInventory;
+ import net.minecraft.world.item.ItemStack;
+
++// CraftBukkit start
++import org.bukkit.craftbukkit.inventory.CraftInventory;
++import org.bukkit.craftbukkit.inventory.CraftInventoryView;
++// CraftBukkit end
++
+ public class ContainerDispenser extends Container {
+
+ private static final int SLOT_COUNT = 9;
+@@ -14,6 +19,10 @@
+ private static final int USE_ROW_SLOT_START = 36;
+ private static final int USE_ROW_SLOT_END = 45;
+ public final IInventory dispenser;
++ // CraftBukkit start
++ private CraftInventoryView bukkitEntity = null;
++ private PlayerInventory player;
++ // CraftBukkit end
+
+ public ContainerDispenser(int i, PlayerInventory playerinventory) {
+ this(i, playerinventory, new InventorySubcontainer(9));
+@@ -21,6 +30,10 @@
+
+ public ContainerDispenser(int i, PlayerInventory playerinventory, IInventory iinventory) {
+ super(Containers.GENERIC_3x3, i);
++ // CraftBukkit start - Save player
++ this.player = playerinventory;
++ // CraftBukkit end
++
+ checkContainerSize(iinventory, 9);
+ this.dispenser = iinventory;
+ iinventory.startOpen(playerinventory.player);
+@@ -48,6 +61,7 @@
+
+ @Override
+ public boolean stillValid(EntityHuman entityhuman) {
++ if (!this.checkReachable) return true; // CraftBukkit
+ return this.dispenser.stillValid(entityhuman);
+ }
+
+@@ -89,4 +103,17 @@
+ super.removed(entityhuman);
+ this.dispenser.stopOpen(entityhuman);
+ }
++
++ // CraftBukkit start
++ @Override
++ public CraftInventoryView getBukkitView() {
++ if (bukkitEntity != null) {
++ return bukkitEntity;
++ }
++
++ CraftInventory inventory = new CraftInventory(this.dispenser);
++ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
++ return bukkitEntity;
++ }
++ // CraftBukkit end
+ }