@Override public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); for (int i = 0; i < fluids.length; ++i) { NBTTagCompound nbttagcompound = data.getCompoundTag("fluidStack[" + i + "]"); if (nbttagcompound != null) fluids[i] = FluidRegistry.getFluid(nbttagcompound.getString("FluidName")); } }
@Override public void writeToNBT(NBTTagCompound data) { for (int i = 0; i < fluids.length; ++i) { NBTTagCompound nbt = new NBTTagCompound(); if (fluids[i] != null) nbt.setString("FluidName", fluids[i].getName()); data.setTag("fluidStack[" + i + "]", nbt); } super.writeToNBT(data); }