Class TilePath

java.lang.Object
java.util.AbstractCollection<net.runelite.api.coords.WorldPoint>
java.util.AbstractList<net.runelite.api.coords.WorldPoint>
java.util.ArrayList<net.runelite.api.coords.WorldPoint>
net.storm.api.movement.TilePath
All Implemented Interfaces:
Serializable, Cloneable, Comparable<TilePath>, Iterable<net.runelite.api.coords.WorldPoint>, Collection<net.runelite.api.coords.WorldPoint>, List<net.runelite.api.coords.WorldPoint>, RandomAccess, SequencedCollection<net.runelite.api.coords.WorldPoint>

public final class TilePath extends ArrayList<net.runelite.api.coords.WorldPoint> implements Comparable<TilePath>
Represents a calculated path of tiles from a starting point to a destination.

TilePath is a fundamental component of the Storm pathfinding system. It extends ArrayList to provide an ordered sequence of WorldPoint tiles that form a walkable path. The path can include associated teleports and transports that were used or can be used during navigation.

Key Features

  • Stores the sequence of tiles to walk along
  • Tracks teleports and transports used in the path
  • Records visited tiles during pathfinding
  • Supports path weight for comparison and optimization
  • Indicates whether the path is complete or incomplete

Usage Example


 // Get a path to a destination
 TilePath path = Static.getMovement().getPath(destination);

 // Walk the path
 path.walk();

 // Or walk with custom options
 path.walk(WalkOptions.builder()
     .useTransports(true)
     .useTeleports(true)
     .build());

 // Get remaining path from current position
 TilePath remaining = path.getRemainingPath();
 

Path Comparison

Paths can be compared by their weight using Comparable. Lower weight paths are considered "better" as they typically represent shorter or more efficient routes.

See Also:
  • Constructor Details

    • TilePath

      public TilePath(List<net.runelite.api.coords.WorldPoint> points, net.runelite.api.coords.WorldArea destination, double weight, boolean incomplete)
      Constructs a new TilePath with all parameters specified.
      Parameters:
      points - the ordered list of world points forming the path
      destination - the target destination area
      weight - the calculated weight/cost of this path
      incomplete - true if the path does not reach the destination
    • TilePath

      public TilePath(boolean incomplete)
      Constructs a TilePath with only the incomplete flag. Creates an empty path with no destination or weight.
      Parameters:
      incomplete - true if this represents an incomplete/failed path
    • TilePath

      public TilePath(Collection<net.runelite.api.coords.WorldPoint> worldPoints, boolean incomplete)
      Constructs a TilePath from a collection of world points.
      Parameters:
      worldPoints - the collection of points forming the path
      incomplete - true if the path does not reach its destination
  • Method Details

    • empty

      public static TilePath empty()
      Creates an empty, incomplete TilePath. Use this when pathfinding fails to find any valid route.
      Returns:
      an empty TilePath marked as incomplete
    • of

      public static TilePath of(Collection<net.runelite.api.coords.WorldPoint> points, net.runelite.api.coords.WorldArea destination, boolean incomplete)
      Creates a TilePath from a collection of points with a specified destination.
      Parameters:
      points - the collection of points forming the path
      destination - the target destination area
      incomplete - true if the path does not reach the destination
      Returns:
      a new TilePath with the specified parameters
    • getDestination

      public net.runelite.api.coords.WorldPoint getDestination()
      Gets the destination point of this path. Returns the center of the destination area if set, otherwise returns the last point in the path.
      Returns:
      the destination WorldPoint, or null if the path is empty and has no destination
    • getDestinationArea

      public net.runelite.api.coords.WorldArea getDestinationArea()
      Gets the destination as a WorldArea. Returns the destination area if set, otherwise converts the last point to an area.
      Returns:
      the destination WorldArea, or null if the path is empty and has no destination
    • addTeleport

      public void addTeleport(Teleport teleport)
      Adds a teleport to this path's list of available teleports.
      Parameters:
      teleport - the teleport to add
    • addTransport

      public void addTransport(Transport transport)
      Adds a transport to this path's list of available transports.
      Parameters:
      transport - the transport to add
    • addVisitedTile

      public void addVisitedTile(net.runelite.api.coords.WorldPoint point)
      Records a tile as visited during pathfinding.
      Parameters:
      point - the world point that was visited
    • walk

      public void walk()
      Walks along this path using default walk options. This is a convenience method equivalent to calling walk(WalkOptions.builder().build()).
    • walk

      public void walk(boolean useTransports)
      Walks along this path with the specified transport usage setting.
      Parameters:
      useTransports - true to use transports (shortcuts, boats, etc.) along the path
    • walk

      public void walk(WalkOptions options)
      Walks along this path using the specified walk options. This method delegates to the walker implementation to handle the actual movement.
      Parameters:
      options - the walk options controlling movement behavior
    • getRemainingPath

      public TilePath getRemainingPath()
      Gets the remaining portion of the path from the player's current position.

      This method finds the closest point on the path to the player and returns a new TilePath containing only the remaining tiles from that point to the destination. This is useful for resuming navigation after interruptions or checking progress.

      Returns:
      a new TilePath containing the remaining tiles, or an empty path if the destination is null or no close point is found
    • subList

      public TilePath subList(int fromIndex, int toIndex)
      Returns a view of the portion of this path between the specified indices.
      Specified by:
      subList in interface List<net.runelite.api.coords.WorldPoint>
      Overrides:
      subList in class ArrayList<net.runelite.api.coords.WorldPoint>
      Parameters:
      fromIndex - low endpoint (inclusive) of the subList
      toIndex - high endpoint (exclusive) of the subList
      Returns:
      a new TilePath containing the specified range of elements
    • equals

      public boolean equals(Object o)
      Compares this path to another object for equality. Two paths are equal if they have the same incomplete status.
      Specified by:
      equals in interface Collection<net.runelite.api.coords.WorldPoint>
      Specified by:
      equals in interface List<net.runelite.api.coords.WorldPoint>
      Overrides:
      equals in class ArrayList<net.runelite.api.coords.WorldPoint>
      Parameters:
      o - the object to compare with
      Returns:
      true if the paths are equal
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Collection<net.runelite.api.coords.WorldPoint>
      Specified by:
      hashCode in interface List<net.runelite.api.coords.WorldPoint>
      Overrides:
      hashCode in class ArrayList<net.runelite.api.coords.WorldPoint>
    • compareTo

      public int compareTo(TilePath other)
      Compares this path to another path based on weight. Lower weight paths are considered "less than" higher weight paths, making them preferable in sorted collections.
      Specified by:
      compareTo in interface Comparable<TilePath>
      Parameters:
      other - the other path to compare with
      Returns:
      negative if this path has lower weight, positive if higher, zero if equal