Fixed the assistant spell not properly preserving the state of its held spell

This commit is contained in:
Sollace 2019-02-15 16:09:15 +02:00
parent 1700ce9276
commit 45d5840f82

View file

@ -50,6 +50,11 @@ public class SpellDrake extends AbstractSpell {
return super.getDead();
}
@Override
public boolean isDirty() {
return super.isDirty() || (piggyBackSpell != null && piggyBackSpell.isDirty());
}
@Override
public void onPlaced(ICaster<?> caster) {
if (caster.getEntity() instanceof EntitySpell) {
@ -108,7 +113,11 @@ public class SpellDrake extends AbstractSpell {
super.readFromNBT(compound);
if (compound.hasKey("effect")) {
piggyBackSpell = SpellRegistry.instance().createEffectFromNBT(compound.getCompoundTag("effect"));
if (piggyBackSpell != null) {
piggyBackSpell.readFromNBT(compound.getCompoundTag("effect"));
} else {
piggyBackSpell = SpellRegistry.instance().createEffectFromNBT(compound.getCompoundTag("effect"));
}
}
}
}