@@ -108,7 +108,7 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
108
108
private static final String NBT_STORAGE_TRACKER = "StorageTracker" ;
109
109
private static final String NBT_FLUID_STORAGE_TRACKER = "FluidStorageTracker" ;
110
110
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
112
112
private EnergyStorage energyStorage = recreateEnergyStorage (0 );
113
113
private PortableGridType type ;
114
114
@@ -247,10 +247,10 @@ public void onPassItemContext(ItemStack stack) {
247
247
if (stack .getTagCompound ().hasKey (PortableGrid .NBT_FLUID_STORAGE_TRACKER )) {
248
248
fluidStorageTracker .readFromNbt (stack .getTagCompound ().getTagList (PortableGrid .NBT_FLUID_STORAGE_TRACKER , Constants .NBT .TAG_COMPOUND ));
249
249
}
250
+
250
251
if (stack .getTagCompound ().hasKey (NBT_ENCHANTMENTS )) {
251
252
enchants = stack .getTagCompound ().getTagList (NBT_ENCHANTMENTS , Constants .NBT .TAG_COMPOUND );
252
253
}
253
-
254
254
}
255
255
256
256
this .diskState = getDiskState (this );
@@ -276,11 +276,11 @@ public ItemStack getAsItem() {
276
276
277
277
stack .getTagCompound ().setTag (PortableGrid .NBT_STORAGE_TRACKER , storageTracker .serializeNbt ());
278
278
stack .getTagCompound ().setTag (PortableGrid .NBT_FLUID_STORAGE_TRACKER , fluidStorageTracker .serializeNbt ());
279
+
279
280
if (enchants != null ) {
280
281
stack .getTagCompound ().setTag (NBT_ENCHANTMENTS , enchants );
281
282
}
282
283
283
-
284
284
stack .getCapability (CapabilityEnergy .ENERGY , null ).receiveEnergy (energyStorage .getEnergyStored (), false );
285
285
286
286
for (int i = 0 ; i < 4 ; ++i ) {
@@ -611,7 +611,10 @@ public NBTTagCompound write(NBTTagCompound tag) {
611
611
612
612
tag .setTag (NBT_STORAGE_TRACKER , storageTracker .serializeNbt ());
613
613
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
+ }
615
618
616
619
return tag ;
617
620
}
@@ -660,10 +663,10 @@ public void read(NBTTagCompound tag) {
660
663
if (tag .hasKey (NBT_FLUID_STORAGE_TRACKER )) {
661
664
fluidStorageTracker .readFromNbt (tag .getTagList (NBT_FLUID_STORAGE_TRACKER , Constants .NBT .TAG_COMPOUND ));
662
665
}
666
+
663
667
if (tag .hasKey (NBT_ENCHANTMENTS )) {
664
668
enchants = tag .getTagList (NBT_ENCHANTMENTS , Constants .NBT .TAG_COMPOUND );
665
669
}
666
-
667
670
}
668
671
669
672
@ Override
0 commit comments