@Override public NBTTagCompound writeToNBT(NBTTagCompound nbtTags) { super.writeToNBT(nbtTags); nbtTags.setInteger("tier", tier.ordinal()); nbtTags.setBoolean("isActive", isActive); nbtTags.setInteger("editMode", editMode.ordinal()); if (fluidTank.getFluid() != null) { nbtTags.setTag("fluidTank", fluidTank.writeToNBT(new NBTTagCompound())); } return nbtTags; }
@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 ArrayList<Object> getNetworkedData(ArrayList<Object> data) { super.getNetworkedData(data); data.add(tier.ordinal()); data.add(isActive); data.add(valve); data.add(editMode.ordinal()); if (valve > 0) { data.add(FluidRegistry.getFluidName(valveFluid)); } if (fluidTank.getFluid() != null) { data.add(1); data.add(FluidRegistry.getFluidName(fluidTank.getFluid())); data.add(fluidTank.getFluid().amount); } else { data.add(0); } return data; }