Added target lost event. Added all new NPC events to the old 1.7.10 script system.

This commit is contained in:
Luis C.M committed 2023-03-16 04:56:33 -05:00
1 parent 29935a1c6d
commit fe780d69ee
9 files changed
+39 -8

No files matched your search

+10
View File
@@ -204,6 +204,16 @@ public class EventHooks {
return NpcAPI.EVENT_BUS.post(event);
}
public static boolean onNPCTargetLost(EntityNPCInterface npc, EntityLivingBase prevtarget, EntityLivingBase newTarget) {
if(npc.script.isClient())
return false;
NpcEvent.TargetLostEvent event = new NpcEvent.TargetLostEvent(npc.wrappedNPC, prevtarget, newTarget);
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TARGET_LOST, event);
npc.script.callScript(EnumScriptType.TARGET_LOST, event);
return NpcAPI.EVENT_BUS.post(event);
}
public static void onNPCCollide(EntityNPCInterface npc, Entity entity){
if(npc == null || npc.wrappedNPC == null)
return;