[SPIGOT-1185] Trapped chests cannot be cast to DirectionalContainer Created: 12/Sep/15  Updated: 15/Sep/15  Resolved: 15/Sep/15

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: SnowGears Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: cast, chest, material, trapped


 Description   

Spigot-6c9b0a1-de5c261 (MC: 1.8.8)

Trapped Chests cannot be cast to directional or directional containers.

(This code will only throw an error for Trapped Chests but will work for normal chests and ender chests)

Block block = event.getBlock();
if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST || block.getType() == Material.ENDER_CHEST)
DirectionalContainer chest = (DirectionalContainer) block.getState().getData(); //error thrown here on trapped chests



 Comments   
Comment by SnowGears [ 12/Sep/15 ]

I would classify that as a bug. I would propose either making it have Chest.class as the material data or create an entirely new material data class for org.bukkit.material.TrappedChest

Comment by Black Hole [ 12/Sep/15 ]

It seems there is no specific MaterialData class applied to TRAPPED_CHEST:
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/Material.java#212

Comment by iPyronic [ 12/Sep/15 ]

@Michael Imler
Questions like this should be put on http://spigotmc.org/forums/, not in a random bug report.

Since it is illegal to provide a download link to the server software following the DMCA takedown, SpigotMC cannot distribute the compiled project for users to obtain. Instead, users must build it themselves via BuildTools.jar. Instructions can be found within this wiki post: https://www.spigotmc.org/wiki/buildtools/

If you need any additional help, please use the forums next time. That is where most of the spigot community resides.

Comment by Michael Imler [ 12/Sep/15 ]

I cant seem to find the spigot.jar download that is required for me to start my server, could someone please give me the direct link to the download?

Comment by SnowGears [ 12/Sep/15 ]

It seems Trapped Chests have been left behind in having the directional functionality in code at all.

Here is the string output on the data of the chest states:

Type: CHEST
Data: CHEST(4) facing WEST

Type: TRAPPED_CHEST
Data: TRAPPED_CHEST(4)

Type: ENDER_CHEST
Data: ENDER_CHEST(4) facing WEST

Comment by SnowGears [ 12/Sep/15 ]

Tried the same thing with the updated version. Still get an error thrown.

Comment by SpigotMC [ 12/Sep/15 ]

Your build is not the latest and therefore may be the reason you are having this issue. Spigot is 6 version(s) behind. CraftBukkit is 7 version(s) behind. This message was automatically generated and is not guaranteed to be a solution to your issue.

Generated at Tue Apr 15 11:10:38 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.