Package net.citizensnpcs.npc.ai
Class CitizensNavigator
java.lang.Object
net.citizensnpcs.npc.ai.CitizensNavigator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Cancels any running navigation towards a target.Returns theNavigatorParameters
local to this navigator.Returns the currentEntityTarget
of the navigator, if any.Returns theNavigatorParameters
local to any current target execution.getNPC()
boolean
boolean
isPaused()
void
void
void
onSpawn()
void
run()
void
void
setPaused
(boolean paused) Sets whether the navigator is paused and shouldn't process the path for now.void
Sets the current navigation using a list ofVector
s which will be followed in turn.void
setTarget
(Iterable<Vector> path, Function<NavigatorParameters, PathStrategy> strategy) Sets the current navigation to aLocation
destination.void
Sets the current navigation to an entity target.void
setTarget
(Entity target, boolean aggressive, Function<NavigatorParameters, PathStrategy> strategy) Sets the current navigation to an entity target.void
Sets the current navigation to aLocation
destination.void
setTarget
(Location target, Function<NavigatorParameters, PathStrategy> strategy) Sets the current navigation to aLocation
destination.
-
Constructor Details
-
CitizensNavigator
-
-
Method Details
-
getDefaultParameters
Description copied from interface:Navigator
Returns theNavigatorParameters
local to this navigator. These parameters are copied to local target parameters when a new target is started.- Specified by:
getDefaultParameters
in interfaceNavigator
- Returns:
- The default parameters
- See Also:
-
getEntityTarget
Description copied from interface:Navigator
Returns the currentEntityTarget
of the navigator, if any. May return null.- Specified by:
getEntityTarget
in interfaceNavigator
- Returns:
- The current entity target
-
getLocalParameters
Description copied from interface:Navigator
Returns theNavigatorParameters
local to any current target execution. These are updated independently of the default parameters.- Specified by:
getLocalParameters
in interfaceNavigator
- Returns:
- The local parameters
- See Also:
-
getNPC
-
getPathStrategy
- Specified by:
getPathStrategy
in interfaceNavigator
- Returns:
- The current
PathStrategy
or null if the navigator is not pathfinding
-
getTargetAsLocation
Description copied from interface:Navigator
Returns the currentLocation
being navigated towards - this is not necessarily permanent and may change, for example when pathing towards a movingEntity
. May return null.- Specified by:
getTargetAsLocation
in interfaceNavigator
- Returns:
- The target location
-
getTargetType
- Specified by:
getTargetType
in interfaceNavigator
- Returns:
- The current
TargetType
of the navigator
-
isPaused
public boolean isPaused() -
load
-
onDespawn
public void onDespawn() -
onSpawn
public void onSpawn() -
run
public void run() -
save
-
setPaused
public void setPaused(boolean paused) Description copied from interface:Navigator
Sets whether the navigator is paused and shouldn't process the path for now. -
setTarget
Description copied from interface:Navigator
Sets the current navigation to an entity target. -
setTarget
public void setTarget(Entity target, boolean aggressive, Function<NavigatorParameters, PathStrategy> strategy) Description copied from interface:Navigator
Sets the current navigation to an entity target. -
setTarget
Description copied from interface:Navigator
Sets the current navigation using a list ofVector
s which will be followed in turn. -
setTarget
Description copied from interface:Navigator
Sets the current navigation to aLocation
destination. -
setTarget
Description copied from interface:Navigator
Sets the current navigation to aLocation
destination. -
setTarget
Description copied from interface:Navigator
Sets the current navigation to aLocation
destination.