From 09a453aede52dec3c3f307974396a9642de4c87c Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 3 May 2019 17:57:05 +1000 Subject: [PATCH] SPIGOT-4835: Manually opened chest doesn't have close animation --- .../craftbukkit/entity/CraftHumanEntity.java | 52 ++++++++++--------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 626ec19e7d..b7da600ef2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -334,31 +334,35 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { case PLAYER: case CHEST: case ENDER_CHEST: - Containers customSize; - switch (inventory.getSize()) { - case 9: - customSize = Containers.GENERIC_9X1; - break; - case 18: - customSize = Containers.GENERIC_9X2; - break; - case 27: - customSize = Containers.GENERIC_9X3; - break; - case 36: - case 41: // PLAYER - customSize = Containers.GENERIC_9X4; - break; - case 45: - customSize = Containers.GENERIC_9X5; - break; - case 54: - customSize = Containers.GENERIC_9X6; - break; - default: - throw new IllegalArgumentException("Unsupported custom inventory size " + inventory.getSize()); + if (iinventory instanceof ITileInventory) { + getHandle().openContainer((ITileInventory) iinventory); + } else { + Containers customSize; + switch (inventory.getSize()) { + case 9: + customSize = Containers.GENERIC_9X1; + break; + case 18: + customSize = Containers.GENERIC_9X2; + break; + case 27: + customSize = Containers.GENERIC_9X3; + break; + case 36: + case 41: // PLAYER + customSize = Containers.GENERIC_9X4; + break; + case 45: + customSize = Containers.GENERIC_9X5; + break; + case 54: + customSize = Containers.GENERIC_9X6; + break; + default: + throw new IllegalArgumentException("Unsupported custom inventory size " + inventory.getSize()); + } + openCustomInventory(inventory, player, customSize); } - openCustomInventory(inventory, player, customSize); break; case DISPENSER: if (iinventory instanceof TileEntityDispenser) {