Fix issue introduced in c815d4bce9

This commit is contained in:
raoulvdberge
2019-07-21 16:51:13 +02:00
parent 22c91fe8f9
commit 6f669798b3

View File

@@ -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_STORAGE_TRACKER = "StorageTracker";
private static final String NBT_FLUID_STORAGE_TRACKER = "FluidStorageTracker"; private static final String NBT_FLUID_STORAGE_TRACKER = "FluidStorageTracker";
private static final String NBT_TYPE = "Type"; 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 EnergyStorage energyStorage = recreateEnergyStorage(0);
private PortableGridType type; private PortableGridType type;
@@ -247,10 +247,10 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
if (stack.getTagCompound().hasKey(PortableGrid.NBT_FLUID_STORAGE_TRACKER)) { if (stack.getTagCompound().hasKey(PortableGrid.NBT_FLUID_STORAGE_TRACKER)) {
fluidStorageTracker.readFromNbt(stack.getTagCompound().getTagList(PortableGrid.NBT_FLUID_STORAGE_TRACKER, Constants.NBT.TAG_COMPOUND)); fluidStorageTracker.readFromNbt(stack.getTagCompound().getTagList(PortableGrid.NBT_FLUID_STORAGE_TRACKER, Constants.NBT.TAG_COMPOUND));
} }
if (stack.getTagCompound().hasKey(NBT_ENCHANTMENTS)) { if (stack.getTagCompound().hasKey(NBT_ENCHANTMENTS)) {
enchants = stack.getTagCompound().getTagList(NBT_ENCHANTMENTS, Constants.NBT.TAG_COMPOUND); enchants = stack.getTagCompound().getTagList(NBT_ENCHANTMENTS, Constants.NBT.TAG_COMPOUND);
} }
} }
this.diskState = getDiskState(this); 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_STORAGE_TRACKER, storageTracker.serializeNbt());
stack.getTagCompound().setTag(PortableGrid.NBT_FLUID_STORAGE_TRACKER, fluidStorageTracker.serializeNbt()); stack.getTagCompound().setTag(PortableGrid.NBT_FLUID_STORAGE_TRACKER, fluidStorageTracker.serializeNbt());
if (enchants != null) { if (enchants != null) {
stack.getTagCompound().setTag(NBT_ENCHANTMENTS, enchants); stack.getTagCompound().setTag(NBT_ENCHANTMENTS, enchants);
} }
stack.getCapability(CapabilityEnergy.ENERGY, null).receiveEnergy(energyStorage.getEnergyStored(), false); stack.getCapability(CapabilityEnergy.ENERGY, null).receiveEnergy(energyStorage.getEnergyStored(), false);
for (int i = 0; i < 4; ++i) { 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_STORAGE_TRACKER, storageTracker.serializeNbt());
tag.setTag(NBT_FLUID_STORAGE_TRACKER, fluidStorageTracker.serializeNbt()); tag.setTag(NBT_FLUID_STORAGE_TRACKER, fluidStorageTracker.serializeNbt());
if (enchants != null) {
tag.setTag(NBT_ENCHANTMENTS, enchants); tag.setTag(NBT_ENCHANTMENTS, enchants);
}
return tag; return tag;
} }
@@ -660,10 +663,10 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
if (tag.hasKey(NBT_FLUID_STORAGE_TRACKER)) { if (tag.hasKey(NBT_FLUID_STORAGE_TRACKER)) {
fluidStorageTracker.readFromNbt(tag.getTagList(NBT_FLUID_STORAGE_TRACKER, Constants.NBT.TAG_COMPOUND)); fluidStorageTracker.readFromNbt(tag.getTagList(NBT_FLUID_STORAGE_TRACKER, Constants.NBT.TAG_COMPOUND));
} }
if (tag.hasKey(NBT_ENCHANTMENTS)) { if (tag.hasKey(NBT_ENCHANTMENTS)) {
enchants = tag.getTagList(NBT_ENCHANTMENTS, Constants.NBT.TAG_COMPOUND); enchants = tag.getTagList(NBT_ENCHANTMENTS, Constants.NBT.TAG_COMPOUND);
} }
} }
@Override @Override