Class Navigator
java.lang.Object
net.minestom.server.entity.pathfinding.Navigator
Necessary object for all
NavigableEntity
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull Entity
Gets the entity which is navigating.@Nullable Point
Gets the target pathfinder position.getNodes()
getState()
boolean
void
reset()
void
setNodeFollower
(@NotNull Supplier<NodeFollower> nodeFollower) void
setNodeGenerator
(@NotNull Supplier<NodeGenerator> nodeGenerator) boolean
boolean
setPathTo
(@Nullable Point point, double minimumDistance, double maxDistance, double pathVariance, @Nullable Runnable onComplete) Sets the path toposition
and ask the entity to follow the path.boolean
void
tick()
-
Constructor Details
-
Navigator
-
-
Method Details
-
getState
-
setPathTo
-
setPathTo
-
setPathTo
public boolean setPathTo(@Nullable @Nullable Point point, double minimumDistance, double maxDistance, double pathVariance, @Nullable @Nullable Runnable onComplete) Sets the path toposition
and ask the entity to follow the path.- Parameters:
point
- the position to find the path to, null to reset the pathfinderminimumDistance
- distance to target when completedmaxDistance
- maximum search distancepathVariance
- how far to search off of the direct path. For open worlds, this can be low (around 20) and for large mazes this needs to be very high.onComplete
- called when the path has been completed- Returns:
- true if a path is being generated
-
tick
@Internal public void tick() -
getGoalPosition
Gets the target pathfinder position.- Returns:
- the target pathfinder position, null if there is no one
-
getEntity
Gets the entity which is navigating.- Returns:
- the entity
-
reset
public void reset() -
isComplete
public boolean isComplete() -
getNodes
-
getPathPosition
-
setNodeFollower
-
setNodeGenerator
-