Esempio n. 1
0
  protected void sendItemUpdate() {
    TubeItem lowestItem = null;
    if (!flow.contents.isEmpty()) {
      int lowestProgress = Integer.MAX_VALUE;
      for (TubeItem item : flow.contents) {
        if (item.isPacketSent()) {
          return;
        }

        if (item.progress <= lowestProgress) {
          lowestItem = item;
          lowestProgress = item.progress;
        }
      }
    }

    final Packet211TileDesc packet211tiledesc = new Packet211TileDesc();
    packet211tiledesc.subId = 10;
    packet211tiledesc.xCoord = x;
    packet211tiledesc.yCoord = y;
    packet211tiledesc.zCoord = z;
    packet211tiledesc.addUVLC(1); // TubeItem count

    if (lowestItem != null) {
      lowestItem.writeToPacket(packet211tiledesc);
    }

    packet211tiledesc.encode();
    CoreProxy.sendPacketToPosition(packet211tiledesc, x, z);
  }
  public void processPacket212(Packet212GuiEvent var1, NetHandler var2) {
    if (var2 instanceof NetClientHandler) {
      NetClientHandler var3 = (NetClientHandler) var2;
      EntityPlayer var4 = var3.getPlayer();

      if (var4.openContainer != null && var4.openContainer.windowId == var1.windowId) {
        if (var4.openContainer instanceof IHandleGuiEvent) {
          IHandleGuiEvent var5 = (IHandleGuiEvent) var4.openContainer;
          var5.handleGuiEvent(var1);
        }
      }
    } else {
      super.processPacket212(var1, var2);
    }
  }
Esempio n. 3
0
  @Override
  public void q_() {
    if (flow.update()) {
      hasChanged = true;
    }

    if (hasChanged) {
      hasChanged = false;

      if (CoreProxy.isServer()) {
        sendItemUpdate();
      }

      dirtyBlock();
    }
  }
  public void processPacket211(Packet211TileDesc var1, NetHandler var2) {
    if (var2 instanceof NetClientHandler) {
      NetClientHandler var3 = (NetClientHandler) var2;
      World var4 = var3.getPlayer().worldObj;

      if (var4.blockExists(var1.xCoord, var1.yCoord, var1.zCoord)) {
        TileEntity var5 = var4.getBlockTileEntity(var1.xCoord, var1.yCoord, var1.zCoord);

        if (var5 instanceof IHandlePackets) {
          ((IHandlePackets) var5).handlePacket(var1);
          return;
        }
      }
    } else {
      super.processPacket211(var1, var2);
    }
  }