Class SceneEntityQuery<T extends SceneEntity,Q extends SceneEntityQuery<T,Q>>

java.lang.Object
net.storm.api.query.Query<T,Q,SceneEntityQueryResults<T>>
net.storm.api.query.entities.SceneEntityQuery<T,Q>
Type Parameters:
T - the type of scene entity being queried
Q - the concrete query type (for method chaining)
All Implemented Interfaces:
Predicate<T>
Direct Known Subclasses:
ActorQuery, TileItemQuery, TileObjectQuery

public abstract class SceneEntityQuery<T extends SceneEntity,Q extends SceneEntityQuery<T,Q>> extends Query<T,Q,SceneEntityQueryResults<T>>
Abstract query class for filtering scene entities in the game world.

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

    Fields inherited from class net.storm.api.query.Query

    supplier
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructs a new scene entity query with the specified entity supplier.
  • Method Summary

    Modifier and Type
    Method
    Description
    Filters entities that have an action containing the specified substring.
    actions(String... actions)
    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.
    distance(Locatable source, int maxDistance)
    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.
    Filters entities whose name contains the specified substring.
    names(String... names)
    Filters entities by their names using exact matching.
    boolean
    test(T t)
    Tests 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.

    Methods inherited from class net.storm.api.query.Query

    filter, results, results, self

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.function.Predicate

    and, negate, or
  • Constructor Details

    • SceneEntityQuery

      protected SceneEntityQuery(Supplier<List<T>> supplier)
      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

      public Q ids(int... 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

      public Q names(String... 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

      public Q nameContains(String text)
      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

      public Q actions(String... 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

      public Q actionContains(String text)
      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

      public Q locations(net.runelite.api.coords.WorldPoint... 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

      public Q localLocations(net.runelite.api.coords.LocalPoint... 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

      public Q distance(Locatable source, int maxDistance)
      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 calculations
      maxDistance - the maximum distance from the source (inclusive)
      Returns:
      this query instance for method chaining
    • distance

      public Q distance(net.runelite.api.coords.WorldPoint source, int maxDistance)
      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 calculations
      maxDistance - the maximum distance from the source (inclusive)
      Returns:
      this query instance for method chaining
    • distance

      public Q distance(int maxDistance)
      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

      public Q within(net.runelite.api.coords.WorldArea... areas)
      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

      public Q worldView(net.runelite.api.WorldView 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

      public boolean test(T t)
      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:
      test in interface Predicate<T extends SceneEntity>
      Overrides:
      test in class Query<T extends SceneEntity,Q extends SceneEntityQuery<T,Q>,SceneEntityQueryResults<T extends SceneEntity>>
      Parameters:
      t - the scene entity to test
      Returns:
      true if the entity passes all filters, false otherwise