LocationQuery
A query class for filtering and manipulating Tile locations in the game world.
ClassRLPlugins API
public class LocationQuery extends AbstractQuery<Tile, LocationQuery>Members
Constructors
- newLocationQuery()
Constructs a new LocationQuery instance, initializing it with all tiles from the game manager.
Methods
- LocationQuerybeyondDistance(int)
Filters the query to exclude tiles within a specified distance from the player.
- LocationQuerybeyondPathingDistance(int)
Filters the query to exclude tiles that are within a specified pathing distance from the player.
- LocationQueryhasLosTo()
Filters the query to only include tiles that have a line of sight to the player's current position.
- LocationQueryhasTileObject()
Filters the query to only include tiles that contain any tile objects (decorative, game, ground, or wall).
- LocationQueryisReachable()
Filters the query to only include tiles that are reachable from the player's current position.
- LocationQueryoutsideArea(WorldArea)
Filters the query to exclude tiles within a specified WorldArea.
- List<LocalPoint>toLocalPointList()
Converts the collected tiles to a list of LocalPoint locations.
- List<WorldPoint>toWorldPointList()
Converts the collected tiles to a list of WorldPoint locations.
- LocationQuerywithinArea(WorldArea)
Filters the query to only include tiles within a specified WorldArea.
- LocationQuerywithinDistance(int)
Filters the query to only include tiles within a specified distance from the player.
- LocationQuerywithinPathingDistance(int)
Filters the query to only include tiles that are within a specified pathing distance from the player.
Inherited from AbstractQuery
- Raggregate(Function<Stream<Tile>, R>)
Generic aggregation method for custom terminal operations Executes filters and allows custom stream processing.
- booleanall(Predicate<Tile>)
Check if all filtered results match the predicate.
- booleanany(Predicate<Tile>)
Check if any filtered result matches the predicate.
- List<Tile>collect()
Get the filtered/sorted list.
- Rcollect(Collector<Tile, ?, R>)
Execute filters and process with custom collector.
- intcount()
Get count of filtered results.
- LocationQuerydistinct()
Ensure results are distinct.
- Tilefirst()
Get the first element from the filtered/sorted list.
- voidfirstIfPresent(Consumer<Tile>)
First if present.
- voidfirstOrElse(Consumer<Tile>, Runnable)
Perform action on the first element, or else run elseAction if no results.
- voidforEach(Consumer<Tile>)
Executes filters and performs an action on each result.
- booleanisEmpty()
Check if there are no filtered results.
- LocationQuerykeepIf(Predicate<Tile>)
Lazily filter by predicate (keeps matching items).
- Tilelast()
Get the last element from the filtered/sorted list.
- voidlastOrElse(Consumer<Tile>, Runnable)
Perform action on the last element, or else run elseAction if no results.
- LocationQuerylimit(int)
Limit the number of results.
- booleannone(Predicate<Tile>)
Check if no filtered results match the predicate.
- LocationQuerypeek(Consumer<Tile>)
Peek at each element during processing.
- LocationQuerypostProcess(Function<List<Tile>, List<Tile>>)
Apply a post-processing function after sorting.
- Tilerandom()
Get a random element from the filtered/sorted list.
- LocationQueryremoveIf(Predicate<Tile>)
Lazily filter by predicate (removes matching items).
- LocationQueryskip(int)
Skip a number of results.
- LocationQuerysort(Comparator<Tile>)
Lazily add sorting.
LocationQuery()
public LocationQuery()Constructs a new LocationQuery instance, initializing it with all tiles from the game manager.
beyondDistance(int)
public LocationQuery beyondDistance(int distance)Filters the query to exclude tiles within a specified distance from the player.
Parameters
distance- The minimum distance from the player.
Returns
LocationQuery.
beyondPathingDistance(int)
public LocationQuery beyondPathingDistance(int distance)Filters the query to exclude tiles that are within a specified pathing distance from the player.
Parameters
distance- The minimum pathing distance from the player.
Returns
LocationQuery.
hasLosTo()
public LocationQuery hasLosTo()Filters the query to only include tiles that have a line of sight to the player's current position.
Returns
LocationQuery.
hasTileObject()
public LocationQuery hasTileObject()Filters the query to only include tiles that contain any tile objects (decorative, game, ground, or wall).
Returns
LocationQuery.
isReachable()
public LocationQuery isReachable()Filters the query to only include tiles that are reachable from the player's current position.
Returns
LocationQuery.
outsideArea(WorldArea)
public LocationQuery outsideArea(WorldArea area)Filters the query to exclude tiles within a specified WorldArea.
Parameters
area- The WorldArea to check against.
Returns
LocationQuery.
toLocalPointList()
public List<LocalPoint> toLocalPointList()Converts the collected tiles to a list of LocalPoint locations.
Returns
List of LocalPoint locations.
toWorldPointList()
public List<WorldPoint> toWorldPointList()Converts the collected tiles to a list of WorldPoint locations.
Returns
List of WorldPoint locations.
withinArea(WorldArea)
public LocationQuery withinArea(WorldArea area)Filters the query to only include tiles within a specified WorldArea.
Parameters
area- The WorldArea to check against.
Returns
LocationQuery.
withinDistance(int)
public LocationQuery withinDistance(int distance)Filters the query to only include tiles within a specified distance from the player.
Parameters
distance- The maximum distance from the player.
Returns
LocationQuery.
withinPathingDistance(int)
public LocationQuery withinPathingDistance(int distance)Filters the query to only include tiles that are within a specified pathing distance from the player.
Parameters
distance- The maximum pathing distance from the player.
Returns
LocationQuery.
aggregate(Function<Stream<Tile>, R>)from AbstractQuery
public R aggregate(Function<Stream<Tile>, R> aggregator)Generic aggregation method for custom terminal operations Executes filters and allows custom stream processing.
Parameters
aggregator- Aggregator.
all(Predicate<Tile>)from AbstractQuery
public boolean all(Predicate<Tile> predicate)Check if all filtered results match the predicate.
Parameters
predicate- Predicate to test.
Returns
True if all match, false otherwise.
any(Predicate<Tile>)from AbstractQuery
public boolean any(Predicate<Tile> 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<Tile> collect()Get the filtered/sorted list.
collect(Collector<Tile, ?, R>)from AbstractQuery
public R collect(Collector<Tile, ?, 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 LocationQuery distinct()Ensure results are distinct.
Returns
The query instance.
first()from AbstractQuery
public Tile first()Get the first element from the filtered/sorted list.
firstIfPresent(Consumer<Tile>)from AbstractQuery
public void firstIfPresent(Consumer<Tile> action)First if present.
Parameters
action- Action.
firstOrElse(Consumer<Tile>, Runnable)from AbstractQuery
public void firstOrElse(Consumer<Tile> 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<Tile>)from AbstractQuery
public void forEach(Consumer<Tile> 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<Tile>)from AbstractQuery
public LocationQuery keepIf(Predicate<Tile> predicate)Lazily filter by predicate (keeps matching items).
Parameters
predicate- Predicate.
Returns
The query instance.
last()from AbstractQuery
public Tile last()Get the last element from the filtered/sorted list.
lastOrElse(Consumer<Tile>, Runnable)from AbstractQuery
public void lastOrElse(Consumer<Tile> 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 LocationQuery limit(int maxSize)Limit the number of results.
Parameters
maxSize- Max size.
Returns
The query instance.
none(Predicate<Tile>)from AbstractQuery
public boolean none(Predicate<Tile> predicate)Check if no filtered results match the predicate.
Parameters
predicate- Predicate to test.
Returns
True if none match, false otherwise.
peek(Consumer<Tile>)from AbstractQuery
public LocationQuery peek(Consumer<Tile> action)Peek at each element during processing.
Parameters
action- Action to perform on each element.
Returns
The query instance.
postProcess(Function<List<Tile>, List<Tile>>)from AbstractQuery
public LocationQuery postProcess(Function<List<Tile>, List<Tile>> 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 Tile random()Get a random element from the filtered/sorted list.
removeIf(Predicate<Tile>)from AbstractQuery
public LocationQuery removeIf(Predicate<Tile> predicate)Lazily filter by predicate (removes matching items).
Parameters
predicate- Predicate.
Returns
The query instance.
skip(int)from AbstractQuery
public LocationQuery skip(int count)Skip a number of results.
Parameters
count- Count.
Returns
The query instance.
sort(Comparator<Tile>)from AbstractQuery
public LocationQuery sort(Comparator<Tile> comparator)Lazily add sorting.
Parameters
comparator- Comparator.
Returns
The query instance.
Also allowed
Every class has these, as in plain Java.
equals, toString