Package net.citizensnpcs.api.ai
Interface GoalController
- All Superinterfaces:
- Iterable<GoalController.GoalEntry>,- Runnable
- All Known Implementing Classes:
- SimpleGoalController
Represents a collection of goals that are prioritised and executed, allowing behaviour trees via a
 
GoalSelector or by implementing Behavior.
 In general, using Behavior is preferred due to mapping more closely to traditional behavior trees.
 The highest priority Goal that returns true in Goal.shouldExecute(GoalSelector) is executed. Any
 existing goals with a lower priority are replaced via Goal.reset().- 
Nested Class SummaryNested Classes
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddBehavior(Behavior behavior, int priority) Registers aBehaviorwith a given priority.voidRegisters aGoalwith a given priority.voidRegisters a goal which can reprioritise itself dynamically every tick.voidCancels and resets the currently executing goal.voidclear()Clears the goal controller of allGoals.booleanbooleanisPaused()voidremoveBehavior(Behavior behavior) Removes the givenBehaviorfrom rotation.voidremoveGoal(Goal goal) Removes aGoalfrom rotation.voidsetPaused(boolean paused) Sets whether the controller is paused.Methods inherited from interface java.lang.IterableforEach, iterator, spliterator
- 
Method Details- 
addBehaviorRegisters aBehaviorwith a given priority.- Parameters:
- behavior- The behavior
- priority- The priority
- See Also:
 
- 
addGoalRegisters aGoalwith a given priority. Priority must be greater than 0.- Parameters:
- goal- The goal
- priority- The goal priority
 
- 
addPrioritisableGoalRegisters a goal which can reprioritise itself dynamically every tick. Implementation note: this may slow down individual goal controller ticks as the list must be sorted every tick.- Parameters:
- goal-
 
- 
cancelCurrentExecutionvoid cancelCurrentExecution()Cancels and resets the currently executing goal.
- 
clearvoid clear()Clears the goal controller of allGoals. Will stop the execution of any current goal.
- 
isExecutingGoalboolean isExecutingGoal()- Returns:
- Whether a goal is currently being executed
 
- 
isPausedboolean isPaused()- Returns:
- Whether the controller is currently paused
- See Also:
 
- 
removeBehaviorRemoves the givenBehaviorfrom rotation.- Parameters:
- behavior- The behavior to remove
 
- 
removeGoalRemoves aGoalfrom rotation.- Parameters:
- goal- The goal to remove
 
- 
setPausedvoid setPaused(boolean paused) Sets whether the controller is paused. While paused, no newGoals will be selected and any executing goals will be suspended.- Parameters:
- paused- Whether to pause execution
 
 
-