Class ComponentTree

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

public final class ComponentTree extends Object
An immutable, materialized interface subtree fetched in a single get_interface_tree round-trip. Holds the flattened node list plus parent/child linkage so navigation (ComponentNode.parent(), ComponentNode.children(), ComponentNode.descendants()) is pure in-memory work — no further RPC.

The tree is a snapshot of one tick; don't hold it across ticks. Build a fresh one (via Components.in(int) / Components.under(int, int)) when you need current state.

  • Method Details

    • fetch

      public static ComponentTree fetch(GameAPI api, int interfaceId, int componentId)
      Fetch + materialize the subtree rooted at (interfaceId, componentId).
    • root

      public ComponentNode root()
      The root node, or null when the subtree didn't resolve (empty tree).
    • nodes

      public List<ComponentNode> nodes()
      All nodes in breadth-first order. Unmodifiable.
    • node

      public ComponentNode node(int interfaceId, int componentId)
      First node matching (interfaceId, componentId), or null.