Class Components

java.lang.Object
com.botwithus.bot.api.component.Components

public final class Components extends Object
Interface-component query facade. Singleton per GameAPI; obtain via api.components(). The coherent entry point for inspecting interface components, parallel to api.npcs() / api.mapElements().

RPC-backed and poll-based: a query fetches a live subtree in one get_interface_tree round-trip (cross-mount aware) and filters it client-side. There is no cache across ticks — re-query for fresh state.

Components ui = api.components();
if (ui.isOpen(Interfaces.BACKPACK)) {
    ComponentNode item = ui.in(Interfaces.BACKPACK)
            .withType(ComponentType.MODEL)
            .withItemId(995)
            .first();
    if (item != null) {
        item.interact(1);
    }
}
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    find(int interfaceId, Predicate<ComponentNode> predicate)
    Convenience: first node in the interface matching predicate, or null.
    find(String interfaceGameval, Predicate<ComponentNode> predicate)
    Convenience: first node in the gameval-named interface matching predicate, or null.
    get(int interfaceId, int componentId)
    Single component by coordinates, or null when not loaded.
    get(String componentGameval)
    Single component named by its gameval, e.g.
    in(int interfaceId)
    Start a query over the whole interface (rooted at its root component).
    in(String interfaceGameval)
    Query over the whole interface named by its gameval, e.g.
    boolean
    isOpen(int interfaceId)
    True when the interface's root component resolves — a proxy for "this interface is currently loaded / open".
    boolean
    isOpen(String interfaceGameval)
    True when the interface named by its gameval is currently loaded.
    pickAt(int screenX, int screenY)
    Detached node for the component under a screen-space coordinate, or null when nothing is there.
    under(int interfaceId, int componentId)
    Start a query over the subtree rooted at (interfaceId, componentId).
    under(String componentGameval)
    Query over the subtree rooted at the component named by its gameval, e.g.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Components

      public Components(GameAPI api)
  • Method Details

    • in

      public ComponentQuery in(int interfaceId)
      Start a query over the whole interface (rooted at its root component).
    • under

      public ComponentQuery under(int interfaceId, int componentId)
      Start a query over the subtree rooted at (interfaceId, componentId).
    • get

      public ComponentNode get(int interfaceId, int componentId)
      Single component by coordinates, or null when not loaded. Cheap (one get_component); the returned node is detached — its ComponentNode.children() triggers a subtree fetch on demand, and ComponentNode.parent() is null.
    • isOpen

      public boolean isOpen(int interfaceId)
      True when the interface's root component resolves — a proxy for "this interface is currently loaded / open".
    • find

      public ComponentNode find(int interfaceId, Predicate<ComponentNode> predicate)
      Convenience: first node in the interface matching predicate, or null.
    • pickAt

      public ComponentNode pickAt(int screenX, int screenY)
      Detached node for the component under a screen-space coordinate, or null when nothing is there. Coordinates are raw screen pixels (the value of Win32 GetCursorPos); the producer converts to client-window space internally.

      Returns the deepest visible component whose AABB contains the point, across every open interface. The node is detached — parent() is null and children() fetches the subtree on demand.

    • in

      public ComponentQuery in(String interfaceGameval)
      Query over the whole interface named by its gameval, e.g. "BANK". Returns an empty query when the name doesn't resolve.
      ComponentNode close = api.components().in("BANK")
              .withType(ComponentType.MODEL)
              .first();
      
    • under

      public ComponentQuery under(String componentGameval)
      Query over the subtree rooted at the component named by its gameval, e.g. "BANK__CONTENT". Returns an empty query when the name doesn't resolve.
    • get

      public ComponentNode get(String componentGameval)
      Single component named by its gameval, e.g. "BANK__BANK_INV_BUTTON" → interface 517, component 39. null when the name doesn't resolve or the component isn't loaded — the gameval names every component the cache defines, not just the ones currently on screen.
      ComponentNode inv = api.components().get("BANK__BANK_INV_BUTTON");
      if (inv != null) {
          inv.interact(1);
      }
      
    • isOpen

      public boolean isOpen(String interfaceGameval)
      True when the interface named by its gameval is currently loaded.
    • find

      public ComponentNode find(String interfaceGameval, Predicate<ComponentNode> predicate)
      Convenience: first node in the gameval-named interface matching predicate, or null.