Class GameObjects

java.lang.Object
privbot.hooks.GameObjects

public final class GameObjects extends Object
Scene object query (KSBot-style). Refreshes once per game tick on the game thread.

query() is safe from any thread; ObjectQuery.withName(String...), ObjectQuery.withAction(String...), ObjectQuery.closest(), and PrivObject.exists() marshal to the client thread when needed so filters (which call getObjectDefinition) and player distance are not evaluated from a script/background thread.

Player-relative filters (north/south/east/west of an object) live on ObjectQuery; single-object checks are on PrivObject.

  • Method Details

    • getClient

      public net.runelite.api.Client getClient()
      Returns:
      the client this facade reads
    • query

      public ObjectQuery query()
      A query over the scene's objects, read once per game tick on the client thread and reused within the tick.
      Returns:
      the query
    • closest

      public PrivObject closest(Predicate<PrivObject> pred)
      Closest object matching the predicate.
    • closest

      public PrivObject closest(String... names)
      Closest object matching any of the supplied names, or null.
    • nearest

      public PrivObject nearest(String... names)
    • exists

      public boolean exists(String... names)
      Whether an object matching any of the supplied names is currently loaded.
    • interactClosest

      public boolean interactClosest(String action, String... names)
      Interacts with the closest object matching any supplied name.
    • interact

      public boolean interact(String name, String action)
      Interacts with the closest object matching name using action.
    • withAction

      public ObjectQuery withAction(String... actions)
      Start a query filtered to objects with at least one of the given actions.
    • withName

      public ObjectQuery withName(String... names)
      Start a query filtered to objects matching the given name(s).
    • withId

      public ObjectQuery withId(int... ids)
      Start a query filtered to objects matching the given ID(s).
    • nearest

      public static PrivObject nearest(Predicate<PrivObject> pred)
      Static lookup that needs no ctx; prefer ctx.objects.closest(pred).
      Parameters:
      pred - the test
      Returns:
      the nearest matching object, or null