[SPIGOT-6988] Inverted chest open state Created: 02/Apr/22 Updated: 25/Dec/24 |
|
Status: | Open |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | blablubbabc | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 0 |
Labels: | animation, chest |
Version: | This server is running CraftBukkit version dev-Spigot-ffceeae-d53c4fb (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT) |
Guidelines Read: | Yes |
Description |
Reproduction steps:
int x = ... int y = ... int z = ... Block block = player.getWorld().getBlockAt(x, y, z); Chest chest = (Chest) block.getState(); player.openInventory(chest.getInventory());
Expected: The chest block switches to its open lid state, and closes again once the player closes the inventory again. Observed: The chest lid opens and immediately closes again. My guess is that the cause of this behavior can be found in `ContainerOpenersCounter#recheckOpeners`:
A possible solutions could be to make sure that the 'openCount' value remains in valid bounds, i.e. does not become negative. Unrelated to that: In the past, I liked the behavior that the chest would indicate that it is being interacted with, even if the player is slightly more than 5 blocks away. With the above fix, I guess plugins will now have to manually replicate the chest opening/closing animation + sounds when they want to retain the previous behavior. |