예제 #1
0
  @Override
  public void save(NBTTagCompound tag) {

    super.save(tag);
    for (int i = 0; i < 6; i++) {
      tag.setBoolean("connections" + i, connections[i]);
    }
    tag.setByte("tubeColor", (byte) color.ordinal());

    NBTTagCompound logicTag = new NBTTagCompound();
    logic.writeToNBT(logicTag);
    tag.setTag("logic", logicTag);
  }
예제 #2
0
  @Override
  public void update() {

    if (tick == 0) {
      logic.world = world;
      logic.x = x;
      logic.y = y;
      logic.z = z;
    }
    logic.update();
    super.update();
    if (tick == 3) updateConnections();
  }
예제 #3
0
  @Override
  public void load(NBTTagCompound tag) {

    super.load(tag);
    int connectionCount = 0;
    for (int i = 0; i < 6; i++) {
      connections[i] = tag.getBoolean("connections" + i);
      if (connections[i]) connectionCount++;
    }
    isCrossOver = connectionCount != 2;
    color = TubeColor.values()[tag.getByte("tubeColor")];

    NBTTagCompound logicTag = tag.getCompoundTag("logic");
    logic.readFromNBT(logicTag);
  }