crwdns142071:0crwdne142071:0

Warning

crwdns142073:0crwdne142073:0

crwdns142075:0crwdne142075:0

crwdns142077:0crwdne142077:0

crwdns142079:0:javadoc:crwdnd142079:0:javadoc:crwdne142079: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);
}

crwdns142081:0crwdne142081:0

crwdns142083:0crwdne142083:0

crwdns142085:0:javadoc:crwdnd142085:0{types}crwdnd142085:0:javadoc:crwdne142085:0

crwdns142087:0:javadoc:crwdnd142087:0{NORMAL}crwdne142087:0

crwdns142089:0:javadoc:crwdnd142089:0{TARGET}crwdne142089:0

crwdns142091:0crwdne142091: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();
}

crwdns142093:0crwdne142093:0

Note

crwdns142095:0crwdne142095:0

Note

crwdns142097:0crwdne142097:0

crwdns142099:0crwdne142099:0

crwdns142101:0:javadoc:crwdnd142101:0:javadoc:crwdnd142101:0{WATCH_CLOSEST}crwdnd142101:0:javadoc:crwdnd142101:0{AVOID_ENTITY}crwdne142101:0

Note

crwdns142103:0crwdne142103:0

crwdns142105:0crwdne142105:0

crwdns142107:0crwdne142107: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);

crwdns142109:0:javadoc:crwdnd142109:0:javadoc:crwdne142109:0

Note

crwdns142111:0crwdne142111:0

crwdns142113:0crwdne142113:0

crwdns142115:0:javadoc:crwdnd142115:0:javadoc:crwdne142115:0

crwdns142117:0crwdne142117:0

Goal<Zombie> goal = ...;

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

crwdns142119:0crwdne142119:0

Note

crwdns142121:0:javadoc:crwdne142121:0

crwdns142123:0crwdne142123:0

goal.removeTasks(AITaskTypes.WANDER);

crwdns142125:0:javadoc:crwdnd142125:0{WANDER}crwdne142125:0

Note

crwdns142127:0crwdne142127:0

crwdns142129:0:javadoc:crwdne142129:0

crwdns142131:0crwdne142131:0

crwdns142133:0:doc:crwdne142133:0

crwdns142135:0crwdne142135:0

crwdns142137:0:doc:crwdne142137:0

crwdns142139:0crwdne142139:0

  • crwdns142141:0:javadoc:crwdne142141:0

  • crwdns142143:0:javadoc:crwdne142143:0

  • crwdns142145:0:javadoc:crwdne142145:0

crwdns142147:0crwdne142147:0

crwdns142149:0crwdne142149:0

crwdns142151:0crwdne142151:0