Fixed spell entities not saving their affinity

This commit is contained in:
Sollace 2019-02-17 19:21:22 +02:00
parent 759da19f6d
commit a98b027f0f

View file

@ -344,6 +344,10 @@ public class EntitySpell extends EntityCreature implements IMagicals, ICaster<En
@Override @Override
public void readEntityFromNBT(NBTTagCompound compound) { public void readEntityFromNBT(NBTTagCompound compound) {
super.readEntityFromNBT(compound); super.readEntityFromNBT(compound);
if (compound.hasKey("affinity")) {
setAffinity(SpellAffinity.of(compound.getString("affinity")));
}
setOwner(compound.getString("ownerName")); setOwner(compound.getString("ownerName"));
setCurrentLevel(compound.getInteger("level")); setCurrentLevel(compound.getInteger("level"));
@ -356,6 +360,7 @@ public class EntitySpell extends EntityCreature implements IMagicals, ICaster<En
public void writeEntityToNBT(NBTTagCompound compound) { public void writeEntityToNBT(NBTTagCompound compound) {
super.writeEntityToNBT(compound); super.writeEntityToNBT(compound);
compound.setString("affinity", getAffinity().name());
compound.setString("ownerName", getOwnerName()); compound.setString("ownerName", getOwnerName());
compound.setInteger("level", getCurrentLevel()); compound.setInteger("level", getCurrentLevel());