コード例 #1
0
  @Override
  public void writeToNBT(NBTTagCompound nbtTags) {
    super.writeToNBT(nbtTags);

    nbtTags.setInteger("operatingTicks", operatingTicks);
    nbtTags.setBoolean("isActive", isActive);
    nbtTags.setInteger("controlType", controlType.ordinal());
  }
コード例 #2
0
  @Override
  public void readFromNBT(NBTTagCompound nbtTags) {
    super.readFromNBT(nbtTags);

    operatingTicks = nbtTags.getInteger("operatingTicks");
    clientActive = isActive = nbtTags.getBoolean("isActive");
    controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
  }
コード例 #3
0
  @Override
  public ArrayList getNetworkedData(ArrayList data) {
    super.getNetworkedData(data);

    data.add(operatingTicks);
    data.add(isActive);
    data.add(ticksRequired);
    data.add(controlType.ordinal());

    return data;
  }
コード例 #4
0
  @Override
  public void handlePacketData(ByteBuf dataStream) {
    super.handlePacketData(dataStream);

    operatingTicks = dataStream.readInt();
    clientActive = dataStream.readBoolean();
    ticksRequired = dataStream.readInt();
    controlType = RedstoneControl.values()[dataStream.readInt()];

    if (updateDelay == 0 && clientActive != isActive) {
      updateDelay = general.UPDATE_DELAY;
      isActive = clientActive;
      MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
    }
  }