Search in sources :

Example 31 with Inject

use of net.runelite.api.mixins.Inject in project runelite by runelite.

the class RSPlayerMixin method rotate.

@Inject
private List<Triangle> rotate(List<Triangle> triangles, int orientation) {
    List<Triangle> rotatedTriangles = new ArrayList<Triangle>();
    for (Triangle triangle : triangles) {
        Vertex a = triangle.getA();
        Vertex b = triangle.getB();
        Vertex c = triangle.getC();
        Triangle rotatedTriangle = new Triangle(a.rotate(orientation), b.rotate(orientation), c.rotate(orientation));
        rotatedTriangles.add(rotatedTriangle);
    }
    return rotatedTriangles;
}
Also used : Vertex(net.runelite.api.model.Vertex) Triangle(net.runelite.api.model.Triangle) ArrayList(java.util.ArrayList) Inject(net.runelite.api.mixins.Inject)

Example 32 with Inject

use of net.runelite.api.mixins.Inject in project runelite by runelite.

the class RSClientMixin method draggingWidgetChanged.

@FieldHook("draggingWidget")
@Inject
public static void draggingWidgetChanged(int idx) {
    DraggingWidgetChanged draggingWidgetChanged = new DraggingWidgetChanged();
    draggingWidgetChanged.setDraggingWidget(client.isDraggingWidget());
    eventBus.post(draggingWidgetChanged);
}
Also used : DraggingWidgetChanged(net.runelite.api.events.DraggingWidgetChanged) Inject(net.runelite.api.mixins.Inject) FieldHook(net.runelite.api.mixins.FieldHook)

Example 33 with Inject

use of net.runelite.api.mixins.Inject in project runelite by runelite.

the class RSClientMixin method experiencedChanged.

@FieldHook("skillExperiences")
@Inject
public static void experiencedChanged(int idx) {
    ExperienceChanged experienceChanged = new ExperienceChanged();
    Skill[] possibleSkills = Skill.values();
    // We subtract one here because 'Overall' isn't considered a skill that's updated.
    if (idx < possibleSkills.length - 1) {
        Skill updatedSkill = possibleSkills[idx];
        experienceChanged.setSkill(updatedSkill);
        eventBus.post(experienceChanged);
    }
}
Also used : ExperienceChanged(net.runelite.api.events.ExperienceChanged) Skill(net.runelite.api.Skill) Inject(net.runelite.api.mixins.Inject) FieldHook(net.runelite.api.mixins.FieldHook)

Example 34 with Inject

use of net.runelite.api.mixins.Inject 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;
}
Also used : RSDeque(net.runelite.rs.api.RSDeque) Node(net.runelite.api.Node) WidgetNode(net.runelite.api.WidgetNode) ArrayList(java.util.ArrayList) Projectile(net.runelite.api.Projectile) Inject(net.runelite.api.mixins.Inject)

Example 35 with Inject

use of net.runelite.api.mixins.Inject in project runelite by runelite.

the class RSClientMixin method getPlayers.

@Inject
@Override
public List<Player> getPlayers() {
    int validPlayerIndexes = getPlayerIndexesCount();
    int[] playerIndexes = getPlayerIndices();
    Player[] cachedPlayers = getCachedPlayers();
    List<Player> players = new ArrayList<Player>(validPlayerIndexes);
    for (int i = 0; i < validPlayerIndexes; ++i) {
        players.add(cachedPlayers[playerIndexes[i]]);
    }
    return players;
}
Also used : Player(net.runelite.api.Player) ArrayList(java.util.ArrayList) LocalPoint(net.runelite.api.coords.LocalPoint) Point(net.runelite.api.Point) Inject(net.runelite.api.mixins.Inject)

Aggregations

Inject (net.runelite.api.mixins.Inject)57 Point (net.runelite.api.Point)20 FieldHook (net.runelite.api.mixins.FieldHook)20 ArrayList (java.util.ArrayList)14 LocalPoint (net.runelite.api.coords.LocalPoint)10 RSWidget (net.runelite.rs.api.RSWidget)6 Vertex (net.runelite.api.model.Vertex)5 Widget (net.runelite.api.widgets.Widget)5 Node (net.runelite.api.Node)4 RSNode (net.runelite.rs.api.RSNode)4 WidgetNode (net.runelite.api.WidgetNode)3 Triangle (net.runelite.api.model.Triangle)3 Polygon (java.awt.Polygon)2 MenuEntry (net.runelite.api.MenuEntry)2 Model (net.runelite.api.Model)2 NPC (net.runelite.api.NPC)2 Player (net.runelite.api.Player)2 Skill (net.runelite.api.Skill)2 WidgetItem (net.runelite.api.widgets.WidgetItem)2 RSCombatInfoList (net.runelite.rs.api.RSCombatInfoList)2