@Override public void writeToNBT(NBTTagCompound nbtTags) { super.writeToNBT(nbtTags); nbtTags.setInteger("operatingTicks", operatingTicks); nbtTags.setBoolean("isActive", isActive); nbtTags.setInteger("controlType", controlType.ordinal()); }
@Override public void readFromNBT(NBTTagCompound nbtTags) { super.readFromNBT(nbtTags); operatingTicks = nbtTags.getInteger("operatingTicks"); clientActive = isActive = nbtTags.getBoolean("isActive"); controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")]; }
@Override public ArrayList getNetworkedData(ArrayList data) { super.getNetworkedData(data); data.add(operatingTicks); data.add(isActive); data.add(ticksRequired); data.add(controlType.ordinal()); return data; }
@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); } }