Class ReachabilityMap

java.lang.Object
com.valhalla.sdk.api.pathing.ReachabilityMap

public final class ReachabilityMap extends Object
A single-pass breadth-first map of every tile reachable from one local origin.
  • Method Details

    • build

      public static ReachabilityMap build(CollisionMap collision, Tile origin)
      Builds a breadth-first reachability snapshot from one origin.
      Parameters:
      collision - collision snapshot
      origin - represented, walkable origin tile
      Returns:
      reachability map; all tiles are unreachable if the origin is invalid
    • getOrigin

      public Tile getOrigin()
      Returns the origin used to build this map.
      Returns:
      the origin used to build this map
    • canReach

      public boolean canReach(Tile tile)
      Tests whether a tile was reached by the breadth-first search.
      Parameters:
      tile - tile to test
      Returns:
      true when reachable
    • getDistance

      public int getDistance(Tile tile)
      Reads shortest transition distance from the origin.
      Parameters:
      tile - destination tile
      Returns:
      transition count, or Integer.MAX_VALUE when unreachable
    • pathTo

      public List<Tile> pathTo(Tile destination)
      Reconstructs the shortest path from the origin.
      Parameters:
      destination - destination tile
      Returns:
      immutable inclusive path, or an empty list when unreachable