Skip to content

Commit 6f66979

Browse files
committed
Fix issue introduced in c815d4b
1 parent 22c91fe commit 6f66979

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/main/java/com/raoulvdberge/refinedstorage/tile/grid/portable/TilePortableGrid.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
108108
private static final String NBT_STORAGE_TRACKER = "StorageTracker";
109109
private static final String NBT_FLUID_STORAGE_TRACKER = "FluidStorageTracker";
110110
private static final String NBT_TYPE = "Type";
111-
private static final String NBT_ENCHANTMENTS = "ench";
111+
private static final String NBT_ENCHANTMENTS = "ench"; // @Volatile: minecraft specific nbt key
112112
private EnergyStorage energyStorage = recreateEnergyStorage(0);
113113
private PortableGridType type;
114114

@@ -247,10 +247,10 @@ public void onPassItemContext(ItemStack stack) {
247247
if (stack.getTagCompound().hasKey(PortableGrid.NBT_FLUID_STORAGE_TRACKER)) {
248248
fluidStorageTracker.readFromNbt(stack.getTagCompound().getTagList(PortableGrid.NBT_FLUID_STORAGE_TRACKER, Constants.NBT.TAG_COMPOUND));
249249
}
250+
250251
if (stack.getTagCompound().hasKey(NBT_ENCHANTMENTS)) {
251252
enchants = stack.getTagCompound().getTagList(NBT_ENCHANTMENTS, Constants.NBT.TAG_COMPOUND);
252253
}
253-
254254
}
255255

256256
this.diskState = getDiskState(this);
@@ -276,11 +276,11 @@ public ItemStack getAsItem() {
276276

277277
stack.getTagCompound().setTag(PortableGrid.NBT_STORAGE_TRACKER, storageTracker.serializeNbt());
278278
stack.getTagCompound().setTag(PortableGrid.NBT_FLUID_STORAGE_TRACKER, fluidStorageTracker.serializeNbt());
279+
279280
if (enchants != null) {
280281
stack.getTagCompound().setTag(NBT_ENCHANTMENTS, enchants);
281282
}
282283

283-
284284
stack.getCapability(CapabilityEnergy.ENERGY, null).receiveEnergy(energyStorage.getEnergyStored(), false);
285285

286286
for (int i = 0; i < 4; ++i) {
@@ -611,7 +611,10 @@ public NBTTagCompound write(NBTTagCompound tag) {
611611

612612
tag.setTag(NBT_STORAGE_TRACKER, storageTracker.serializeNbt());
613613
tag.setTag(NBT_FLUID_STORAGE_TRACKER, fluidStorageTracker.serializeNbt());
614-
tag.setTag(NBT_ENCHANTMENTS, enchants);
614+
615+
if (enchants != null) {
616+
tag.setTag(NBT_ENCHANTMENTS, enchants);
617+
}
615618

616619
return tag;
617620
}
@@ -660,10 +663,10 @@ public void read(NBTTagCompound tag) {
660663
if (tag.hasKey(NBT_FLUID_STORAGE_TRACKER)) {
661664
fluidStorageTracker.readFromNbt(tag.getTagList(NBT_FLUID_STORAGE_TRACKER, Constants.NBT.TAG_COMPOUND));
662665
}
666+
663667
if (tag.hasKey(NBT_ENCHANTMENTS)) {
664668
enchants = tag.getTagList(NBT_ENCHANTMENTS, Constants.NBT.TAG_COMPOUND);
665669
}
666-
667670
}
668671

669672
@Override

0 commit comments

Comments
 (0)