Package net.storm.api.movement
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:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionTilePath(boolean incomplete) Constructs a TilePath with only the incomplete flag.TilePath(Collection<net.runelite.api.coords.WorldPoint> worldPoints, boolean incomplete) Constructs a TilePath from a collection of world points.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. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTeleport(Teleport teleport) Adds a teleport to this path's list of available teleports.voidaddTransport(Transport transport) Adds a transport to this path's list of available transports.voidaddVisitedTile(net.runelite.api.coords.WorldPoint point) Records a tile as visited during pathfinding.intCompares this path to another path based on weight.static TilePathempty()Creates an empty, incomplete TilePath.booleanCompares this path to another object for equality.net.runelite.api.coords.WorldPointGets the destination point of this path.net.runelite.api.coords.WorldAreaGets the destination as a WorldArea.Gets the remaining portion of the path from the player's current position.inthashCode()static TilePathof(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.subList(int fromIndex, int toIndex) Returns a view of the portion of this path between the specified indices.voidwalk()Walks along this path using default walk options.voidwalk(boolean useTransports) Walks along this path with the specified transport usage setting.voidwalk(WalkOptions options) Walks along this path using the specified walk options.Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, forEach, get, getFirst, getLast, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll, reversed
-
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 pathdestination- the target destination areaweight- the calculated weight/cost of this pathincomplete- 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
Constructs a TilePath from a collection of world points.- Parameters:
worldPoints- the collection of points forming the pathincomplete- true if the path does not reach its destination
-
-
Method Details
-
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 pathdestination- the target destination areaincomplete- 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
Adds a teleport to this path's list of available teleports.- Parameters:
teleport- the teleport to add
-
addTransport
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 callingwalk(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
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
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
Returns a view of the portion of this path between the specified indices.- Specified by:
subListin interfaceList<net.runelite.api.coords.WorldPoint>- Overrides:
subListin classArrayList<net.runelite.api.coords.WorldPoint>- Parameters:
fromIndex- low endpoint (inclusive) of the subListtoIndex- high endpoint (exclusive) of the subList- Returns:
- a new TilePath containing the specified range of elements
-
equals
Compares this path to another object for equality. Two paths are equal if they have the same incomplete status.- Specified by:
equalsin interfaceCollection<net.runelite.api.coords.WorldPoint>- Specified by:
equalsin interfaceList<net.runelite.api.coords.WorldPoint>- Overrides:
equalsin classArrayList<net.runelite.api.coords.WorldPoint>- Parameters:
o- the object to compare with- Returns:
- true if the paths are equal
-
hashCode
public int hashCode() -
compareTo
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:
compareToin interfaceComparable<TilePath>- Parameters:
other- the other path to compare with- Returns:
- negative if this path has lower weight, positive if higher, zero if equal
-