diff options
Diffstat (limited to 'patch-remap/og/net/minecraft/world/inventory/ContainerHopper.patch')
-rw-r--r-- | patch-remap/og/net/minecraft/world/inventory/ContainerHopper.patch | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/inventory/ContainerHopper.patch b/patch-remap/og/net/minecraft/world/inventory/ContainerHopper.patch new file mode 100644 index 0000000000..1a6a55058d --- /dev/null +++ b/patch-remap/og/net/minecraft/world/inventory/ContainerHopper.patch @@ -0,0 +1,51 @@ +--- a/net/minecraft/world/inventory/ContainerHopper.java ++++ b/net/minecraft/world/inventory/ContainerHopper.java +@@ -6,11 +6,32 @@ + 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 ContainerHopper extends Container { + + public static final int CONTAINER_SIZE = 5; + private final IInventory hopper; + ++ // CraftBukkit start ++ private CraftInventoryView bukkitEntity = null; ++ private PlayerInventory player; ++ ++ @Override ++ public CraftInventoryView getBukkitView() { ++ if (bukkitEntity != null) { ++ return bukkitEntity; ++ } ++ ++ CraftInventory inventory = new CraftInventory(this.hopper); ++ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this); ++ return bukkitEntity; ++ } ++ // CraftBukkit end ++ + public ContainerHopper(int i, PlayerInventory playerinventory) { + this(i, playerinventory, new InventorySubcontainer(5)); + } +@@ -18,6 +39,7 @@ + public ContainerHopper(int i, PlayerInventory playerinventory, IInventory iinventory) { + super(Containers.HOPPER, i); + this.hopper = iinventory; ++ this.player = playerinventory; // CraftBukkit - save player + checkContainerSize(iinventory, 5); + iinventory.startOpen(playerinventory.player); + boolean flag = true; +@@ -42,6 +64,7 @@ + + @Override + public boolean stillValid(EntityHuman entityhuman) { ++ if (!this.checkReachable) return true; // CraftBukkit + return this.hopper.stillValid(entityhuman); + } + |