From f07937dae3451178cfee43fe3b1e378c7c97ef2f Mon Sep 17 00:00:00 2001 From: Chicken Bones Date: Tue, 31 Jul 2012 08:33:06 +1000 Subject: [PATCH] Added compatibility NBTLoad in TileTank for transitioning from old worlds. --- common/buildcraft/factory/TileTank.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/common/buildcraft/factory/TileTank.java b/common/buildcraft/factory/TileTank.java index c08e2b82..2f1a1f7b 100644 --- a/common/buildcraft/factory/TileTank.java +++ b/common/buildcraft/factory/TileTank.java @@ -82,9 +82,18 @@ public class TileTank extends TileBuildCraft implements ITankContainer public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); - LiquidStack liquid = new LiquidStack(0, 0, 0); - liquid.readFromNBT(data.getCompoundTag("tank")); - tank.setLiquid(liquid); + + if(data.hasKey("stored") && data.hasKey("liquidId")) + { + LiquidStack liquid = new LiquidStack(data.getInteger("liquidId"), data.getInteger("stored"), 0); + tank.setLiquid(liquid); + } + else + { + LiquidStack liquid = new LiquidStack(0, 0, 0); + liquid.readFromNBT(data.getCompoundTag("tank")); + tank.setLiquid(liquid); + } } @Override