Jump to content

Kantaga

Members
  • Posts

    6
  • Joined

  • Last visited

Kantaga's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I fixed the issue. Thanks for pointing out that it was a side issue.
  2. So are there any default vanilla ways of sending this data to the server? Or should I create my own message for this using SimpleImpl?
  3. In my mod, I have an item that looks at all blocks of a specific type (tester) connected to the block (like a drawer controller from storage drawers), and calls a method on the tile entity of each tester. The tile entity has 2 fields, an integer and a boolean. The function called uses both fields. If I change the integer to a non-zero value, and then call the function that looks at all the testers, The value of the integer is zero. This is the part where I gather all the tileentities (This is defined in the class extending Block): Set<TileEntityTester> testPositions = new HashSet<>(); Queue<BlockPos> posQueue = new LinkedList<>(); posQueue.add(pos); while(posQueue.size() > 0) { BlockPos position = posQueue.poll(); BlockPos[] neighbours = PosUtil.getNeighbours(position); for (BlockPos npos : neighbours) { if (worldIn.getTileEntity(npos) instanceof TileEntityTester) { testPositions.add((TileEntityTester) worldIn.getTileEntity(npos)); posQueue.add(npos); } } } This is the part where I change the values of the tester tileentity (Defined in the GUI): tileEntity.expect = Integer.parseInt(text.getText()); tileEntity.markDirty(); tileEntity.errorMode = stateTriggered; tileEntity.markDirty();
  4. I've used the documentation on SimpleImpl to send it to the server-side, and it is now fixed. Thank you for helping me.
  5. So that would mean I either have to execute the program on the server-side, or I have to somehow retrieve the contents of the chest from the server. How would I go by doing that?
  6. Currently it executes after a press on a GUI button, so it's client side.
  7. For a feature in my mod, I need to loop through a (trapped) chest, and count the total number of items in the inventory. For some reason, it will always result to 0, even if there are items in the inventory. When using the debugger, and look at the inventory inside the capability, all slots show "1xtile.air@0" This is my code for the function. Outside the function I already ensure that there is a chest at the position. private int countChest(BlockPos pos) { TileEntityChest chest = (TileEntityChest) world.getTileEntity(pos); IItemHandler capability = chest.getSingleChestHandler(); int val = 0; for(int i = 0; i < capability.getSlots(); i++) { val += capability.getStackInSlot(i).getCount(); } return val; }
×
×
  • Create New...

Important Information

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