mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 07:59:08 +00:00
Implemented scripted timers for players and NPCs.
This commit is contained in:
1 parent
a993c8feff
commit
4de969f6c9
15 files changed
+327
-16
No files matched your search
@@ -21,9 +21,9 @@ import net.minecraftforge.event.world.WorldEvent;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.ForgeDataScript;
|
||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.*;
|
||||
import noppes.npcs.scripted.event.ForgeEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent;
|
||||
import noppes.npcs.scripted.event.*;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.ChatEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.ContainerOpen;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.DamagedEntityEvent;
|
||||
@@ -46,6 +46,13 @@ public class EventHooks {
|
||||
public EventHooks() {
|
||||
}
|
||||
|
||||
public static void onNPCTimer(EntityNPCInterface npc, int id) {
|
||||
NpcEvent.TimerEvent event = new NpcEvent.TimerEvent(npc.wrappedNPC, id);
|
||||
ScriptEventTimer scriptEvent = new ScriptEventTimer(id);
|
||||
npc.script.callScript(EnumScriptType.TIMER, "event", scriptEvent);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerInit(PlayerDataScript handler) {
|
||||
noppes.npcs.scripted.event.PlayerEvent.InitEvent event = new noppes.npcs.scripted.event.PlayerEvent.InitEvent(handler.getPlayer());
|
||||
handler.callScript(EnumScriptType.INIT, event, "event", event);
|
||||
|
||||
Reference in new issue
Block a user