Skip to main content

Scene Query Actions

ProjectileActions and GraphicsObjectActions expose lightweight query helpers for combat and environment state detection.

Need tile-level or path-level safety instead of raw entity existence? See ThreatMapApi and LineOfSightApi in client-utilities.md.

ProjectileActions

  • getAll(Predicate<Projectile>)
  • getFirst(Predicate<Projectile>)
  • exists(Predicate<Projectile>)
  • count(Predicate<Projectile>)
  • Overloads accept an Iterable<Projectile> for pure tests and pre-filtered caller-owned collections.

GraphicsObjectActions

  • getAll(Predicate<GraphicsObject>)
  • getFirst(Predicate<GraphicsObject>)
  • exists(Predicate<GraphicsObject>)
  • count(Predicate<GraphicsObject>)
  • Overloads accept an Iterable<GraphicsObject> for pure tests and pre-filtered caller-owned collections.

Behavior notes:

  • Live graphics-object queries use the top-level world view.
  • Null clients and null collections return empty results.

Projectile Warning Example

Use projectile predicates for lightweight hazard detection. Keep predicates cheap because callers usually run them once per game tick.

boolean incoming = ProjectileActions.exists(projectile ->
projectile.getId() == DANGEROUS_PROJECTILE_ID
&& projectile.getInteracting() == client.getLocalPlayer()
);

if (incoming) {
log.debug("Incoming projectile detected");
}

Pure Collection Tests

The iterable overloads let tests exercise filtering behavior with caller-owned collections.

List<Projectile> projectiles = Arrays.asList(first, second, third);

int dangerousCount = ProjectileActions.count(
projectiles,
projectile -> projectile.getId() == DANGEROUS_PROJECTILE_ID
);

Graphics Object Checks

Graphics objects are useful for environment state such as spell effects, resource effects, or temporary hazards.

Optional<GraphicsObject> marker = GraphicsObjectActions.getFirst(object ->
object.getId() == MARKER_GRAPHICS_ID
);

marker.ifPresent(object -> log.debug("Marker at {}", object.getLocation()));