diff --git a/src/main/java/com/raoulvdberge/refinedstorage/tile/grid/portable/TilePortableGrid.java b/src/main/java/com/raoulvdberge/refinedstorage/tile/grid/portable/TilePortableGrid.java index 362890b08..142e0207f 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/tile/grid/portable/TilePortableGrid.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/tile/grid/portable/TilePortableGrid.java @@ -108,7 +108,7 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid, private static final String NBT_STORAGE_TRACKER = "StorageTracker"; private static final String NBT_FLUID_STORAGE_TRACKER = "FluidStorageTracker"; private static final String NBT_TYPE = "Type"; - private static final String NBT_ENCHANTMENTS = "ench"; + private static final String NBT_ENCHANTMENTS = "ench"; // @Volatile: minecraft specific nbt key private EnergyStorage energyStorage = recreateEnergyStorage(0); private PortableGridType type; @@ -247,10 +247,10 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid, if (stack.getTagCompound().hasKey(PortableGrid.NBT_FLUID_STORAGE_TRACKER)) { fluidStorageTracker.readFromNbt(stack.getTagCompound().getTagList(PortableGrid.NBT_FLUID_STORAGE_TRACKER, Constants.NBT.TAG_COMPOUND)); } + if (stack.getTagCompound().hasKey(NBT_ENCHANTMENTS)) { enchants = stack.getTagCompound().getTagList(NBT_ENCHANTMENTS, Constants.NBT.TAG_COMPOUND); } - } this.diskState = getDiskState(this); @@ -276,11 +276,11 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid, stack.getTagCompound().setTag(PortableGrid.NBT_STORAGE_TRACKER, storageTracker.serializeNbt()); stack.getTagCompound().setTag(PortableGrid.NBT_FLUID_STORAGE_TRACKER, fluidStorageTracker.serializeNbt()); + if (enchants != null) { stack.getTagCompound().setTag(NBT_ENCHANTMENTS, enchants); } - stack.getCapability(CapabilityEnergy.ENERGY, null).receiveEnergy(energyStorage.getEnergyStored(), false); for (int i = 0; i < 4; ++i) { @@ -611,7 +611,10 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid, tag.setTag(NBT_STORAGE_TRACKER, storageTracker.serializeNbt()); tag.setTag(NBT_FLUID_STORAGE_TRACKER, fluidStorageTracker.serializeNbt()); - tag.setTag(NBT_ENCHANTMENTS, enchants); + + if (enchants != null) { + tag.setTag(NBT_ENCHANTMENTS, enchants); + } return tag; } @@ -660,10 +663,10 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid, if (tag.hasKey(NBT_FLUID_STORAGE_TRACKER)) { fluidStorageTracker.readFromNbt(tag.getTagList(NBT_FLUID_STORAGE_TRACKER, Constants.NBT.TAG_COMPOUND)); } + if (tag.hasKey(NBT_ENCHANTMENTS)) { enchants = tag.getTagList(NBT_ENCHANTMENTS, Constants.NBT.TAG_COMPOUND); } - } @Override