Class Navigator
java.lang.Object
net.minestom.server.entity.pathfinding.Navigator
Necessary object for all
NavigableEntity.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull EntityGets the entity which is navigating.@Nullable net.minestom.server.coordinate.PointGets the target pathfinder position.getNodes()net.minestom.server.coordinate.PointgetState()booleanvoidreset()voidsetNodeFollower(@NotNull Supplier<NodeFollower> nodeFollower) voidsetNodeGenerator(@NotNull Supplier<NodeGenerator> nodeGenerator) booleansetPathTo(@Nullable net.minestom.server.coordinate.Point point) booleansetPathTo(@Nullable net.minestom.server.coordinate.Point point, double minimumDistance, double maxDistance, double pathVariance, @Nullable Runnable onComplete) Sets the path topositionand ask the entity to follow the path.booleansetPathTo(@Nullable net.minestom.server.coordinate.Point point, double minimumDistance, @Nullable Runnable onComplete) voidtick()
-
Constructor Details
-
Navigator
-
-
Method Details
-
getState
-
setPathTo
public boolean setPathTo(@Nullable @Nullable net.minestom.server.coordinate.Point point) -
setPathTo
public boolean setPathTo(@Nullable @Nullable net.minestom.server.coordinate.Point point, double minimumDistance, @Nullable @Nullable Runnable onComplete) -
setPathTo
public boolean setPathTo(@Nullable @Nullable net.minestom.server.coordinate.Point point, double minimumDistance, double maxDistance, double pathVariance, @Nullable @Nullable Runnable onComplete) Sets the path topositionand 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
@Nullable public @Nullable net.minestom.server.coordinate.Point 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
public net.minestom.server.coordinate.Point getPathPosition() -
setNodeFollower
-
setNodeGenerator
-