Interface Pathfinder


public interface Pathfinder
A Pathfinder is a class that can find a path between two positions while following a given set of rules.
  • Method Details

    • findPath

      default CompletionStage<PathfinderResult> findPath(PathPosition start, PathPosition target)
      Tries to find a Path between the two PathPositions.
      Returns:
      An CompletionStage that will contain a PathfinderResult.
    • findPath

      Tries to find a path between the specified start and target positions within the provided environment context.
      Parameters:
      start - The starting position for pathfinding.
      target - The target position for pathfinding.
      context - The environment context that provides additional information for the pathfinding operation. This parameter can be null if no specific context is required.
      Returns:
      A CompletionStage containing the PathfinderResult of the pathfinding operation, indicating the outcome and the resulting path.
    • abort

      void abort()
      Requests all currently running pathfinding operations of this pathfinder instance to abort. The abortion is cooperative and might not be immediate.

      Scope of Abortion: This method affects all pathfinding operations that are currently being executed by this specific pathfinder instance. If you need to abort individual operations independently, consider using separate pathfinder instances for each operation.

      Cooperative Abortion: The actual termination depends on the pathfinding algorithm's main loop checking the abort flag. The operation will complete with PathState.ABORTED as soon as possible.

      See Also:
    • registerPathfindingHook

      void registerPathfindingHook(PathfinderHook hook)
      Registers a PathfinderHook that will be called on every step of the pathfinding process. This can be used to modify the pathfinding process or to collect data.
      Parameters:
      hook - The hook to register.