Package net.storm.api.query.entities
Class TileObjectQuery
java.lang.Object
net.storm.api.query.Query<ITileObject,TileObjectQuery,SceneEntityQueryResults<ITileObject>>
net.storm.api.query.entities.SceneEntityQuery<ITileObject,TileObjectQuery>
net.storm.api.query.entities.TileObjectQuery
- All Implemented Interfaces:
Predicate<ITileObject>
Query class for finding and filtering tile objects in the game world.
Tile objects are static objects placed on tiles in the game scene, such as trees,
rocks, doors, and other interactable scenery. This class extends SceneEntityQuery
with tile object-specific filtering capabilities:
- Filter by specific tiles
- Filter by object type (using instanceof checks)
- IDs, names, actions, locations, distances (from SceneEntityQuery)
Example usage:
// Find all bank booths within 5 tiles
TileObjectQuery query = new TileObjectQuery(tileObjectSupplier)
.names("Bank booth")
.distance(player, 5);
SceneEntityQueryResults<ITileObject> results = query.results();
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionTileObjectQuery(Supplier<List<ITileObject>> supplier) Constructs a new tile object query with the specified tile object supplier. -
Method Summary
Modifier and TypeMethodDescriptionfinal TileObjectQueryis(Class<? extends ITileObject>... classes) Filters tile objects by their specific types.protected SceneEntityQueryResults<ITileObject> results(List<ITileObject> list) Wraps the filtered list of tile objects in a SceneEntityQueryResults container.booleantest(ITileObject tileObject) Tests whether a tile object passes all accumulated filter criteria.Filters tile objects by the tiles they are located on.Methods inherited from class net.storm.api.query.entities.SceneEntityQuery
actionContains, actions, distance, distance, distance, ids, localLocations, locations, nameContains, names, within, worldView
-
Constructor Details
-
TileObjectQuery
Constructs a new tile object query with the specified tile object supplier.- Parameters:
supplier- a supplier that provides the list of tile objects to query
-
-
Method Details
-
tiles
Filters tile objects by the tiles they are located on.Only tile objects located on one of the specified tiles will be included.
- Parameters:
tiles- the tiles to filter by- Returns:
- this query instance for method chaining
-
is
Filters tile objects by their specific types.Only tile objects that are instances of at least one of the specified classes will be included. This allows filtering for specific subtypes of tile objects such as game objects, wall objects, ground objects, or decorative objects.
- Parameters:
classes- the tile object types to filter by- Returns:
- this query instance for method chaining
-
results
Wraps the filtered list of tile objects in a SceneEntityQueryResults container.- Specified by:
resultsin classQuery<ITileObject,TileObjectQuery, SceneEntityQueryResults<ITileObject>> - Parameters:
list- the list of tile objects that passed all filters- Returns:
- the results wrapped in a SceneEntityQueryResults container
-
test
Tests whether a tile object passes all accumulated filter criteria.This method checks the tile object against the tile filter, type filter, and all parent class filters.
- Specified by:
testin interfacePredicate<ITileObject>- Overrides:
testin classSceneEntityQuery<ITileObject,TileObjectQuery> - Parameters:
tileObject- the tile object to test- Returns:
trueif the tile object passes all filters,falseotherwise
-