Package net.citizensnpcs.api.ai
Class SimpleGoalController
java.lang.Object
net.citizensnpcs.api.ai.SimpleGoalController
- All Implemented Interfaces:
- Iterable<GoalController.GoalEntry>,- Runnable,- GoalController
A simple 
GoalController implementation that stores goals as a ArrayList. It works with both
 Behavior, Goal and will also consider PrioritisableGoals if implemented.- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from interface net.citizensnpcs.api.ai.GoalControllerGoalController.GoalEntry
- 
Constructor SummaryConstructors
- 
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()iterator()voidremoveBehavior(Behavior behavior) Removes the givenBehaviorfrom rotation.voidremoveGoal(Goal goal) Removes aGoalfrom rotation.voidrun()voidsetPaused(boolean paused) Sets whether the controller is paused.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Constructor Details- 
SimpleGoalControllerpublic SimpleGoalController()
 
- 
- 
Method Details- 
addBehaviorDescription copied from interface:GoalControllerRegisters aBehaviorwith a given priority.- Specified by:
- addBehaviorin interface- GoalController
- Parameters:
- behavior- The behavior
- priority- The priority
- See Also:
 
- 
addGoalDescription copied from interface:GoalControllerRegisters aGoalwith a given priority. Priority must be greater than 0.- Specified by:
- addGoalin interface- GoalController
- Parameters:
- goal- The goal
- priority- The goal priority
 
- 
addPrioritisableGoalDescription copied from interface:GoalControllerRegisters 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.- Specified by:
- addPrioritisableGoalin interface- GoalController
- Parameters:
- goal-
 
- 
cancelCurrentExecutionpublic void cancelCurrentExecution()Description copied from interface:GoalControllerCancels and resets the currently executing goal.- Specified by:
- cancelCurrentExecutionin interface- GoalController
 
- 
clearpublic void clear()Description copied from interface:GoalControllerClears the goal controller of allGoals. Will stop the execution of any current goal.- Specified by:
- clearin interface- GoalController
 
- 
isExecutingGoalpublic boolean isExecutingGoal()- Specified by:
- isExecutingGoalin interface- GoalController
- Returns:
- Whether a goal is currently being executed
 
- 
isPausedpublic boolean isPaused()- Specified by:
- isPausedin interface- GoalController
- Returns:
- Whether the controller is currently paused
- See Also:
 
- 
iterator- Specified by:
- iteratorin interface- Iterable<GoalController.GoalEntry>
 
- 
removeBehaviorDescription copied from interface:GoalControllerRemoves the givenBehaviorfrom rotation.- Specified by:
- removeBehaviorin interface- GoalController
- Parameters:
- behavior- The behavior to remove
 
- 
removeGoalDescription copied from interface:GoalControllerRemoves aGoalfrom rotation.- Specified by:
- removeGoalin interface- GoalController
- Parameters:
- goal- The goal to remove
 
- 
runpublic void run()
- 
setPausedpublic void setPaused(boolean paused) Description copied from interface:GoalControllerSets whether the controller is paused. While paused, no newGoals will be selected and any executing goals will be suspended.- Specified by:
- setPausedin interface- GoalController
- Parameters:
- paused- Whether to pause execution
 
 
-