Package net.citizensnpcs.api.ai.tree
Class Sequence
java.lang.Object
net.citizensnpcs.api.ai.tree.BehaviorGoalAdapter
net.citizensnpcs.api.ai.tree.Composite
net.citizensnpcs.api.ai.tree.Sequence
Runs each
Behavior
in sequence.-
Method Summary
Modifier and TypeMethodDescriptionstatic Sequence
createRetryingSequence
(Collection<Behavior> behaviors) Creates aretrying
sequence that will continue from the currentBehavior
if it returnsBehaviorStatus.FAILURE
instead of propagating the failure up to its parent.static Sequence
createRetryingSequence
(Behavior... behaviors) static Sequence
createSequence
(Collection<Behavior> behaviors) Creates sequence that will stop executing if the currentBehavior
returnsBehaviorStatus.FAILURE
.static Sequence
createSequence
(Behavior... behaviors) void
reset()
Resets the goal and any resources or state it is holding.boolean
run()
Runs the behavior for one 'tick', optionally changing the state that it is in.toString()
Methods inherited from class net.citizensnpcs.api.ai.tree.Composite
addBehavior, getBehaviors, removeBehavior, shouldExecute, stopExecution, tickParallel
Methods inherited from class net.citizensnpcs.api.ai.tree.BehaviorGoalAdapter
create, run, shouldExecute
-
Method Details
-
reset
public void reset()Description copied from interface:Goal
Resets the goal and any resources or state it is holding. -
retryChildren
public boolean retryChildren() -
run
Description copied from interface:Behavior
Runs the behavior for one 'tick', optionally changing the state that it is in.- Returns:
- The new state
-
toString
-
createRetryingSequence
-
createRetryingSequence
Creates aretrying
sequence that will continue from the currentBehavior
if it returnsBehaviorStatus.FAILURE
instead of propagating the failure up to its parent. -
createSequence
-
createSequence
Creates sequence that will stop executing if the currentBehavior
returnsBehaviorStatus.FAILURE
.
-