TileObjectQuery
A query to find TileObjectEx's in the game world.
ClassRLPlugins API
public class TileObjectQuery extends AbstractQuery<TileObjectEx, TileObjectQuery>Members
Constructors
- newTileObjectQuery()
Creates a new TileObjectQuery that queries all TileObjectEx's in the game world.
Methods
- TileObjectQueryatLocation(WorldPoint)
Filters the query to only include objects at the specified location.
- TileObjectExfarthest()
Get the farthest object from the filtered list Terminal operation - executes the query.
- TileObjectExfarthest(WorldPoint)
Get the farthest object from a specific point Terminal operation - executes the query.
- TileObjectQueryfromWorldView()
From world view.
- TileObjectQueryisReachable()
Filters the query to only include objects that have interactable tiles that are reachable by the player.
- TileObjectExlongestPath()
Get the object with the longest path from the filtered list Terminal operation - executes the query.
- TileObjectExnearest()
Get the nearest object from the filtered list Terminal operation - executes the query.
- TileObjectExnearest(WorldPoint)
Get the nearest object to a specific point Terminal operation - executes the query.
- TileObjectExshortestPath()
Get the object with the shortest path from the filtered list Terminal operation - executes the query.
- TileObjectQuerysortFurthest()
Sorts the query results by distance from the local player, furthest first.
- TileObjectQuerysortFurthest(WorldPoint)
Sorts the query results by distance from the specified center point, furthest first.
- TileObjectQuerysortGreedyShortestPath()
Sorts the query results using a greedy nearest-neighbor approach based on shortest path.
- TileObjectQuerysortGreedyShortestPath(WorldPoint)
Sorts the query results using a greedy nearest-neighbor approach based on shortest path.
- TileObjectQuerysortLongestPath()
Sort by longest path from the player.
- TileObjectQuerysortLongestPath(WorldPoint)
Sort by longest path from a specific point.
- TileObjectQuerysortNearest()
Sorts the query results by distance from the local player, nearest first.
- TileObjectQuerysortNearest(WorldPoint)
Sorts the query results by distance from the specified center point, nearest first.
- TileObjectQuerysortShortestPath()
Sort by shortest path from the player.
- TileObjectQuerysortShortestPath(WorldPoint)
Sort by shortest path from a specific point.
- TileObjectQuerywithAction(String)
Filters the query to only include objects with the specified action.
- TileObjectQuerywithActionVisible(String)
Filters the query to only include objects that have the specified action visible.
- TileObjectQuerywithAnyOfActions(String...)
Filters the query to only include objects with any of the specified actions.
- TileObjectQuerywithId(int...)
Filters the query to only include objects with the specified IDs.
- TileObjectQuerywithin(int)
Filters the query to only include objects within the specified distance from the local player.
- TileObjectQuerywithin(WorldPoint, int)
Filters the query to only include objects within the specified distance from the specified center point.
- TileObjectQuerywithName(String)
Filters the query to only include objects with the specified name.
- TileObjectQuerywithNameContains(String)
Filters the query to only include objects with names that contain the specified string.
- TileObjectQuerywithNameMatches(String)
Filters the query to only include objects with names that match the specified wildcard pattern.
- TileObjectQuerywithNames(String...)
Filters the query to only include objects with the specified names.
- TileObjectQuerywithNamesContains(String...)
Filters the query to only include objects with names that contain any of the specified strings.
- TileObjectQuerywithOpVisible(int)
Filters the query to only include objects that have the specified op visible.
- TileObjectQuerywithPartialAction(String)
Filters the query to only include objects with actions that contain the specified string.
Inherited from AbstractQuery
- Raggregate(Function<Stream<TileObjectEx>, R>)
Generic aggregation method for custom terminal operations Executes filters and allows custom stream processing.
- booleanall(Predicate<TileObjectEx>)
Check if all filtered results match the predicate.
- booleanany(Predicate<TileObjectEx>)
Check if any filtered result matches the predicate.
- List<TileObjectEx>collect()
Get the filtered/sorted list.
- Rcollect(Collector<TileObjectEx, ?, R>)
Execute filters and process with custom collector.
- intcount()
Get count of filtered results.
- TileObjectQuerydistinct()
Ensure results are distinct.
- TileObjectExfirst()
Get the first element from the filtered/sorted list.
- voidfirstIfPresent(Consumer<TileObjectEx>)
First if present.
- voidfirstOrElse(Consumer<TileObjectEx>, Runnable)
Perform action on the first element, or else run elseAction if no results.
- voidforEach(Consumer<TileObjectEx>)
Executes filters and performs an action on each result.
- booleanisEmpty()
Check if there are no filtered results.
- TileObjectQuerykeepIf(Predicate<TileObjectEx>)
Lazily filter by predicate (keeps matching items).
- TileObjectExlast()
Get the last element from the filtered/sorted list.
- voidlastOrElse(Consumer<TileObjectEx>, Runnable)
Perform action on the last element, or else run elseAction if no results.
- TileObjectQuerylimit(int)
Limit the number of results.
- booleannone(Predicate<TileObjectEx>)
Check if no filtered results match the predicate.
- TileObjectQuerypeek(Consumer<TileObjectEx>)
Peek at each element during processing.
- TileObjectQuerypostProcess(Function<List<TileObjectEx>, List<TileObjectEx>>)
Apply a post-processing function after sorting.
- TileObjectExrandom()
Get a random element from the filtered/sorted list.
- TileObjectQueryremoveIf(Predicate<TileObjectEx>)
Lazily filter by predicate (removes matching items).
- TileObjectQueryskip(int)
Skip a number of results.
- TileObjectQuerysort(Comparator<TileObjectEx>)
Lazily add sorting.
TileObjectQuery()
public TileObjectQuery()Creates a new TileObjectQuery that queries all TileObjectEx's in the game world.
atLocation(WorldPoint)
public TileObjectQuery atLocation(WorldPoint location)Filters the query to only include objects at the specified location.
Parameters
location- The location to filter by.
Returns
TileObjectQuery.
farthest()
public TileObjectEx farthest()Get the farthest object from the filtered list Terminal operation - executes the query.
farthest(WorldPoint)
public TileObjectEx farthest(WorldPoint center)Get the farthest object from a specific point Terminal operation - executes the query.
Parameters
center- Center.
fromWorldView()
public TileObjectQuery fromWorldView()From world view.
isReachable()
public TileObjectQuery isReachable()Filters the query to only include objects that have interactable tiles that are reachable by the player.
Returns
TileObjectQuery.
longestPath()
public TileObjectEx longestPath()Get the object with the longest path from the filtered list Terminal operation - executes the query.
nearest()
public TileObjectEx nearest()Get the nearest object from the filtered list Terminal operation - executes the query.
nearest(WorldPoint)
public TileObjectEx nearest(WorldPoint center)Get the nearest object to a specific point Terminal operation - executes the query.
Parameters
center- Center.
shortestPath()
public TileObjectEx shortestPath()Get the object with the shortest path from the filtered list Terminal operation - executes the query.
sortFurthest()
public TileObjectQuery sortFurthest()Sorts the query results by distance from the local player, furthest first.
Returns
TileObjectQuery.
sortFurthest(WorldPoint)
public TileObjectQuery sortFurthest(WorldPoint center)Sorts the query results by distance from the specified center point, furthest first.
Parameters
center- The center point to measure distance from.
Returns
TileObjectQuery.
sortGreedyShortestPath()
public TileObjectQuery sortGreedyShortestPath()Sorts the query results using a greedy nearest-neighbor approach based on shortest path.
Starting from the local player, selects the object with the shortest path, then from that object's interaction point selects the next shortest path, and so on. In case of path length ties, uses Chebyshev distance as a tiebreaker.
Returns
TileObjectQuery.
sortGreedyShortestPath(WorldPoint)
public TileObjectQuery sortGreedyShortestPath(WorldPoint start)Sorts the query results using a greedy nearest-neighbor approach based on shortest path.
Parameters
start- The starting point for the greedy traversal.
Returns
TileObjectQuery.
sortLongestPath()
public TileObjectQuery sortLongestPath()Sort by longest path from the player.
Returns
TileObjectQuery.
sortLongestPath(WorldPoint)
public TileObjectQuery sortLongestPath(WorldPoint center)Sort by longest path from a specific point.
Parameters
center- Center point.
Returns
TileObjectQuery.
sortNearest()
public TileObjectQuery sortNearest()Sorts the query results by distance from the local player, nearest first.
Returns
TileObjectQuery.
sortNearest(WorldPoint)
public TileObjectQuery sortNearest(WorldPoint center)Sorts the query results by distance from the specified center point, nearest first.
Parameters
center- The center point to measure distance from.
Returns
TileObjectQuery.
sortShortestPath()
public TileObjectQuery sortShortestPath()Sort by shortest path from the player.
Returns
TileObjectQuery.
sortShortestPath(WorldPoint)
public TileObjectQuery sortShortestPath(WorldPoint center)Sort by shortest path from a specific point.
Parameters
center- Center point.
Returns
TileObjectQuery.
withAction(String)
public TileObjectQuery withAction(String action)Filters the query to only include objects with the specified action.
Parameters
action- The action to filter by.
Returns
TileObjectQuery.
withActionVisible(String)
public TileObjectQuery withActionVisible(String action)Filters the query to only include objects that have the specified action visible.
Parameters
action- The action to filter by.
Returns
TileObjectQuery.
withAnyOfActions(String...)
public TileObjectQuery withAnyOfActions(String... actions)Filters the query to only include objects with any of the specified actions.
Parameters
actions- The actions to filter by.
Returns
TileObjectQuery.
withId(int...)
public TileObjectQuery withId(int... id)Filters the query to only include objects with the specified IDs.
Parameters
id- The IDs to filter by.
Returns
TileObjectQuery.
within(int)
public TileObjectQuery within(int distance)Filters the query to only include objects within the specified distance from the local player.
Parameters
distance- The distance to filter by.
Returns
TileObjectQuery.
within(WorldPoint, int)
public TileObjectQuery within(WorldPoint center, int distance)Filters the query to only include objects within the specified distance from the specified center point.
Parameters
center- The center point to measure distance from.
distance- The distance to filter by.
Returns
TileObjectQuery.
withName(String)
public TileObjectQuery withName(String name)Filters the query to only include objects with the specified name.
Parameters
name- The name to filter by.
Returns
TileObjectQuery.
withNameContains(String)
public TileObjectQuery withNameContains(String name)Filters the query to only include objects with names that contain the specified string.
Parameters
name- The string to filter by.
Returns
TileObjectQuery.
withNameMatches(String)
public TileObjectQuery withNameMatches(String namePart)Filters the query to only include objects with names that match the specified wildcard pattern.
Parameters
namePart- The wildcard pattern to filter by.
Returns
TileObjectQuery.
withNames(String...)
public TileObjectQuery withNames(String... names)Filters the query to only include objects with the specified names.
Parameters
names- The names to filter by.
Returns
TileObjectQuery.
withNamesContains(String...)
public TileObjectQuery withNamesContains(String... names)Filters the query to only include objects with names that contain any of the specified strings.
Parameters
names- The strings to filter by.
Returns
TileObjectQuery.
withOpVisible(int)
public TileObjectQuery withOpVisible(int op)Filters the query to only include objects that have the specified op visible.
Parameters
op- The op index to filter by.
Returns
TileObjectQuery.
withPartialAction(String)
public TileObjectQuery withPartialAction(String partial)Filters the query to only include objects with actions that contain the specified string.
Parameters
partial- The string to filter by.
Returns
TileObjectQuery.
aggregate(Function<Stream<TileObjectEx>, R>)from AbstractQuery
public R aggregate(Function<Stream<TileObjectEx>, R> aggregator)Generic aggregation method for custom terminal operations Executes filters and allows custom stream processing.
Parameters
aggregator- Aggregator.
all(Predicate<TileObjectEx>)from AbstractQuery
public boolean all(Predicate<TileObjectEx> predicate)Check if all filtered results match the predicate.
Parameters
predicate- Predicate to test.
Returns
True if all match, false otherwise.
any(Predicate<TileObjectEx>)from AbstractQuery
public boolean any(Predicate<TileObjectEx> predicate)Check if any filtered result matches the predicate.
Parameters
predicate- Predicate to test.
Returns
True if any match, false otherwise.
collect()from AbstractQuery
public List<TileObjectEx> collect()Get the filtered/sorted list.
collect(Collector<TileObjectEx, ?, R>)from AbstractQuery
public R collect(Collector<TileObjectEx, ?, R> collector)Execute filters and process with custom collector.
Parameters
collector- Collector.
count()from AbstractQuery
public int count()Get count of filtered results.
distinct()from AbstractQuery
public TileObjectQuery distinct()Ensure results are distinct.
Returns
The query instance.
first()from AbstractQuery
public TileObjectEx first()Get the first element from the filtered/sorted list.
firstIfPresent(Consumer<TileObjectEx>)from AbstractQuery
public void firstIfPresent(Consumer<TileObjectEx> action)First if present.
Parameters
action- Action.
firstOrElse(Consumer<TileObjectEx>, Runnable)from AbstractQuery
public void firstOrElse(Consumer<TileObjectEx> action, Runnable elseAction)Perform action on the first element, or else run elseAction if no results.
Parameters
action- Action to perform on the first element.
elseAction- Action to perform if no results.
forEach(Consumer<TileObjectEx>)from AbstractQuery
public void forEach(Consumer<TileObjectEx> action)Executes filters and performs an action on each result.
Parameters
action- Action.
isEmpty()from AbstractQuery
public boolean isEmpty()Check if there are no filtered results.
Returns
True if no results after filtering, false otherwise.
keepIf(Predicate<TileObjectEx>)from AbstractQuery
public TileObjectQuery keepIf(Predicate<TileObjectEx> predicate)Lazily filter by predicate (keeps matching items).
Parameters
predicate- Predicate.
Returns
The query instance.
last()from AbstractQuery
public TileObjectEx last()Get the last element from the filtered/sorted list.
lastOrElse(Consumer<TileObjectEx>, Runnable)from AbstractQuery
public void lastOrElse(Consumer<TileObjectEx> action, Runnable elseAction)Perform action on the last element, or else run elseAction if no results.
Parameters
action- Action to perform on the last element.
elseAction- Action to perform if no results.
limit(int)from AbstractQuery
public TileObjectQuery limit(int maxSize)Limit the number of results.
Parameters
maxSize- Max size.
Returns
The query instance.
none(Predicate<TileObjectEx>)from AbstractQuery
public boolean none(Predicate<TileObjectEx> predicate)Check if no filtered results match the predicate.
Parameters
predicate- Predicate to test.
Returns
True if none match, false otherwise.
peek(Consumer<TileObjectEx>)from AbstractQuery
public TileObjectQuery peek(Consumer<TileObjectEx> action)Peek at each element during processing.
Parameters
action- Action to perform on each element.
Returns
The query instance.
postProcess(Function<List<TileObjectEx>, List<TileObjectEx>>)from AbstractQuery
public TileObjectQuery postProcess(Function<List<TileObjectEx>, List<TileObjectEx>> processor)Apply a post-processing function after sorting.
Useful for reordering algorithms that can't be expressed as Comparators.
Parameters
processor- Function to transform the result list.
Returns
The query instance.
random()from AbstractQuery
public TileObjectEx random()Get a random element from the filtered/sorted list.
removeIf(Predicate<TileObjectEx>)from AbstractQuery
public TileObjectQuery removeIf(Predicate<TileObjectEx> predicate)Lazily filter by predicate (removes matching items).
Parameters
predicate- Predicate.
Returns
The query instance.
skip(int)from AbstractQuery
public TileObjectQuery skip(int count)Skip a number of results.
Parameters
count- Count.
Returns
The query instance.
sort(Comparator<TileObjectEx>)from AbstractQuery
public TileObjectQuery sort(Comparator<TileObjectEx> comparator)Lazily add sorting.
Parameters
comparator- Comparator.
Returns
The query instance.
Also allowed
Every class has these, as in plain Java.
equals, toString