crwdns122485:0crwdne122485:0

crwdns122487:0crwdne122487:0

crwdns122489:0crwdne122489:0

crwdns122491:0:javadoc:crwdnd122491:0:javadoc:crwdne122491:0

import org.spongepowered.api.entity.living.Agent;

World world = ...;
UUID uuid = ...;

Agent entity = (Agent) world.getEntity(uuid).get();

if (entity.getAgentData().aiEnabled().get()) {
    configureAI(entity);
}

crwdns122493:0crwdne122493:0

crwdns122495:0crwdne122495:0

crwdns122497:0:javadoc:crwdnd122497:0{types}crwdnd122497:0:javadoc:crwdne122497:0

crwdns122499:0:javadoc:crwdnd122499:0{NORMAL}crwdne122499:0

crwdns122501:0:javadoc:crwdnd122501:0{TARGET}crwdne122501:0

crwdns122503:0crwdne122503:0

import org.spongepowered.api.entity.ai.Goal;
import org.spongepowered.api.entity.ai.GoalTypes;

Agent entity = ...;

Optional<Goal<Agent>> normalGoal = entity.getGoal(GoalTypes.NORMAL);
if (normalGoal.isPresent()) {
    normalGoal.get().clear();
}

crwdns122505:0crwdne122505:0

Note

crwdns122507:0crwdne122507:0

Note

crwdns122509:0crwdne122509:0

crwdns122511:0crwdne122511:0

crwdns122513:0:javadoc:crwdnd122513:0:javadoc:crwdnd122513:0{WATCH_CLOSEST}crwdnd122513:0:javadoc:crwdnd122513:0{AVOID_ENTITY}crwdne122513:0

Note

crwdns122515:0crwdne122515:0

crwdns122517:0crwdne122517:0

crwdns122519:0crwdne122519:0

import org.spongepowered.api.entity.ai.task.builtin.WatchClosestAITask;

Agent entity = ...;
Goal<Agent> goal = ...;

WatchClosestAITask watchClosestAiTask = WatchClosestAITask.builder()
        .chance(1)
        .maxDistance(30)
        .watch(Player.class)
        .build(entity);
goal.addTask(0, watchClosestAiTask);

crwdns122521:0:javadoc:crwdnd122521:0:javadoc:crwdne122521:0

Note

crwdns122523:0crwdne122523:0

crwdns122525:0crwdne122525:0

crwdns122527:0:javadoc:crwdnd122527:0:javadoc:crwdne122527:0

crwdns122529:0crwdne122529:0

Goal<Zombie> goal = ...;

AITask<Zombie> attackTask = (AITask<Zombie>) goal.getTasks().get(1); // EntityAIZombieAttack
goal.removeTask(attackTask);

crwdns122531:0crwdne122531:0

Note

crwdns122533:0:javadoc:crwdne122533:0

crwdns122535:0crwdne122535:0

goal.removeTasks(AITaskTypes.WANDER);

crwdns122537:0:javadoc:crwdnd122537:0{WANDER}crwdne122537:0

Note

crwdns122539:0crwdne122539:0

crwdns122541:0:javadoc:crwdne122541:0

crwdns122543:0crwdne122543:0

crwdns122545:0:doc:crwdne122545:0

crwdns122547:0crwdne122547:0

crwdns122549:0:doc:crwdne122549:0

crwdns122551:0crwdne122551:0

  • crwdns122553:0:javadoc:crwdne122553:0

  • crwdns122555:0:javadoc:crwdne122555:0

  • crwdns122557:0:javadoc:crwdne122557:0

crwdns122559:0crwdne122559:0

crwdns122561:0crwdne122561:0

crwdns122563:0crwdne122563:0