use of net.runelite.api.Node in project runelite by runelite.
the class RSHashTableMixin method getNodes.
@Inject
@Override
public Collection<Node> getNodes() {
// Copied in RSWidgetMixin.getParentId to reduce allocations
List<Node> nodes = new ArrayList<Node>();
RSNode[] buckets = getBuckets();
for (int i = 0; i < buckets.length; ++i) {
Node node = buckets[i];
// It looks like the first node in the bucket is always
// a sentinel
Node cur = node.getNext();
while (cur != node) {
nodes.add(cur);
cur = cur.getNext();
}
}
return nodes;
}
use of net.runelite.api.Node in project runelite by runelite.
the class RSWidgetMixin method getNestedChildren.
@Inject
@Override
public Widget[] getNestedChildren() {
RSHashTable componentTable = client.getComponentTable();
int group = -1;
// iteration here...
for (Node node : componentTable.getNodes()) {
WidgetNode wn = (WidgetNode) node;
if (wn.getHash() == getId()) {
group = wn.getId();
break;
}
}
if (group == -1) {
return new Widget[0];
}
List<Widget> widgets = new ArrayList<Widget>();
for (Widget widget : client.getGroup(group)) {
if (widget != null && widget.getParentId() == getId()) {
widgets.add(widget);
}
}
return widgets.toArray(new Widget[widgets.size()]);
}
use of net.runelite.api.Node in project runelite by runelite.
the class RSClientMixin method getProjectiles.
@Inject
@Override
public List<Projectile> getProjectiles() {
List<Projectile> projectiles = new ArrayList<Projectile>();
RSDeque projectileDeque = this.getProjectilesDeque();
Node head = projectileDeque.getHead();
for (Node node = head.getNext(); node != head; node = node.getNext()) {
projectiles.add((Projectile) node);
}
return projectiles;
}
use of net.runelite.api.Node in project runelite by runelite.
the class RSWidgetMixin method getParentId.
@Inject
@Override
public int getParentId() {
int parentId = getRSParentId();
if (parentId != -1) {
return parentId;
}
int groupId = TO_GROUP(getId());
RSHashTable componentTable = client.getComponentTable();
RSNode[] buckets = componentTable.getBuckets();
for (int i = 0; i < buckets.length; ++i) {
Node node = buckets[i];
// It looks like the first node in the bucket is always
// a sentinel
Node cur = node.getNext();
while (cur != node) {
WidgetNode wn = (WidgetNode) cur;
if (groupId == wn.getId()) {
return (int) wn.getHash();
}
cur = cur.getNext();
}
}
return -1;
}
use of net.runelite.api.Node in project runelite by runelite.
the class DevToolsOverlay method renderGroundItems.
private void renderGroundItems(Graphics2D graphics, Tile tile, Player player) {
ItemLayer itemLayer = tile.getItemLayer();
if (itemLayer != null) {
if (player.getLocalLocation().distanceTo(itemLayer.getLocalLocation()) <= MAX_DISTANCE) {
Node current = itemLayer.getBottom();
while (current instanceof Item) {
Item item = (Item) current;
OverlayUtil.renderTileOverlay(graphics, itemLayer, "ID: " + item.getId() + " Qty:" + item.getQuantity(), RED);
current = current.getNext();
}
}
}
}
Aggregations