Fixed item toss event not being cancellable. Setting a script container's engine doesn't happen on every script call now, reducing lag.

This commit is contained in:
Luis C.M committed 2023-05-29 23:57:45 -05:00
1 parent 2ec6e5b753
commit a0adf0d7bd
9 files changed
+28 -4

No files matched your search

@@ -72,11 +72,19 @@ public class DataScript implements IScriptHandler {
this.scriptLanguage = "ECMAScript";
}
}
for (ScriptContainer container : this.scripts.values()) {
container.setEngine(this.getLanguage());
}
enabled = compound.getBoolean("ScriptEnabled");
}
public void readEventsFromNBT(NBTTagCompound compound) {
eventScripts = NBTTags.GetScript(compound,this);
for (ScriptContainer container : this.eventScripts) {
container.setEngine(this.getLanguage());
}
}
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
@@ -149,7 +157,6 @@ public class DataScript implements IScriptHandler {
ScriptContainer script = scripts.get(type);
if(script == null || script.errored || !script.hasCode())
return false;
script.setEngine(scriptLanguage);
if(script.engine == null)
return false;
for(int i = 0; i + 1 < obs.length; i += 2){