Package net.storm.api.query.results
Class SceneEntityQueryResults<T extends SceneEntity>
java.lang.Object
net.storm.api.query.results.QueryResults<T,SceneEntityQueryResults<T>>
net.storm.api.query.results.SceneEntityQueryResults<T>
- Type Parameters:
T- the type of scene entity contained in the results
- All Implemented Interfaces:
Iterable<T>,Collection<T>
public class SceneEntityQueryResults<T extends SceneEntity>
extends QueryResults<T,SceneEntityQueryResults<T>>
Result container for scene entity queries with distance-based operations.
This class extends QueryResults to provide scene entity-specific functionality,
particularly methods for sorting entities by distance and finding the nearest or
farthest entities from a reference point.
The class supports multiple distance calculation methods via the Distance enum:
Distance.DEFAULT- Standard tile-based distanceDistance.HYPOTENUSE- 3D Euclidean distance including planeDistance.HYPOTENUSE2D- 2D Euclidean distance ignoring plane
Example usage:
SceneEntityQueryResults<INPC> results = npcQuery.results();
INPC nearestNpc = results.nearest(player);
INPC farthestNpc = results.farthest(player);
SceneEntityQueryResults<INPC> sorted = results.sortedByDistance(player);
-
Field Summary
Fields inherited from class net.storm.api.query.results.QueryResults
results -
Constructor Summary
ConstructorsConstructorDescriptionSceneEntityQueryResults(List<T> results) Constructs a new SceneEntityQueryResults wrapper around the specified list of entities. -
Method Summary
Modifier and TypeMethodDescriptionfarthest(net.runelite.api.coords.WorldPoint to) Returns the entity farthest from the specified world point using the default distance method.Returns the entity farthest from the specified world point using the specified distance method.Returns the entity farthest from the specified locatable using the default distance method.Returns the entity farthest from the specified locatable using the specified distance method.nearest(net.runelite.api.coords.WorldPoint to) Returns the entity nearest to the specified world point using the default distance method.Returns the entity nearest to the specified world point using the specified distance method.Returns the entity nearest to the specified locatable using the default distance method.Returns the entity nearest to the specified locatable using the specified distance method.sortedByDistance(net.runelite.api.coords.WorldPoint to) Sorts the results by distance from a world point using the default distance method.sortedByDistance(net.runelite.api.coords.WorldPoint to, Distance distance) Sorts the results by distance from a world point using the specified distance method.Sorts the results by distance from a locatable entity using the default distance method.sortedByDistance(Locatable to, Distance distance) Sorts the results by distance from a locatable entity using the specified distance method.Methods inherited from class net.storm.api.query.results.QueryResults
accept, add, addAll, clear, contains, containsAll, first, get, indexOf, isEmpty, isNotEmpty, iterator, last, lastIndexOf, limit, limit, list, random, remove, removeAll, retainAll, reversed, shuffled, size, sorted, toArray, toArrayMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
SceneEntityQueryResults
Constructs a new SceneEntityQueryResults wrapper around the specified list of entities.- Parameters:
results- the list of scene entities to wrap
-
-
Method Details
-
sortedByDistance
public SceneEntityQueryResults<T> sortedByDistance(net.runelite.api.coords.WorldPoint to, Distance distance) Sorts the results by distance from a world point using the specified distance method.Entities are sorted in ascending order (nearest first).
- Parameters:
to- the reference world point to calculate distances fromdistance- the distance calculation method to use- Returns:
- this result instance for method chaining
-
sortedByDistance
Sorts the results by distance from a world point using the default distance method.Entities are sorted in ascending order (nearest first).
- Parameters:
to- the reference world point to calculate distances from- Returns:
- this result instance for method chaining
-
sortedByDistance
Sorts the results by distance from a locatable entity using the specified distance method.Entities are sorted in ascending order (nearest first).
- Parameters:
to- the reference locatable entity to calculate distances fromdistance- the distance calculation method to use- Returns:
- this result instance for method chaining
-
sortedByDistance
Sorts the results by distance from a locatable entity using the default distance method.Entities are sorted in ascending order (nearest first).
- Parameters:
to- the reference locatable entity to calculate distances from- Returns:
- this result instance for method chaining
-
nearest
Returns the entity nearest to the specified locatable using the specified distance method.- Parameters:
to- the reference locatable entity to calculate distances fromdistance- the distance calculation method to use- Returns:
- the nearest entity, or
nullif the results are empty
-
nearest
Returns the entity nearest to the specified world point using the default distance method.- Parameters:
to- the reference world point to calculate distances from- Returns:
- the nearest entity, or
nullif the results are empty
-
nearest
Returns the entity nearest to the specified world point using the specified distance method.- Parameters:
to- the reference world point to calculate distances fromdistance- the distance calculation method to use- Returns:
- the nearest entity, or
nullif the results are empty
-
nearest
Returns the entity nearest to the specified locatable using the default distance method.- Parameters:
locatable- the reference locatable entity to calculate distances from- Returns:
- the nearest entity, or
nullif the results are empty
-
farthest
Returns the entity farthest from the specified locatable using the specified distance method.- Parameters:
locatable- the reference locatable entity to calculate distances fromdistance- the distance calculation method to use- Returns:
- the farthest entity, or
nullif the results are empty
-
farthest
Returns the entity farthest from the specified locatable using the default distance method.- Parameters:
locatable- the reference locatable entity to calculate distances from- Returns:
- the farthest entity, or
nullif the results are empty
-
farthest
Returns the entity farthest from the specified world point using the specified distance method.- Parameters:
to- the reference world point to calculate distances fromdistance- the distance calculation method to use- Returns:
- the farthest entity, or
nullif the results are empty
-
farthest
Returns the entity farthest from the specified world point using the default distance method.- Parameters:
to- the reference world point to calculate distances from- Returns:
- the farthest entity, or
nullif the results are empty
-