Esempio n. 1
0
 private void getInventoryOnServer() {
   InvBlockInfo invBlockInfo = getSelectedContainer();
   if (invBlockInfo != null) {
     Coordinate c = invBlockInfo.getCoordinate();
     RFToolsMessages.INSTANCE.sendToServer(
         new PacketGetInventory(
             tileEntity.xCoord,
             tileEntity.yCoord,
             tileEntity.zCoord,
             c.getX(),
             c.getY(),
             c.getZ()));
   }
 }
Esempio n. 2
0
  private void updateStorageList() {
    SyncedValueList<InvBlockInfo> inventories = tileEntity.getInventories();
    if (inventories.getClientVersion() != clientVersion) {
      clientVersion = inventories.getClientVersion();
      storageList.removeChildren();
      for (InvBlockInfo blockInfo : inventories) {
        Coordinate c = blockInfo.getCoordinate();
        Block block = mc.theWorld.getBlock(c.getX(), c.getY(), c.getZ());
        int meta = mc.theWorld.getBlockMetadata(c.getX(), c.getY(), c.getZ());
        String displayName;
        if (block == null || block.isAir(mc.theWorld, c.getX(), c.getY(), c.getZ())) {
          displayName = "[REMOVED]";
          block = null;
        } else {
          displayName = BlockInfo.getReadableName(block, meta);
        }

        Panel panel = new Panel(mc, this).setLayout(new HorizontalLayout());
        panel.addChild(new BlockRender(mc, this).setRenderItem(block));
        panel.addChild(
            new Label(mc, this)
                .setText(displayName)
                .setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT)
                .setDesiredWidth(90));
        panel.addChild(new Label(mc, this).setDynamic(true).setText(c.toString()));
        storageList.addChild(panel);
      }
    }
    storageList.clearHilightedRows();
    Set<Coordinate> coordinates = fromServer_coordinates;
    int i = 0;
    for (InvBlockInfo blockInfo : inventories) {
      Coordinate c = blockInfo.getCoordinate();
      if (coordinates.contains(c)) {
        storageList.addHilightedRow(i);
      }
      i++;
    }
  }