Implemented Global NPC Events!

All NPCs activate these scripts. If a player wants to create a script that's universally used by all NPCs, this allows for that to happen with a lot of ease!
This commit is contained in:
Luis C.M committed 2022-03-23 03:54:06 -05:00
1 parent 092592bd27
commit 18ff2bff78
15 files changed
+562 -38

No files matched your search

@@ -0,0 +1,33 @@
package noppes.npcs.client.gui.script;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
import noppes.npcs.client.gui.util.GuiNPCInterface;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.controllers.data.ForgeDataScript;
import noppes.npcs.controllers.data.NPCDataScript;
public class GuiScriptAllNPCs extends GuiScriptInterface {
private NPCDataScript script = new NPCDataScript(null);
public GuiScriptAllNPCs() {
this.handler = this.script;
Client.sendData(EnumPacketServer.ScriptNPCGet, new Object[0]);
}
public void setGuiData(NBTTagCompound compound) {
this.script.readFromNBT(compound);
super.setGuiData(compound);
}
public void save() {
super.save();
Client.sendData(EnumPacketServer.ScriptNPCSave, new Object[]{this.script.writeToNBT(new NBTTagCompound())});
}
public void close() {
super.close();
ScriptController.Instance.npcScripts.errored.clear();
}
}