Access chest inventory

Hello there,

I could not find the answer for this little question, so I ask it here so it can also help others. :wink:

Assuming I have a Location where I know there is a chest, how can I access its Inventory ?

Take a look at accessing inventories from a tile entity.

Assuming you know that the block at that location is a chest:

Location<World> loc = ...;
Chest chest = (Chest) loc.getTileEntity().get();
chest.getInventory();

Note that chest inventories are currently not implemented, and will throw an AbstractMethodError if you attempt to use it.

2 Likes

Oh I see, I’ll wait until it’s implemented then.

Thanks !

Would you know where I could follow the advancement of this implementation ? And eventually more generally where to go when looking for the advancement of a specific feature of sponge ?

Of course I know it takes time and it mustn’t be rushed. That’s why I don’t want to be asking every two days “Is it ok now ?” and just look by myself :stuck_out_tongue: