@Override public void readFromNBT(NBTTagCompound nbtTags) { super.readFromNBT(nbtTags); tier = FluidTankTier.values()[nbtTags.getInteger("tier")]; clientActive = isActive = nbtTags.getBoolean("isActive"); editMode = ContainerEditMode.values()[nbtTags.getInteger("editMode")]; if (nbtTags.hasKey("fluidTank")) { fluidTank.setCapacity(tier.storage); fluidTank.readFromNBT(nbtTags.getCompoundTag("fluidTank")); } }
@Override public boolean upgrade(BaseTier upgradeTier) { if (upgradeTier.ordinal() != tier.ordinal() + 1) { return false; } tier = FluidTankTier.values()[upgradeTier.ordinal()]; fluidTank.setCapacity(tier.storage); Mekanism.packetHandler.sendToReceivers( new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this))); markDirty(); return true; }
@Override public void handlePacketData(ByteBuf dataStream) { super.handlePacketData(dataStream); if (FMLCommonHandler.instance().getEffectiveSide().isClient()) { FluidTankTier prevTier = tier; tier = FluidTankTier.values()[dataStream.readInt()]; fluidTank.setCapacity(tier.storage); clientActive = dataStream.readBoolean(); valve = dataStream.readInt(); editMode = ContainerEditMode.values()[dataStream.readInt()]; if (valve > 0) { valveFluid = FluidRegistry.getFluid(PacketHandler.readString(dataStream)); } else { valveFluid = null; } if (dataStream.readInt() == 1) { fluidTank.setFluid( new FluidStack( FluidRegistry.getFluid(PacketHandler.readString(dataStream)), dataStream.readInt())); } else { fluidTank.setFluid(null); } if (prevTier != tier || (updateDelay == 0 && clientActive != isActive)) { updateDelay = general.UPDATE_DELAY; isActive = clientActive; MekanismUtils.updateBlock(worldObj, getPos()); } } }