Class Components
java.lang.Object
com.botwithus.bot.api.component.Components
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 -
Method Summary
Modifier and TypeMethodDescriptionfind(int interfaceId, Predicate<ComponentNode> predicate) Convenience: first node in the interface matchingpredicate, ornull.find(String interfaceGameval, Predicate<ComponentNode> predicate) Convenience: first node in the gameval-named interface matchingpredicate, ornull.get(int interfaceId, int componentId) Single component by coordinates, ornullwhen not loaded.Single component named by its gameval, e.g.in(int interfaceId) Start a query over the whole interface (rooted at its root component).Query over the whole interface named by its gameval, e.g.booleanisOpen(int interfaceId) True when the interface's root component resolves — a proxy for "this interface is currently loaded / open".booleanTrue 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, ornullwhen nothing is there.under(int interfaceId, int componentId) Start a query over the subtree rooted at(interfaceId, componentId).Query over the subtree rooted at the component named by its gameval, e.g.
-
Constructor Details
-
Components
-
-
Method Details
-
in
Start a query over the whole interface (rooted at its root component). -
under
Start a query over the subtree rooted at(interfaceId, componentId). -
get
Single component by coordinates, ornullwhen not loaded. Cheap (oneget_component); the returned node is detached — itsComponentNode.children()triggers a subtree fetch on demand, andComponentNode.parent()isnull. -
isOpen
public boolean isOpen(int interfaceId) True when the interface's root component resolves — a proxy for "this interface is currently loaded / open". -
find
Convenience: first node in the interface matchingpredicate, ornull. -
pickAt
Detached node for the component under a screen-space coordinate, ornullwhen nothing is there. Coordinates are raw screen pixels (the value of Win32GetCursorPos); 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()isnullandchildren()fetches the subtree on demand. -
in
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
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
Single component named by its gameval, e.g."BANK__BANK_INV_BUTTON"→ interface 517, component 39.nullwhen 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
True when the interface named by its gameval is currently loaded. -
find
Convenience: first node in the gameval-named interface matchingpredicate, ornull.
-