Constructor and Description |
---|
NavigatorParameters() |
Modifier and Type | Method and Description |
---|---|
NavigatorParameters |
addRunCallback(Runnable callback)
Adds a
Runnable callback that will be called every tick while the path is running. |
NavigatorParameters |
addSingleUseCallback(NavigatorCallback callback)
Adds a
NavigatorCallback that will be removed immediately after being called. |
int |
attackDelayTicks() |
NavigatorParameters |
attackDelayTicks(int ticks)
Sets the delay between attacks.
|
double |
attackRange() |
NavigatorParameters |
attackRange(double range)
When using aggressive NPC navigation, the NPC will wait until close enough to the target before attempting to use
the
attackStrategy() . |
AttackStrategy |
attackStrategy() |
void |
attackStrategy(AttackStrategy strategy)
Sets the
AttackStrategy for use when attacking entity targets. |
boolean |
avoidWater() |
NavigatorParameters |
avoidWater(boolean avoidWater)
Sets whether to avoid water while pathfinding
|
float |
baseSpeed() |
NavigatorParameters |
baseSpeed(float speed)
Sets the base movement speed of the
Navigator . |
Iterable<NavigatorCallback> |
callbacks() |
NavigatorParameters |
clearExaminers()
Clears all current
BlockExaminer s. |
NavigatorParameters |
clone() |
boolean |
debug()
Returns whether this path will be debugged.
|
NavigatorParameters |
debug(boolean debug)
Sets whether the path should be debugged.
|
AttackStrategy |
defaultAttackStrategy()
Returns the configured default attack strategy, which tries to perform the most Minecraft-like attack on
the target.
|
NavigatorParameters |
defaultAttackStrategy(AttackStrategy defaultStrategy)
Sets the default
AttackStrategy . |
double |
distanceMargin()
Returns the distance margin or leeway that the
Navigator will be able to stop from the target
destination. |
NavigatorParameters |
distanceMargin(double newMargin)
Sets the distance margin.
|
com.google.common.base.Function<org.bukkit.entity.Entity,org.bukkit.Location> |
entityTargetLocationMapper()
Gets the target location mapper.
|
NavigatorParameters |
entityTargetLocationMapper(com.google.common.base.Function<org.bukkit.entity.Entity,org.bukkit.Location> mapper)
Set the target location mapper.
|
NavigatorParameters |
examiner(BlockExaminer examiner)
Adds the given
BlockExaminer . |
BlockExaminer[] |
examiners()
Gets a copy of all current
BlockExaminer s. |
com.google.common.base.Function<Navigator,org.bukkit.Location> |
lookAtFunction() |
NavigatorParameters |
lookAtFunction(com.google.common.base.Function<Navigator,org.bukkit.Location> lookAt)
Sets the position to look at during pathfinding, overriding the default 'look at target' behaviour.
|
float |
modifiedSpeed(float toModify)
Modifieds the given speed value based on the current parameters.
|
double |
pathDistanceMargin()
Gets the path distance margin.
|
NavigatorParameters |
pathDistanceMargin(double distance)
Sets the path distance margin.
|
float |
range() |
NavigatorParameters |
range(float range)
Sets the pathfinding range in blocks.
|
NavigatorParameters |
removeRunCallback(Runnable runnable)
Removes a previously added run callback.
|
void |
run()
FOR INTERNAL USE ONLY: ticks all
Runnable callbacks. |
float |
speed() |
NavigatorParameters |
speed(float speed)
Deprecated.
@see
baseSpeed(float) |
float |
speedModifier() |
NavigatorParameters |
speedModifier(float percent)
Sets the movement speed modifier of the
Navigator . |
int |
stationaryTicks() |
NavigatorParameters |
stationaryTicks(int ticks)
Sets the number of stationary ticks before navigation is cancelled with a
CancelReason of STUCK. |
float |
straightLineTargetingDistance() |
NavigatorParameters |
straightLineTargetingDistance(float distance)
Sets the distance (in blocks) at which the entity targeter will switch to simply following a straight line to the
target instead of pathfinding.
|
StuckAction |
stuckAction()
Gets the
StuckAction of these parameters. |
NavigatorParameters |
stuckAction(StuckAction action)
Sets the
StuckAction of the parameters. |
int |
updatePathRate() |
NavigatorParameters |
updatePathRate(int rate)
Sets the update path rate, in ticks (default 20).
|
boolean |
useNewPathfinder() |
NavigatorParameters |
useNewPathfinder(boolean use)
Sets whether or not to use an A* pathfinder defined in
AStarMachine for pathfinding. |
public NavigatorParameters addRunCallback(Runnable callback)
Runnable
callback that will be called every tick while the path is running.callback
- The callback to addpublic NavigatorParameters addSingleUseCallback(NavigatorCallback callback)
NavigatorCallback
that will be removed immediately after being called.callback
- The callbackpublic int attackDelayTicks()
attackDelayTicks(int)
public NavigatorParameters attackDelayTicks(int ticks)
ticks
- The new number of ticks to wait between attackspublic double attackRange()
attackRange(double)
public NavigatorParameters attackRange(double range)
attackStrategy()
. This parameter determines the range in blocks squared before the target will be
valid to attack.range
- The new attack range, in blocks squaredpublic AttackStrategy attackStrategy()
AttackStrategy
currently in use or the defaultAttackStrategy()
if not configured
(may return null)public void attackStrategy(AttackStrategy strategy)
AttackStrategy
for use when attacking entity targets.strategy
- The strategy to usepublic boolean avoidWater()
public NavigatorParameters avoidWater(boolean avoidWater)
avoidWater
- Whether to avoid waterpublic float baseSpeed()
public NavigatorParameters baseSpeed(float speed)
Navigator
. Note that this is mob-specific and may not always be sane.
Using speedModifier()
is preferred.speed
- The new movement speedspeedModifier()
public Iterable<NavigatorCallback> callbacks()
public NavigatorParameters clearExaminers()
BlockExaminer
s.public NavigatorParameters clone()
public boolean debug()
public NavigatorParameters debug(boolean debug)
debug()
public AttackStrategy defaultAttackStrategy()
public NavigatorParameters defaultAttackStrategy(AttackStrategy defaultStrategy)
AttackStrategy
.defaultStrategy
- The new default strategydefaultAttackStrategy()
public double distanceMargin()
Navigator
will be able to stop from the target
destination. The margin will be measured against the block distance squared.
For example: if the distance margin were 2, then the Navigator
could stop moving towards the target when
it is 2 blocks squared away from it.public NavigatorParameters distanceMargin(double newMargin)
newMargin
- The new distance margindistanceMargin()
public com.google.common.base.Function<org.bukkit.entity.Entity,org.bukkit.Location> entityTargetLocationMapper()
Entity.getLocation(Location)
.public NavigatorParameters entityTargetLocationMapper(com.google.common.base.Function<org.bukkit.entity.Entity,org.bukkit.Location> mapper)
mapper
- The new mapperentityTargetLocationMapper(Function)
public NavigatorParameters examiner(BlockExaminer examiner)
BlockExaminer
.examiner
- The BlockExaminer to addpublic BlockExaminer[] examiners()
BlockExaminer
s.public com.google.common.base.Function<Navigator,org.bukkit.Location> lookAtFunction()
lookAtFunction(Function)
public NavigatorParameters lookAtFunction(com.google.common.base.Function<Navigator,org.bukkit.Location> lookAt)
lookAt
- Where to lookpublic float modifiedSpeed(float toModify)
toModify
- The speed value to modifypublic double pathDistanceMargin()
pathDistanceMargin(double)
public NavigatorParameters pathDistanceMargin(double distance)
distanceMargin(double)
.distance
- The distance marginpublic float range()
range(float)
public NavigatorParameters range(float range)
Navigator
will
attempt to pathfind before giving up to save computation.range
- The new rangepublic NavigatorParameters removeRunCallback(Runnable runnable)
runnable
- The run callback to removeaddRunCallback(Runnable)
public void run()
Runnable
callbacks.public float speed()
baseSpeed()
multiplied by speedModifier()
@Deprecated public NavigatorParameters speed(float speed)
baseSpeed(float)
Navigator
. Note that this is mob-specific and may not always be sane.
Using speedModifier()
is preferred.speed
- The new movement speedspeedModifier()
public float speedModifier()
speedModifier(float)
public NavigatorParameters speedModifier(float percent)
Navigator
. This is a percentage modifier that alters the movement
speed returned in speed()
.percent
- The new speed modifierpublic int stationaryTicks()
stationaryTicks(int)
public NavigatorParameters stationaryTicks(int ticks)
CancelReason
of STUCK.ticks
- The new number of stationary tickspublic float straightLineTargetingDistance()
straightLineTargetingDistance(float)
public NavigatorParameters straightLineTargetingDistance(float distance)
distance
- The distance (in blocks)public StuckAction stuckAction()
StuckAction
of these parameters. This will be run when the navigation is stuck and must either
be fixed up or cancelled.public NavigatorParameters stuckAction(StuckAction action)
StuckAction
of the parameters.action
- The new stuck actionstuckAction()
public int updatePathRate()
updatePathRate(int)
public NavigatorParameters updatePathRate(int rate)
rate
ticks.rate
- The new rate in ticks to usepublic boolean useNewPathfinder()
useNewPathfinder(boolean)
public NavigatorParameters useNewPathfinder(boolean use)
AStarMachine
for pathfinding.
If this is set to false, then the Minecraft pathfinder will be used, which may or may not be more consistent.
Note that certain API features will not be possible if this is set to false - this includes
examiner(BlockExaminer)
and distanceMargin(double)
.use
- Whether to use the A* pathfinderCopyright © 2021. All rights reserved.