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
@@ -398,7 +398,7 @@ public final class WandHelper {
if(wand.getTagCompound() == null) wand.setTagCompound((new NBTTagCompound()));
if(!wand.getTagCompound().hasKey(UPGRADES_KEY))
wand.getTagCompound().setTag(UPGRADES_KEY, new NBTTagCompound());
NBTExtras.storeTagSafely(wand.getTagCompound(), UPGRADES_KEY, new NBTTagCompound());
NBTTagCompound upgrades = wand.getTagCompound().getCompoundTag(UPGRADES_KEY);
@@ -406,7 +406,7 @@ public final class WandHelper {
if(key != null) upgrades.setInteger(key, upgrades.getInteger(key) + 1);
wand.getTagCompound().setTag(UPGRADES_KEY, upgrades);
NBTExtras.storeTagSafely(wand.getTagCompound(), UPGRADES_KEY, upgrades);
}
/** Returns true if the given item is a valid special wand upgrade. */