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

@@ -420,11 +420,13 @@ public class NpcEvent extends CustomNPCsEvent implements INpcEvent {
@Cancelable
public static class TargetLostEvent extends NpcEvent implements INpcEvent.TargetLostEvent {
public final IEntityLivingBase entity;
public final IEntityLivingBase oldTarget;
public final IEntityLivingBase newTarget;
public TargetLostEvent(ICustomNpc npc, EntityLivingBase entity) {
public TargetLostEvent(ICustomNpc npc, EntityLivingBase oldTarget, EntityLivingBase newTarget) {
super(npc);
this.entity = (IEntityLivingBase) NpcAPI.Instance().getIEntity(entity);
this.oldTarget = (IEntityLivingBase) NpcAPI.Instance().getIEntity(oldTarget);
this.newTarget = (IEntityLivingBase) NpcAPI.Instance().getIEntity(newTarget);
}
public String getHookName() {
@@ -432,7 +434,11 @@ public class NpcEvent extends CustomNPCsEvent implements INpcEvent {
}
public IEntityLivingBase getTarget() {
return entity;
return oldTarget;
}
public IEntityLivingBase getNewTarget() {
return newTarget;
}
}