Class SceneEntityQuery<T extends SceneEntity,Q extends SceneEntityQuery<T,Q>>
- Type Parameters:
T- the type of scene entity being queriedQ- the concrete query type (for method chaining)
- All Implemented Interfaces:
Predicate<T>
- Direct Known Subclasses:
ActorQuery,TileItemQuery,TileObjectQuery
Scene entities are objects that exist within the game scene and have a location, such as NPCs, players, tile objects, and ground items. This class provides common filtering capabilities based on:
- Entity IDs
- Entity names (exact match or contains)
- Available actions (exact match or contains)
- World locations and local locations
- Distance from a reference point
- Containment within world areas
- World view association
Subclasses extend this functionality for specific entity types.
-
Field Summary
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSceneEntityQuery(Supplier<List<T>> supplier) Constructs a new scene entity query with the specified entity supplier. -
Method Summary
Modifier and TypeMethodDescriptionactionContains(String text) Filters entities that have an action containing the specified substring.Filters entities by their available actions using exact matching.distance(int maxDistance) Filters entities by their maximum distance.distance(net.runelite.api.coords.WorldPoint source, int maxDistance) Filters entities by their distance from a world point.Filters entities by their distance from a locatable source.ids(int... ids) Filters entities by their IDs.localLocations(net.runelite.api.coords.LocalPoint... localLocations) Filters entities by their local locations.locations(net.runelite.api.coords.WorldPoint... locations) Filters entities by their world locations.nameContains(String text) Filters entities whose name contains the specified substring.Filters entities by their names using exact matching.booleanTests whether a scene entity passes all accumulated filter criteria.within(net.runelite.api.coords.WorldArea... areas) Filters entities that are within any of the specified world areas.worldView(net.runelite.api.WorldView worldView) Filters entities by their associated world view.
-
Constructor Details
-
SceneEntityQuery
Constructs a new scene entity query with the specified entity supplier.- Parameters:
supplier- a supplier that provides the list of scene entities to query
-
-
Method Details
-
ids
Filters entities by their IDs.Only entities with an ID matching one of the specified values will be included.
- Parameters:
ids- the entity IDs to filter by- Returns:
- this query instance for method chaining
-
names
Filters entities by their names using exact matching.Only entities whose name exactly matches one of the specified values will be included.
- Parameters:
names- the entity names to filter by- Returns:
- this query instance for method chaining
-
nameContains
Filters entities whose name contains the specified substring.Only entities whose name contains the given text will be included.
- Parameters:
text- the substring that entity names must contain- Returns:
- this query instance for method chaining
-
actions
Filters entities by their available actions using exact matching.Only entities that have at least one action matching one of the specified values will be included.
- Parameters:
actions- the actions to filter by- Returns:
- this query instance for method chaining
-
actionContains
Filters entities that have an action containing the specified substring.Only entities that have at least one action containing the given text will be included.
- Parameters:
text- the substring that an action must contain- Returns:
- this query instance for method chaining
-
locations
Filters entities by their world locations.Only entities located at one of the specified world points will be included.
- Parameters:
locations- the world locations to filter by- Returns:
- this query instance for method chaining
-
localLocations
Filters entities by their local locations.Only entities located at one of the specified local points will be included.
- Parameters:
localLocations- the local locations to filter by- Returns:
- this query instance for method chaining
-
distance
Filters entities by their distance from a locatable source.Only entities within the specified maximum distance from the source will be included.
- Parameters:
source- the reference point for distance calculationsmaxDistance- the maximum distance from the source (inclusive)- Returns:
- this query instance for method chaining
-
distance
Filters entities by their distance from a world point.Only entities within the specified maximum distance from the source will be included.
- Parameters:
source- the reference world point for distance calculationsmaxDistance- the maximum distance from the source (inclusive)- Returns:
- this query instance for method chaining
-
distance
Filters entities by their maximum distance.Only entities within the specified maximum distance will be included. Note: A distance source should be set for this filter to take effect.
- Parameters:
maxDistance- the maximum distance (inclusive)- Returns:
- this query instance for method chaining
-
within
Filters entities that are within any of the specified world areas.Only entities whose world location is contained within at least one of the specified areas will be included.
- Parameters:
areas- the world areas to check containment against- Returns:
- this query instance for method chaining
-
worldView
Filters entities by their associated world view.Only entities belonging to the specified world view will be included.
- Parameters:
worldView- the world view to filter by- Returns:
- this query instance for method chaining
-
test
Tests whether a scene entity passes all accumulated filter criteria.This method checks the entity against all configured filters including ID, name, actions, location, distance, world area containment, and world view.
- Specified by:
testin interfacePredicate<T extends SceneEntity>- Overrides:
testin classQuery<T extends SceneEntity,Q extends SceneEntityQuery<T, Q>, SceneEntityQueryResults<T extends SceneEntity>> - Parameters:
t- the scene entity to test- Returns:
trueif the entity passes all filters,falseotherwise
-