diff options
author | Fabian Faßbender <fabian.fassbender42@googlemail.com> | 2014-12-01 03:19:24 +0100 |
---|---|---|
committer | Thinkofdeath <thinkofdeath@spigotmc.org> | 2014-12-03 16:20:55 +0000 |
commit | 497a7b4cfb57a03e7c54e9c25addcd0cde5783a4 (patch) | |
tree | 86b5f4560eec7adf80354ea57033672eaa2a6795 /src/main/java/org/bukkit | |
parent | 8110f51b50d93cf5b0bbea6d5cad79b57a7fd8b4 (diff) | |
download | craftbukkit-497a7b4cfb57a03e7c54e9c25addcd0cde5783a4.tar craftbukkit-497a7b4cfb57a03e7c54e9c25addcd0cde5783a4.tar.gz craftbukkit-497a7b4cfb57a03e7c54e9c25addcd0cde5783a4.tar.lz craftbukkit-497a7b4cfb57a03e7c54e9c25addcd0cde5783a4.tar.xz craftbukkit-497a7b4cfb57a03e7c54e9c25addcd0cde5783a4.zip |
Add ANVIL and BEACON custom inventories. Also handle a few special cases for inventory sizes
Diffstat (limited to 'src/main/java/org/bukkit')
-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); |