--- a/net/minecraft/server/ContainerCartography.java +++ b/net/minecraft/server/ContainerCartography.java @@ -1,7 +1,29 @@ package net.minecraft.server; +// CraftBukkit start +import org.bukkit.Location; +import org.bukkit.craftbukkit.inventory.CraftInventoryCartography; +import org.bukkit.craftbukkit.inventory.CraftInventoryView; +import org.bukkit.entity.Player; +// CraftBukkit end + public class ContainerCartography extends Container { + // CraftBukkit start + private CraftInventoryView bukkitEntity = null; + private Player player; + + @Override + public CraftInventoryView getBukkitView() { + if (bukkitEntity != null) { + return bukkitEntity; + } + + CraftInventoryCartography inventory = new CraftInventoryCartography(this.inventory, this.resultInventory); + bukkitEntity = new CraftInventoryView(this.player, inventory, this); + return bukkitEntity; + } + // CraftBukkit end private final ContainerAccess containerAccess; private long e; public final IInventory inventory; @@ -19,6 +41,13 @@ ContainerCartography.this.a((IInventory) this); super.update(); } + + // CraftBukkit start + @Override + public Location getLocation() { + return containeraccess.getLocation(); + } + // CraftBukkit end }; this.resultInventory = new InventoryCraftResult() { @Override @@ -26,6 +55,13 @@ ContainerCartography.this.a((IInventory) this); super.update(); } + + // CraftBukkit start + @Override + public Location getLocation() { + return containeraccess.getLocation(); + } + // CraftBukkit end }; this.containerAccess = containeraccess; this.a(new Slot(this.inventory, 0, 15, 15) { @@ -78,10 +114,12 @@ this.a(new Slot(playerinventory, j, 8 + j * 18, 142)); } + player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit } @Override public boolean canUse(EntityHuman entityhuman) { + if (!this.checkReachable) return true; // CraftBukkit return a(this.containerAccess, entityhuman, Blocks.CARTOGRAPHY_TABLE); }