Beispiel #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);
  }
Beispiel #2
0
  @Override
  public void q_() {
    if (flow.update()) {
      hasChanged = true;
    }

    if (hasChanged) {
      hasChanged = false;

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

      dirtyBlock();
    }
  }