Jump to content

PleaseHelpACoolKid

Members
  • Posts

    1
  • Joined

  • Last visited

PleaseHelpACoolKid's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. PROBLEM DESCRIPTION : 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 THE CODE : 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"); } } } } } } } WHAT I'VE TRIED/WHAT I KNOW : 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)
×
×
  • Create New...

Important Information

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