Class LocalPathfinder


  • @Singleton
    public class LocalPathfinder
    extends java.lang.Object
    BFS pathfinder over the active scene's collision flags. Scope: LOCAL SCENE ONLY (the ~104x104 tile world view around the player). Global/world travel is a separate concern (teleports + P10c path server). Collision model (net.runelite.api.CollisionDataFlag): - Each tile's flags block movement TOWARD a direction from that tile (e.g. BLOCK_MOVEMENT_NORTH means you cannot step north FROM this tile). - Moving north from A to B requires: !(A & NORTH) && !(B & SOUTH) plus neither tile being fully blocked (OBJECT/FLOOR). - Diagonals require both adjacent cardinals to be open as well.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  LocalPathfinder.Route
      A computed route: start tile excluded, destination included.
      static class  LocalPathfinder.Step
      One hop in a route.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Long nearestReachable​(int fromX, int fromY, int toX, int toY, int plane)
      Nearest reachable scene tile to an arbitrary target (may itself be blocked).
      java.util.List<java.lang.Long> reachableSet​(int fromX, int fromY, int plane)
      Flood-fill every tile reachable from the start (bounded by scene size).
      LocalPathfinder.Route route​(int fromX, int fromY, int toX, int toY, int plane)
      Find the shortest walking route between two scene-local points on one plane.
      LocalPathfinder.Route route​(net.runelite.api.coords.WorldPoint from, net.runelite.api.coords.WorldPoint to)
      Convenience: route between two world points if both are in the active scene.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LocalPathfinder

        @Inject
        public LocalPathfinder​(SceneService scenes)
    • Method Detail

      • route

        public LocalPathfinder.Route route​(int fromX,
                                           int fromY,
                                           int toX,
                                           int toY,
                                           int plane)
        Find the shortest walking route between two scene-local points on one plane.
        Parameters:
        fromX - scene x of start (0..103 within the current world view)
        fromY - scene y of start
        toX - scene x of target
        toY - scene y of target
        plane - plane to search
        Returns:
        route with steps excluding the start tile, or null when unreachable
      • route

        public LocalPathfinder.Route route​(net.runelite.api.coords.WorldPoint from,
                                           net.runelite.api.coords.WorldPoint to)
        Convenience: route between two world points if both are in the active scene.
      • reachableSet

        public java.util.List<java.lang.Long> reachableSet​(int fromX,
                                                           int fromY,
                                                           int plane)
        Flood-fill every tile reachable from the start (bounded by scene size).
        Returns:
        list of reachable scene coordinates as long-packed x|y values.
      • nearestReachable

        public java.lang.Long nearestReachable​(int fromX,
                                               int fromY,
                                               int toX,
                                               int toY,
                                               int plane)
        Nearest reachable scene tile to an arbitrary target (may itself be blocked).
        Returns:
        scene coords packed as (long)x<<32 | y, or null when nothing reachable.