Class TileItemQuery

All Implemented Interfaces:
Predicate<ITileItem>

public class TileItemQuery extends SceneEntityQuery<ITileItem,TileItemQuery>
Query class for finding and filtering ground items (tile items) in the game world.

Ground items are items that have been dropped or spawned on tiles in the game scene. This class extends SceneEntityQuery with ground item-specific filtering capabilities:

  • Filter by item quantities
  • Filter by specific tiles
  • Filter by tradability
  • Filter by stackability
  • Filter by noted status
  • Filter by members-only status
  • Filter by inventory actions
  • IDs, names, actions, locations, distances (from SceneEntityQuery)

Example usage:


 // Find all tradable items on the ground within 10 tiles
 TileItemQuery query = new TileItemQuery(tileItemSupplier)
     .tradable(true)
     .distance(player, 10);
 SceneEntityQueryResults<ITileItem> results = query.results();
 
  • Constructor Details

    • TileItemQuery

      public TileItemQuery(Supplier<List<ITileItem>> supplier)
      Constructs a new tile item query with the specified tile item supplier.
      Parameters:
      supplier - a supplier that provides the list of ground items to query
  • Method Details

    • quantities

      public TileItemQuery quantities(int... quantities)
      Filters ground items by their quantity.

      Only items with a quantity matching one of the specified values will be included.

      Parameters:
      quantities - the quantities to filter by
      Returns:
      this query instance for method chaining
    • tiles

      public TileItemQuery tiles(ITile... tiles)
      Filters ground items by the tiles they are located on.

      Only items located on one of the specified tiles will be included.

      Parameters:
      tiles - the tiles to filter by
      Returns:
      this query instance for method chaining
    • tradable

      public TileItemQuery tradable(boolean tradable)
      Filters ground items by their tradability.

      Only items whose tradability matches the specified value will be included.

      Parameters:
      tradable - true to include only tradable items, false for untradable items
      Returns:
      this query instance for method chaining
    • stackable

      public TileItemQuery stackable(boolean stackable)
      Filters ground items by their stackability.

      Only items whose stackability matches the specified value will be included.

      Parameters:
      stackable - true to include only stackable items, false for non-stackable items
      Returns:
      this query instance for method chaining
    • noted

      public TileItemQuery noted(boolean noted)
      Filters ground items by their noted status.

      Only items whose noted status matches the specified value will be included.

      Parameters:
      noted - true to include only noted items, false for unnoted items
      Returns:
      this query instance for method chaining
    • members

      public TileItemQuery members(boolean members)
      Filters ground items by their members-only status.

      Only items whose members status matches the specified value will be included.

      Parameters:
      members - true to include only members items, false for free-to-play items
      Returns:
      this query instance for method chaining
    • inventoryActions

      public TileItemQuery inventoryActions(String... inventoryActions)
      Filters ground items by their inventory actions.

      Only items that have at least one inventory action matching one of the specified values will be included.

      Parameters:
      inventoryActions - the inventory actions to filter by
      Returns:
      this query instance for method chaining
    • results

      protected SceneEntityQueryResults<ITileItem> results(List<ITileItem> list)
      Wraps the filtered list of ground items in a SceneEntityQueryResults container.
      Specified by:
      results in class Query<ITileItem,TileItemQuery,SceneEntityQueryResults<ITileItem>>
      Parameters:
      list - the list of ground items that passed all filters
      Returns:
      the results wrapped in a SceneEntityQueryResults container
    • test

      public boolean test(ITileItem tileItem)
      Tests whether a ground item passes all accumulated filter criteria.

      This method checks the item against all configured filters including quantity, tile, tradability, stackability, noted status, members status, inventory actions, and all parent class filters.

      Specified by:
      test in interface Predicate<ITileItem>
      Overrides:
      test in class SceneEntityQuery<ITileItem,TileItemQuery>
      Parameters:
      tileItem - the ground item to test
      Returns:
      true if the item passes all filters, false otherwise