O
- The type of agentpublic interface AITask<O extends Agent>
Agent
s. If you desire to create your own, see
AbstractAITask
.Modifier and Type | Method and Description |
---|---|
boolean |
canBeInterrupted()
Returns if this task can be interrupted.
|
boolean |
canRunConcurrentWith(AITask<O> other)
Tests if the provided
AITask is allowed to be ran concurrently
with this task. |
Optional<Goal<O>> |
getGoal()
Gets the
Goal that is updating this task, if any. |
default Optional<O> |
getOwner()
Gets the
Agent that owns this task, if any. |
AITaskType |
getType()
Gets the
AITaskType of this task. |
AITaskType getType()
AITaskType
of this task.Optional<Goal<O>> getGoal()
Goal
that is updating this task, if any.Optional.empty()
if not presentdefault Optional<O> getOwner()
Agent
that owns this task, if any.Optional.empty()
if not presentboolean canRunConcurrentWith(AITask<O> other)
AITask
is allowed to be ran concurrently
with this task.
This plays a role in determining if tasks should be updated or not. If this method is being called on this task, that means:
getGoal()
.other
- The other taskboolean canBeInterrupted()
Thought should be made before blindly returning true or false here.
In Minecraft, all tasks can be interrupted by higher priority tasks
(tasks added with lower numerical values in
Goal.addTask(int, AITask)
) but a task being created by a plugin
might be deemed critical and as such should return false.
Due note that the meaning of "true" changes based on the state of the
Goal
. To put it simply, this value can mean "Should I be added
as an updating task or "Should I continue updating?". Regardless of the
question, the next step that happens is transferring from this method to
canRunConcurrentWith(AITask)
in the next AI tick loop.