-
Recently Browsing
- No registered users viewing this page.
-
Posts
-
Something is taking too long on the server thread. You should have a crash report saying what the server thread is doing. There are lots of warning messages from valkyrenskies. Check you have the latest version of that mod then contact them.
-
Issue with valhelsia_core, others have said it conflicts with optifine.
-
The version you are using is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
-
By PleaseHelpACoolKid · Posted
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)
-
-
Topics
-
Who's Online (See full list)
Recommended Posts