Create Combat Handler to help Ai to help manage which player should be at tacked

This commit is contained in:
Kam committed 2024-01-23 23:16:42 -05:00
1 parent 97d3df9f38
commit ebffc0e80e
7 files changed
+253 -69

No files matched your search

@@ -16,19 +16,15 @@ public class EntityAIClearTarget extends EntityAITarget
@Override
public boolean shouldExecute(){
target = taskOwner.getAttackTarget();
target = npc.getAttackTarget();
if (target == null)
return false;
if(target instanceof EntityPlayer && ((EntityPlayer)target).capabilities.disableDamage)
return true;
int distance = npc.stats.aggroRange * 2 * npc.stats.aggroRange;
if(npc.getOwner() != null && npc.getDistanceSqToEntity(npc.getOwner()) > distance){
return true;
if(npc.getOwner() != null && !npc.isInRange(npc.getOwner(), npc.stats.aggroRange * 2)){
return true;
}
return npc.getDistanceSqToEntity(target) > distance;
return npc.combatHandler.checkTarget();
}
@Override