Wrap NBTTagCompound#setTag in static helper with safeguards against circular references, fixes #299

This commit is contained in:
Electroblob77
2020-01-27 13:45:47 +00:00
parent 6cd6411c25
commit f5da195605
31 changed files with 96 additions and 48 deletions
@@ -1,6 +1,7 @@
package electroblob.wizardry.spell;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.NBTExtras;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
@@ -89,7 +90,7 @@ public class ShulkerBullet extends Spell {
targetTag.setInteger("X", pos.getX());
targetTag.setInteger("Y", pos.getY());
targetTag.setInteger("Z", pos.getZ());
nbt.setTag("Target", targetTag);
NBTExtras.storeTagSafely(nbt, "Target", targetTag);
bullet.readFromNBT(nbt); // LOL I just modified private fields without reflection
world.spawnEntity(bullet);