use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class RSWidgetMixin method getDynamicChildren.
@Inject
@Override
public Widget[] getDynamicChildren() {
RSWidget[] children = getChildren();
if (children == null) {
return new Widget[0];
}
List<Widget> widgets = new ArrayList<Widget>();
for (Widget widget : children) {
if (widget != null && widget.getParentId() == getId()) {
widgets.add(widget);
}
}
return widgets.toArray(new Widget[widgets.size()]);
}
use of net.runelite.api.mixins.Inject 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.mixins.Inject in project runelite by runelite.
the class RSModelMixin method getTriangles.
@Override
@Inject
public List<Triangle> getTriangles() {
int[] trianglesX = getTrianglesX();
int[] trianglesY = getTrianglesY();
int[] trianglesZ = getTrianglesZ();
List<Vertex> vertices = getVertices();
List<Triangle> triangles = new ArrayList<Triangle>(getTrianglesCount());
for (int i = 0; i < getTrianglesCount(); ++i) {
int triangleX = trianglesX[i];
int triangleY = trianglesY[i];
int triangleZ = trianglesZ[i];
Triangle triangle = new Triangle(vertices.get(triangleX), vertices.get(triangleY), vertices.get(triangleZ));
triangles.add(triangle);
}
return triangles;
}
use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class RSModelMixin method getVertices.
@Override
@Inject
public List<Vertex> getVertices() {
int[] verticesX = getVerticesX();
int[] verticesY = getVerticesY();
int[] verticesZ = getVerticesZ();
List<Vertex> vertices = new ArrayList<Vertex>();
for (int i = 0; i < getVerticesCount(); ++i) {
Vertex v = new Vertex(verticesX[i], verticesY[i], verticesZ[i]);
vertices.add(v);
}
return vertices;
}
use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class MenuEntryEventMixin method onMenuOptionsChanged.
@FieldHook("menuOptionCount")
@Inject
public static void onMenuOptionsChanged(int idx) {
int newCount = client.getMenuOptionCount();
if (newCount == oldMenuEntryCount + 1) {
MenuEntryAdded event = new MenuEntryAdded(client.getMenuOptions()[newCount - 1], client.getMenuTargets()[newCount - 1], client.getMenuTypes()[newCount - 1], client.getMenuIdentifiers()[newCount - 1], client.getMenuActionParams0()[newCount - 1], client.getMenuActionParams1()[newCount - 1]);
eventBus.post(event);
}
oldMenuEntryCount = newCount;
}
Aggregations