Package net.citizensnpcs.api.ai
Interface Navigator
- All Known Implementing Classes:
- CitizensNavigator
public interface Navigator
Represents the pathfinding AI of an 
NPC. The navigator can path towards a single target at a time.- 
Method SummaryModifier and TypeMethodDescriptionvoidCancels any running navigation towards a target.voidcancelNavigation(CancelReason reason) Cancels any running navigation towards a target with a specificCancelReason.booleancanNavigateTo(Location dest) booleancanNavigateTo(Location dest, NavigatorParameters params) Returns whether the NPC can navigate to the given destination with the navigator parameters.Returns theNavigatorParameterslocal to this navigator.Returns the currentEntityTargetof the navigator, if any.Returns theNavigatorParameterslocal to any current target execution.getNPC()booleanbooleanisPaused()voidsetPaused(boolean paused) Sets whether the navigator is paused and shouldn't process the path for now.voidsetStraightLineTarget(Entity target, boolean aggressive) Sets the current navigation to an entity target.voidsetStraightLineTarget(Location target) Sets the current navigation to aLocationdestination.voidSets the current navigation using a list ofVectors which will be moved between sequentially using the Citizens movement logic without pathfinding.voidsetTarget(Function<NavigatorParameters, PathStrategy> strategy) Sets the current navigation to the specified strategy.voidSets the current navigation to an entity target.voidSets the current navigation to aLocationdestination.
- 
Method Details
- 
getDefaultParametersNavigatorParameters getDefaultParameters()Returns theNavigatorParameterslocal to this navigator. These parameters are copied to local target parameters when a new target is started.- Returns:
- The default parameters
- See Also:
 
- 
getEntityTargetEntityTarget getEntityTarget()Returns the currentEntityTargetof the navigator, if any. May return null.- Returns:
- The current entity target
 
- 
getLocalParametersNavigatorParameters getLocalParameters()Returns theNavigatorParameterslocal to any current target execution. These are updated independently of the default parameters.- Returns:
- The local parameters
- See Also:
 
- 
getNPCNPC getNPC()- Returns:
- The NPCattached to this navigator
 
- 
getPathStrategyPathStrategy getPathStrategy()- Returns:
- The current PathStrategyor null if the navigator is not pathfinding
 
- 
getTargetAsLocationLocation getTargetAsLocation()Returns the currentLocationbeing navigated towards - this is not necessarily permanent and may change, for example when pathing towards a movingEntity. May return null.- Returns:
- The target location
 
- 
getTargetTypeTargetType getTargetType()- Returns:
- The current TargetTypeof the navigator
 
- 
isPausedboolean isPaused()- Returns:
- Whether the navigator is currently paused
 
- 
setPausedvoid setPaused(boolean paused) Sets whether the navigator is paused and shouldn't process the path for now.- Parameters:
- paused- Whether the navigator should be paused or not
 
- 
setStraightLineTargetSets the current navigation to an entity target. The NPC will walk towards them in a straight line without pathfinding.- Parameters:
- target- The- Entityto walk towards
- aggressive- Whether to attack the target when close enough
 
- 
setStraightLineTargetSets the current navigation to aLocationdestination. The NPC will walk straight towards it without pathfinding.- Parameters:
- target- The destination
 
- 
setTargetSets the current navigation to an entity target.- Parameters:
- target- The- Entityto path towards
- aggressive- Whether to attack the target when close enough
 
- 
setTargetSets the current navigation to the specified strategy.- Parameters:
- strategy-
 
- 
setTargetSets the current navigation using a list ofVectors which will be moved between sequentially using the Citizens movement logic without pathfinding.- Parameters:
- path- The path
 
- 
setTargetSets the current navigation to aLocationdestination.- Parameters:
- target- The destination