NPC's script containers are only saved to NBT if they have code.

This commit is contained in:
Luis C.M committed 2023-08-01 16:39:08 -05:00
1 parent 4046213fa8
commit a422f041d5
1 file changed
+6 -3
@@ -116,9 +116,12 @@ public class DataScript implements INpcScriptHandler {
NBTTagList list = new NBTTagList();
for (Map.Entry<EnumScriptType,ScriptContainer> entry : scripts.entrySet()) {
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setInteger("Type", entry.getKey().ordinal());
entry.getValue().writeToNBT(tagCompound);
list.appendTag(tagCompound);
ScriptContainer container = entry.getValue();
if (container.hasCode()) {
tagCompound.setInteger("Type", entry.getKey().ordinal());
container.writeToNBT(tagCompound);
list.appendTag(tagCompound);
}
}
return list;
}