From 000a01daa29cf4fcbed6df54ea6c5754fe4187f1 Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Tue, 6 Aug 2013 15:03:35 -0400 Subject: [PATCH] fixed save issue with new formate --- .../dark/assembly/common/machine/TileEntityCrate.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/minecraft/dark/assembly/common/machine/TileEntityCrate.java b/src/minecraft/dark/assembly/common/machine/TileEntityCrate.java index c0c60baa..35abfe90 100644 --- a/src/minecraft/dark/assembly/common/machine/TileEntityCrate.java +++ b/src/minecraft/dark/assembly/common/machine/TileEntityCrate.java @@ -233,8 +233,6 @@ public class TileEntityCrate extends TileEntityInv implements IPacketReceiver, I public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - /* Crate data */ - this.blockMetadata = nbt.getInteger("size"); /* Load inventory old data if present */ this.getInventory().loadInv(nbt); /* Load current two inv methods */ @@ -245,8 +243,9 @@ public class TileEntityCrate extends TileEntityInv implements IPacketReceiver, I } else { - stack = ItemStack.loadItemStackFromNBT(nbt); + stack = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("stack")); } + /* Only load sample stack if the read stack is valid */ if (stack != null && stack.itemID != 0 && stack.stackSize > 0) { this.sampleStack = stack; @@ -264,10 +263,10 @@ public class TileEntityCrate extends TileEntityInv implements IPacketReceiver, I /* Save sample stack */ if (this.getSampleStack() != null) { - this.getSampleStack().writeToNBT(nbt); + NBTTagCompound tag = new NBTTagCompound(); + this.getSampleStack().writeToNBT(tag); + nbt.setCompoundTag("stack", tag); } - /* save metadata to improve loading conditions */ - nbt.setInteger("size", this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord)); }