diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 2b1040b763..19d8842e72 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -224,6 +224,8 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { getHandle().openHopper((TileEntityHopper) craftinv.getInventory()); } else if (craftinv.getInventory() instanceof EntityMinecartHopper) { getHandle().openMinecartHopper((EntityMinecartHopper) craftinv.getInventory()); + } else { + openCustomInventory(inventory, player, 9); } break; case CREATIVE: diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java index 0b38125ca0..c032dec84e 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java @@ -115,6 +115,9 @@ public class CraftContainer extends Container { case ANVIL: typeID = 8; break; + case HOPPER: + typeID = 9; + break; default: typeID = 0; break; @@ -146,6 +149,9 @@ public class CraftContainer extends Container { case BREWING: setupBrewing(top, bottom); break; + case HOPPER: + setupHopper(top, bottom); + break; } } @@ -281,6 +287,28 @@ public class CraftContainer extends Container { // End copy from ContainerBrewingStand } + private void setupHopper(IInventory top, IInventory bottom) { + // This code copied from ContainerHopper + byte b0 = 51; + + int i; + + for (i = 0; i < top.getSize(); ++i) { + this.a(new Slot(top, i, 44 + i * 18, 20)); + } + + for (i = 0; i < 3; ++i) { + for (int j = 0; j < 9; ++j) { + this.a(new Slot(bottom, j + i * 9 + 9, 8 + j * 18, i * 18 + b0)); + } + } + + for (i = 0; i < 9; ++i) { + this.a(new Slot(bottom, i, 8 + i * 18, 58 + b0)); + } + // End copy from ContainerHopper + } + public boolean a(EntityHuman entity) { return true; }