Package com.valhalla.sdk.api.pathing
Class LocalPath<T extends Locatable>
java.lang.Object
java.util.AbstractCollection<T>
java.util.AbstractList<T>
com.valhalla.sdk.api.pathing.AbstractPath<T>
com.valhalla.sdk.api.pathing.LocalPath<T>
- Type Parameters:
T- locatable node type
- All Implemented Interfaces:
Iterable<T>,Collection<T>,List<T>,SequencedCollection<T>
Ordered local path that selects the furthest loaded same-plane node near the player.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault maximum direct distance of a selected node from the player.Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclosest()Finds the node closest to the local player.Finds the same-plane node nearest to an origin by squared X/Y distance.Returns the furthest eligible default-distance node.Returns the last path used bywalk().booleanTests whether the exact traversal endpoint has been reached.booleanisFinished(int radius) Tests same-plane proximity to the endpoint in the current traversal direction.next()Selects the next default-distance node.next(int maximumDistance) Selects the next node relative to the local player.Deterministic node selection form useful for route planning and testing.booleanwalk()Advances with the default four-tile handoff threshold.booleanwalk(int advanceDistance) Walks the next loaded segment without replacing a healthy destination.Methods inherited from class com.valhalla.sdk.api.pathing.AbstractPath
add, addAll, addToFront, direction, first, get, last, path, remove, reverse, set, setDirection, sizeMethods inherited from class java.util.AbstractList
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addAll, addFirst, addLast, contains, containsAll, getFirst, getLast, isEmpty, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, toArray, toArray
-
Field Details
-
DEFAULT_STEP_DISTANCE
public static final int DEFAULT_STEP_DISTANCEDefault maximum direct distance of a selected node from the player.- See Also:
-
-
Constructor Details
-
LocalPath
public LocalPath()Creates an empty forward local path. -
LocalPath
Creates a local path from a collection.- Parameters:
nodes- initial ordered nodes;nullcreates an empty path
-
LocalPath
Creates a local path from ordered varargs nodes.- Parameters:
nodes- initial nodes
-
-
Method Details
-
closest
Finds the node closest to the local player.- Returns:
- same-plane node nearest to the local player, or
null
-
closest
Finds the same-plane node nearest to an origin by squared X/Y distance.- Parameters:
origin- comparison origin- Returns:
- nearest node, or
nullfor null origin, empty path, or no same-plane node
-
next
Selects the next default-distance node.- Specified by:
nextin classAbstractPath<T extends Locatable>- Returns:
- next node within
DEFAULT_STEP_DISTANCE, ornull
-
next
Selects the next node relative to the local player.- Parameters:
maximumDistance- positive same-plane direct-distance limit- Returns:
- furthest eligible node in the traversal direction, or
null
-
next
Deterministic node selection form useful for route planning and testing.- Parameters:
origin- explicit comparison originmaximumDistance- positive same-plane direct-distance limit- Returns:
- furthest eligible node in the traversal direction, or
null
-
getFurthestOnMap
Returns the furthest eligible default-distance node.- Returns:
- next default-distance node, or
null; alias fornext()
-
walk
public boolean walk()Advances with the default four-tile handoff threshold.- Specified by:
walkin classAbstractPath<T extends Locatable>- Returns:
truewhen movement is healthy or a native walk was accepted
-
walk
public boolean walk(int advanceDistance) Walks the next loaded segment without replacing a healthy destination. A new segment is queued only when idle or when the current destination is withinadvanceDistancetiles, producing continuous movement across longer paths.- Parameters:
advanceDistance- non-negative remaining-distance handoff threshold- Returns:
truewhen movement remains healthy or a new destination was accepted
-
isFinished
public boolean isFinished()Tests whether the exact traversal endpoint has been reached.- Returns:
- whether the traversal endpoint is the player's exact tile
-
isFinished
public boolean isFinished(int radius) Tests same-plane proximity to the endpoint in the current traversal direction.- Parameters:
radius- inclusive non-negative Chebyshev radius- Returns:
truewhen an endpoint exists and the player is within its radius
-
getLastWalkedPath
Returns the last path used bywalk().- Returns:
- most recent local path whose walking remained healthy or dispatched successfully
-