mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 02:59:42 +00:00
Deleagted all ScriptContainer NBT based creation to IScriptUnit.createFromNBT
This commit is contained in:
1 parent
fbcda09fe2
commit
73db727c47
14 files changed
+61
-36
No files matched your search
@@ -105,11 +105,10 @@ public class PlayerDataScript implements INpcScriptHandler {
|
||||
if (player != null) {
|
||||
scripts.clear();
|
||||
for (IScriptUnit script : ScriptController.Instance.playerScripts.scripts) {
|
||||
if (script instanceof ScriptContainer) {
|
||||
ScriptContainer s = new ScriptContainer(this);
|
||||
s.readFromNBT(((ScriptContainer) script).writeToNBT(new NBTTagCompound()));
|
||||
scripts.add(s);
|
||||
}
|
||||
// Clone the script unit by writing to NBT and reading back with factory
|
||||
NBTTagCompound nbt = script.writeToNBT(new NBTTagCompound());
|
||||
IScriptUnit cloned = IScriptUnit.createFromNBT(nbt, this);
|
||||
scripts.add(cloned);
|
||||
}
|
||||
}
|
||||
lastPlayerUpdate = ScriptController.Instance.lastPlayerUpdate;
|
||||
|
||||
Reference in new issue
Block a user