Interface SceneEntityProvider<T extends SceneEntity>
- Type Parameters:
T- the type of scene entity this provider manages, must extendSceneEntity
- All Superinterfaces:
EntityProvider<T>
- All Known Subinterfaces:
INPCs,IPlayers,ITileItems,ITileObjects,TileEntityProvider<T>
This interface extends EntityProvider with location-aware querying capabilities,
allowing entities to be retrieved based on their names, IDs, or proximity to a given
world point. Scene entities are game objects that exist within the visible game scene
and have a defined world position.
The "nearest" methods calculate distance based on the entity's world location relative to either a specified point or the local player's current position.
Example usage:
// Get all goblins by name
List<INPC> goblins = npcs.getAll("Goblin");
// Get the nearest bank booth
ITileObject booth = tileObjects.getNearest("Bank booth");
// Get nearest NPC by ID
INPC npc = npcs.getNearest(3253, 3254);
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetAll(int... anyIds) Retrieves all entities whose IDs match any of the specified IDs.Retrieves all entities whose names match any of the specified names.Retrieves all entities that match the specified filter.getNearest(int... ids) Gets the nearest entity to the local player whose ID matches any of the given IDs.getNearest(String... names) Gets the nearest entity to the local player whose name matches any of the given names.getNearest(Predicate<? super T> filter) Gets the nearest entity to the local player that matches the given filter.default TgetNearest(net.runelite.api.coords.WorldPoint to, int... anyIds) Gets the nearest entity to a specified world point whose ID matches any of the given IDs.default TgetNearest(net.runelite.api.coords.WorldPoint to, String... anyNames) Gets the nearest entity to a specified world point whose name matches any of the given names.default TgetNearest(net.runelite.api.coords.WorldPoint to, Predicate<? super T> filter) Gets the nearest entity to a specified world point that matches the given filter.
-
Method Details
-
getAll
Retrieves all entities that match the specified filter.This method provides the core filtering functionality inherited from
EntityProvider.- Specified by:
getAllin interfaceEntityProvider<T extends SceneEntity>- Parameters:
filter- the predicate to test each entity against- Returns:
- a list of entities matching the filter; never null but may be empty
-
getAll
Retrieves all entities whose names match any of the specified names.Name matching is case-sensitive and uses exact string comparison.
- Parameters:
anyNames- one or more names to match against entity names- Returns:
- a list of entities with matching names; never null but may be empty
-
getAll
Retrieves all entities whose IDs match any of the specified IDs.- Parameters:
anyIds- one or more IDs to match against entity IDs- Returns:
- a list of entities with matching IDs; never null but may be empty
-
getNearest
Gets the nearest entity to a specified world point that matches the given filter.Distance is calculated using the entity's world location. Only entities with a valid ID (not -1) are considered.
- Parameters:
to- the world point to measure distance fromfilter- the predicate to test each entity against- Returns:
- the nearest matching entity, or null if no entities match
-
getNearest
Gets the nearest entity to a specified world point whose name matches any of the given names.- Parameters:
to- the world point to measure distance fromanyNames- one or more names to match against entity names- Returns:
- the nearest matching entity, or null if no entities match
-
getNearest
Gets the nearest entity to a specified world point whose ID matches any of the given IDs.- Parameters:
to- the world point to measure distance fromanyIds- one or more IDs to match against entity IDs- Returns:
- the nearest matching entity, or null if no entities match
-
getNearest
Gets the nearest entity to the local player that matches the given filter.This is a convenience method that uses the local player's current world location as the reference point for distance calculations.
- Parameters:
filter- the predicate to test each entity against- Returns:
- the nearest matching entity, or null if no entities match
-
getNearest
Gets the nearest entity to the local player whose name matches any of the given names.This is a convenience method that uses the local player's current world location as the reference point for distance calculations.
- Parameters:
names- one or more names to match against entity names- Returns:
- the nearest matching entity, or null if no entities match
-
getNearest
Gets the nearest entity to the local player whose ID matches any of the given IDs.This is a convenience method that uses the local player's current world location as the reference point for distance calculations.
- Parameters:
ids- one or more IDs to match against entity IDs- Returns:
- the nearest matching entity, or null if no entities match
-