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:
@@ -103,15 +103,15 @@ public abstract class EntityMagicConstruct extends Entity implements IEntityOwna
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbttagcompound){
|
||||
casterUUID = nbttagcompound.getUniqueId("casterUUID");
|
||||
if(nbttagcompound.hasUniqueId("casterUUID")) casterUUID = nbttagcompound.getUniqueId("casterUUID");
|
||||
lifetime = nbttagcompound.getInteger("lifetime");
|
||||
damageMultiplier = nbttagcompound.getFloat("damageMultiplier");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbttagcompound){
|
||||
if(this.getCaster() != null){
|
||||
nbttagcompound.setUniqueId("casterUUID", this.getCaster().getUniqueID());
|
||||
if(casterUUID != null){
|
||||
nbttagcompound.setUniqueId("casterUUID", casterUUID);
|
||||
}
|
||||
nbttagcompound.setInteger("lifetime", lifetime);
|
||||
nbttagcompound.setFloat("damageMultiplier", damageMultiplier);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user