Class Navigator

java.lang.Object
net.minestom.server.entity.pathfinding.Navigator

public final class Navigator extends Object
Necessary object for all NavigableEntity.
  • Constructor Details

    • Navigator

      public Navigator(@NotNull @NotNull Entity entity)
  • Method Details

    • getState

      @NotNull public PPath.State getState()
    • setPathTo

      public boolean setPathTo(@Nullable @Nullable Point point)
    • setPathTo

      public boolean setPathTo(@Nullable @Nullable Point point, double minimumDistance, @Nullable @Nullable Runnable onComplete)
    • setPathTo

      public boolean setPathTo(@Nullable @Nullable Point point, double minimumDistance, double maxDistance, double pathVariance, @Nullable @Nullable Runnable onComplete)
      Sets the path to position and ask the entity to follow the path.
      Parameters:
      point - the position to find the path to, null to reset the pathfinder
      minimumDistance - distance to target when completed
      maxDistance - maximum search distance
      pathVariance - 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 Point getGoalPosition()
      Gets the target pathfinder position.
      Returns:
      the target pathfinder position, null if there is no one
    • getEntity

      @NotNull public @NotNull Entity getEntity()
      Gets the entity which is navigating.
      Returns:
      the entity
    • reset

      public void reset()
    • isComplete

      public boolean isComplete()
    • getNodes

      public List<PNode> getNodes()
    • getPathPosition

      public Point getPathPosition()
    • setNodeFollower

      public void setNodeFollower(@NotNull @NotNull Supplier<NodeFollower> nodeFollower)
    • setNodeGenerator

      public void setNodeGenerator(@NotNull @NotNull Supplier<NodeGenerator> nodeGenerator)