Player, Forge, & NPC scripts are saved in separate packets for separate tabs now, so script save/get packets aren't too big for the server.

This commit is contained in:
Luis C.M committed 2023-02-19 13:38:43 -06:00
1 parent 0ddcd15162
commit b8dc090db8
11 files changed
+190 -78

No files matched your search

@@ -31,7 +31,11 @@ public class ForgeDataScript implements IScriptHandler {
}
public void readFromNBT(NBTTagCompound compound) {
this.scripts = NBTTags.GetScript(compound.getTagList("Scripts", 10), this);
if (compound.hasKey("Scripts")) {
this.scripts = NBTTags.GetScriptOld(compound.getTagList("Scripts", 10), this);
} else {
this.scripts = NBTTags.GetScript(compound,this);
}
this.scriptLanguage = compound.getString("ScriptLanguage");
if (!ScriptController.Instance.languages.containsKey(scriptLanguage)) {
if (!ScriptController.Instance.languages.isEmpty()) {
@@ -44,7 +48,10 @@ public class ForgeDataScript implements IScriptHandler {
}
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
compound.setTag("Scripts", NBTTags.NBTScript(this.scripts));
compound.setInteger("TotalScripts",this.scripts.size());
for (int i = 0; i < this.scripts.size(); i++) {
compound.setTag("Tab"+i,this.scripts.get(i).writeToNBT(new NBTTagCompound()));
}
compound.setString("ScriptLanguage", this.scriptLanguage);
compound.setBoolean("ScriptEnabled", this.enabled);
return compound;