Class Navigator


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

    • Navigator

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

    • moveTowards

      public PhysicsResult moveTowards(@NotNull @NotNull Point direction, double speed)
      Used to move the entity toward direction in the X and Z axis Gravity is still applied but the entity will not attempt to jump Also update the yaw/pitch of the entity to look along 'direction'
      direction - the targeted position
      speed - define how far the entity will move
    • jump

      public void jump(float height)
    • setPathTo

      public boolean setPathTo(@Nullable @Nullable Point point, boolean bestEffort)
      Retrieves the path to position and ask the entity to follow the path.

      Can be set to null to reset the pathfinder.

      The position is cloned, if you want the entity to continually follow this position object you need to call this when you want the path to update.

      point - the position to find the path to, null to reset the pathfinder
      bestEffort - whether to use the best-effort algorithm to the destination, if false then this method is more likely to return immediately
      true if a path has been found
    • setPathTo

      public boolean setPathTo(@Nullable @Nullable Point position)
      See Also:
    • tick

      @Internal public void tick()
    • getPathPosition

      @Nullable public @Nullable Point getPathPosition()
      Gets the target pathfinder position.
      the target pathfinder position, null if there is no one
    • getEntity

      @NotNull public @NotNull Entity getEntity()
    • getPathingEntity

      @Internal @NotNull public @NotNull PFPathingEntity getPathingEntity()
    • setPathFinder

      @Internal public void setPathFinder(@Nullable @Nullable pathFinder)