API reference / @jsprismarine/entity-goals / Navigator
Class: Navigator
Defined in: navigator.ts:91
Moves one entity along a path.
Constructors
Constructor
new Navigator(
context):Navigator
Defined in: navigator.ts:105
Parameters
context
Returns
Navigator
Accessors
walking
Get Signature
get walking():
boolean
Defined in: navigator.ts:108
Whether a walk is under way.
Returns
boolean
Methods
arrived()
arrived():
boolean
Defined in: navigator.ts:113
Whether the last walk ended at its destination.
Returns
boolean
canReach()
canReach(
destination,goalRadius?):boolean
Defined in: navigator.ts:185
Whether a route to the position exists, without starting to walk it.
Parameters
destination
goalRadius?
number = 1
Returns
boolean
moveTo()
moveTo(
destination,speedMultiplier,goalRadius?):boolean
Defined in: navigator.ts:127
Starts walking to a position.
Parameters
destination
speedMultiplier
number
goalRadius?
number = 1
How close counts as arriving, in blocks.
Returns
boolean
Whether a route exists; false leaves the entity where it is, which is what a goal reads to refuse to start.
randomTarget()
randomTarget(
xzDistance,yDistance,random,attempts?):EntityPosition|undefined
Defined in: navigator.ts:275
A reachable position in the box around the entity.
With a view it draws candidates and keeps the first the path finder reaches, skipping water destinations when the active navigation says to avoid water; without one it asks the actuator, which is what the reference goals in @jsprismarine/entities do.
Parameters
xzDistance
number
yDistance
number
random
() => number
Draws the candidate offsets, in [0, 1).
attempts?
number = 10
Returns
EntityPosition | undefined
stop()
stop():
void
Defined in: navigator.ts:248
Abandons the walk.
Returns
void
tick()
tick():
boolean
Defined in: navigator.ts:205
Advances the walk by one tick.
Returns
boolean
Whether the walk is still running; false means the entity arrived, ran out of path or stopped making progress.