diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index e69f417b..f045e1c7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -219,6 +219,20 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { openCustomInventory(inventory, player, "minecraft:hopper"); } break; + case BEACON: + if (craftinv.getInventory() instanceof TileEntityBeacon) { + getHandle().openTileEntity((TileEntityBeacon) craftinv.getInventory()); + } else { + openCustomInventory(inventory, player, "minecraft:beacon"); + } + break; + case ANVIL: + if (craftinv.getInventory() instanceof TileEntityContainerAnvil) { + getHandle().openTileEntity((TileEntityContainerAnvil) craftinv.getInventory()); + } else { + openCustomInventory(inventory, player, "minecraft:anvil"); + } + break; case CREATIVE: case CRAFTING: throw new IllegalArgumentException("Can't open a " + type + " inventory!"); @@ -240,6 +254,14 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { String title = container.getBukkitView().getTitle(); int size = container.getBukkitView().getTopInventory().getSize(); + // Special cases + if (windowType.equals("minecraft:crafting_table") + || windowType.equals("minecraft:anvil") + || windowType.equals("minecraft:enchanting_table") + ) { + size = 0; + } + player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, new ChatComponentText(title), size)); getHandle().activeContainer = container; getHandle().activeContainer.addSlotListener(player); |