Store the caster UUID regardless of whether the entity actually exists, and only read the UUID if it exists in the tag compound

This commit is contained in:
Electroblob77
2020-06-19 16:33:57 +01:00
parent daf174ec3f
commit a87eca3bd8
2 changed files with 5 additions and 5 deletions
@@ -29,7 +29,7 @@ public class TileEntityPlayerSave extends TileEntity {
@Override
public void readFromNBT(NBTTagCompound tagCompound){
super.readFromNBT(tagCompound);
casterUUID = tagCompound.getUniqueId("casterUUID");
if(tagCompound.hasUniqueId("casterUUID")) casterUUID = tagCompound.getUniqueId("casterUUID");
}
@Override
@@ -37,7 +37,7 @@ public class TileEntityPlayerSave extends TileEntity {
super.writeToNBT(tagCompound);
if(this.getCaster() != null){
if(casterUUID != null){
tagCompound.setUniqueId("casterUUID", casterUUID);
}