Interface SceneEntityProvider<T extends SceneEntity>

Type Parameters:
T - the type of scene entity this provider manages, must extend SceneEntity
All Superinterfaces:
EntityProvider<T>
All Known Subinterfaces:
INPCs, IPlayers, ITileItems, ITileObjects, TileEntityProvider<T>

public interface SceneEntityProvider<T extends SceneEntity> extends EntityProvider<T>
An entity provider for scene-based entities that have a world location.

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 Type
    Method
    Description
    default List<T>
    getAll(int... anyIds)
    Retrieves all entities whose IDs match any of the specified IDs.
    default List<T>
    getAll(String... anyNames)
    Retrieves all entities whose names match any of the specified names.
    getAll(Predicate<? super T> filter)
    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 T
    getNearest(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 T
    getNearest(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 T
    getNearest(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

      List<T> getAll(Predicate<? super T> filter)
      Retrieves all entities that match the specified filter.

      This method provides the core filtering functionality inherited from EntityProvider.

      Specified by:
      getAll in interface EntityProvider<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

      default List<T> getAll(String... anyNames)
      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

      default List<T> getAll(int... anyIds)
      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

      default T getNearest(net.runelite.api.coords.WorldPoint to, Predicate<? super T> filter)
      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 from
      filter - the predicate to test each entity against
      Returns:
      the nearest matching entity, or null if no entities match
    • getNearest

      default T getNearest(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.
      Parameters:
      to - the world point to measure distance from
      anyNames - one or more names to match against entity names
      Returns:
      the nearest matching entity, or null if no entities match
    • getNearest

      default T getNearest(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.
      Parameters:
      to - the world point to measure distance from
      anyIds - one or more IDs to match against entity IDs
      Returns:
      the nearest matching entity, or null if no entities match
    • getNearest

      T getNearest(Predicate<? super T> filter)
      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

      T getNearest(String... names)
      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

      T getNearest(int... ids)
      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