Jump to content

Can't detect items in a Chest on Minecraft version1.8 with MCP910

Recommended Posts


Hello, I was thinking of a fun algorithm ! I try to detect if there's items in a Chest and if there's items in it I should be able to display them in the chat. I putted 1 apple in each slots of the chest but it still say the message "empty" idk why



 public void onEvent(Event e) {
        if (e instanceof EventUpdate) { 
            if (e.isPre()) {
                 for (Object o : mc.theWorld.loadedTileEntityList) {
                    if (o instanceof TileEntityChest && mc.currentScreen instanceof GuiChest) { // If this is a Chest and If we are on the chest inventory
                        TileEntityChest chest = (TileEntityChest) o;
                        mc.thePlayer.sendChatMessage("Found chest at " + chest.getPos().getX() + ", " + chest.getPos().getY() + ", " + chest.getPos().getZ());
                        for (int i = 0; i < chest.getSizeInventory(); i++) {
                            ItemStack itemStack = chest.getStackInSlot(i); // Returns the stack in slot i
                            if (itemStack != null && itemStack.stackSize > 0) {
                                String itemName = itemStack.getDisplayName();
                                mc.thePlayer.sendChatMessage("Slot " + i + ": " + itemName);
                            } else {
                                mc.thePlayer.sendChatMessage("Slot " + i + ": Empty");


To detect the Chest and you see that there's the chest Coords in the chat

To detect the slots and It displays all the slots (27) but no element in it (that's the problem)


Link to comment
Share on other sites

The version you are using is no longer supported on this forum.

Please update to a modern version of Minecraft to receive support.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

This topic is now closed to further replies.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.