diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlacedItem.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlacedItem.java index 32d2f4c9a..996361cb1 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlacedItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlacedItem.java @@ -6,6 +6,7 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Vec3; import com.brandon3055.draconicevolution.common.ModBlocks; @@ -52,7 +53,9 @@ public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); NBTTagCompound[] tag = new NBTTagCompound[1]; tag[0] = new NBTTagCompound(); - if (stack != null) tag[0] = stack.writeToNBT(tag[0]); + if (stack != null) { + stack.writeToNBT(tag[0]); + } compound.setTag("Item" + 0, tag[0]); compound.setFloat("Rotation", rotation); } @@ -63,6 +66,12 @@ public void readFromNBT(NBTTagCompound compound) { NBTTagCompound[] tag = new NBTTagCompound[1]; tag[0] = compound.getCompoundTag("Item" + 0); stack = ItemStack.loadItemStackFromNBT(tag[0]); + if (stack == null) { + throw new NullPointerException( + "Cannot load the Placed Item at location " + + Vec3.createVectorHelper(this.xCoord, this.yCoord, this.zCoord) + + " because the associated item is null!"); + } rotation = compound.getFloat("Rotation"); } }