Fix up engineiron to use the new tank persistence methods

This commit is contained in:
Christian 2013-03-29 18:17:49 -04:00
parent b341914b84
commit e6633ae6ff

View file

@ -207,8 +207,8 @@ public class EngineIron extends Engine {
if (nbttagcompound.hasKey("liquidId")) { if (nbttagcompound.hasKey("liquidId")) {
fuelTank.setLiquid(new LiquidStack(nbttagcompound.getInteger("liquidId"), nbttagcompound.getInteger("liquidQty"), nbttagcompound fuelTank.setLiquid(new LiquidStack(nbttagcompound.getInteger("liquidId"), nbttagcompound.getInteger("liquidQty"), nbttagcompound
.getInteger("liquidMeta"))); .getInteger("liquidMeta")));
} else if (nbttagcompound.hasKey("fuelTank")) { } else {
fuelTank.setLiquid(LiquidStack.loadLiquidStackFromNBT(nbttagcompound.getCompoundTag("fuelTank"))); fuelTank.readFromNBT(nbttagcompound.getCompoundTag("fuelTank"));
} }
burnTime = nbttagcompound.getInteger("burnTime"); burnTime = nbttagcompound.getInteger("burnTime");
@ -216,8 +216,8 @@ public class EngineIron extends Engine {
if (nbttagcompound.hasKey("coolantId")) { if (nbttagcompound.hasKey("coolantId")) {
coolantTank.setLiquid(new LiquidStack(nbttagcompound.getInteger("coolantId"), nbttagcompound.getInteger("coolantQty"), nbttagcompound coolantTank.setLiquid(new LiquidStack(nbttagcompound.getInteger("coolantId"), nbttagcompound.getInteger("coolantQty"), nbttagcompound
.getInteger("coolantMeta"))); .getInteger("coolantMeta")));
} else if (nbttagcompound.hasKey("coolantTank")) { } else {
coolantTank.setLiquid(LiquidStack.loadLiquidStackFromNBT(nbttagcompound.getCompoundTag("coolantTank"))); coolantTank.readFromNBT(nbttagcompound.getCompoundTag("coolantTank"));
} }
heat = nbttagcompound.getInteger("heat"); heat = nbttagcompound.getInteger("heat");
@ -232,13 +232,8 @@ public class EngineIron extends Engine {
@Override @Override
public void writeToNBT(NBTTagCompound nbttagcompound) { public void writeToNBT(NBTTagCompound nbttagcompound) {
if (fuelTank.getLiquid() != null) { nbttagcompound.setTag("fuelTank", fuelTank.writeToNBT(new NBTTagCompound()));
nbttagcompound.setTag("fuelTank", fuelTank.getLiquid().writeToNBT(new NBTTagCompound())); nbttagcompound.setTag("coolantTank", coolantTank.writeToNBT(new NBTTagCompound()));
}
if (coolantTank.getLiquid() != null) {
nbttagcompound.setTag("coolantTank", coolantTank.getLiquid().writeToNBT(new NBTTagCompound()));
}
nbttagcompound.setInteger("burnTime", burnTime); nbttagcompound.setInteger("burnTime", burnTime);
nbttagcompound.setInteger("heat", heat); nbttagcompound.setInteger("heat", heat);