Interface PathFilter

All Known Implementing Classes:
PassablePathFilter, SolidGroundPathFilter, WaterPathFilter
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface PathFilter
A PathFilter is a functional interface that allows customization of the pathfinding process within the Pathfinder. It provides a mechanism to influence the selection of paths during the pathfinding algorithm's execution.

In essence, a PathFilter acts as a whitelist for blocks during the pathfinding process. It evaluates each potential block (or node) on the path and determines whether it is valid or not based on the implemented filter logic. Only the blocks that pass the filter are considered valid and included in the final path.

  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Cleans up the resources used during the pathfinding process.
    boolean
    filter(@NonNull PathValidationContext pathValidationContext)
    Evaluates the given PathValidationContext to determine if the path is valid.
  • Method Details

    • filter

      boolean filter(@NonNull @NonNull PathValidationContext pathValidationContext)
      Evaluates the given PathValidationContext to determine if the path is valid. This method is used during the pathfinding process to filter out unwanted paths.
      Parameters:
      pathValidationContext - The context providing the information necessary to evaluate
      Returns:
      true if the path is valid, false otherwise
    • cleanup

      default void cleanup()
      Cleans up the resources used during the pathfinding process. This method is guaranteed to always be called after pathfinding and should be overridden to ensure proper disposal of resources. Users can rely on the fact that this method will be invoked post pathfinding to do necessary clean-ups.