mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 05:15:11 +00:00
Create Combat Handler to help Ai to help manage which player should be at tacked
This commit is contained in:
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
|
||||
|
||||
Reference in new issue
Block a user