Class PathFinder

java.lang.Object
net.minecraft.world.level.pathfinder.PathFinder

public class PathFinder extends Object
  • Field Details

    • FUDGING

      private static final float FUDGING
      See Also:
    • neighbors

      private final Node[] neighbors
    • maxVisitedNodes

      private int maxVisitedNodes
    • nodeEvaluator

      private final NodeEvaluator nodeEvaluator
    • openSet

      private final BinaryHeap openSet
    • captureDebug

      private BooleanSupplier captureDebug
  • Constructor Details

    • PathFinder

      public PathFinder(NodeEvaluator nodeEvaluator, int maxVisitedNodes)
  • Method Details

    • setCaptureDebug

      public void setCaptureDebug(BooleanSupplier captureDebug)
    • setMaxVisitedNodes

      public void setMaxVisitedNodes(int maxVisitedNodes)
    • findPath

      @Nullable public Path findPath(PathNavigationRegion region, Mob mob, Set<BlockPos> targetPositions, float maxRange, int accuracy, float searchDepthMultiplier)
      Finds a path to one of the specified positions and post-processes it or returns null if no path could be found within given accuracy
    • findPath

      @Nullable private Path findPath(Node node, Map<Target,BlockPos> targetPositions, float maxRange, int accuracy, float searchDepthMultiplier)
      Finds a path to one of the specified positions and post-processes it or returns null if no path could be found within given accuracy
    • distance

      protected float distance(Node first, Node second)
    • getBestH

      private float getBestH(Node node, Set<Target> targets)
    • reconstructPath

      private Path reconstructPath(Node point, BlockPos targetPos, boolean reachesTarget)
      Converts a recursive path point structure into a path