Search in sources :

Example 56 with Inject

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

the class RSNpcCompositionMixin method actionsHook.

@FieldHook("actions")
@Inject
public void actionsHook(int idx) {
    NpcActionChanged npcActionChanged = new NpcActionChanged();
    npcActionChanged.setNpcComposition(this);
    npcActionChanged.setIdx(idx);
    eventBus.post(npcActionChanged);
}
Also used : NpcActionChanged(net.runelite.api.events.NpcActionChanged) Inject(net.runelite.api.mixins.Inject) FieldHook(net.runelite.api.mixins.FieldHook)

Example 57 with Inject

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

the class MinimapMixin method drawInstanceMap.

@Inject
@Override
public RSSpritePixels drawInstanceMap(int z) {
    RSSpritePixels ourSprite = createSpritePixels(new int[512 * 512], 512, 512);
    RSSpritePixels theirSprite = getMinimapSprite();
    RSRegion region = getRegion();
    int[] pixels = ourSprite.getPixels();
    byte[][][] tileSettings = getTileSettings();
    try {
        setMinimapSprite(ourSprite);
        int var4;
        for (int x = 1; x < SCENE_SIZE - 1; ++x) {
            var4 = (103 - x) * 2048 + 24628;
            for (int y = 1; y < SCENE_SIZE - 1; ++y) {
                if ((tileSettings[z][y][x] & 24) == 0) {
                    region.drawTile(pixels, var4, 512, z, y, x);
                }
                if (z < 3 && (tileSettings[z + 1][y][x] & 8) != 0) {
                    region.drawTile(pixels, var4, 512, z + 1, y, x);
                }
                var4 += 4;
            }
        }
        int color1 = (238 + (int) (Math.random() * 20.0D) - 10 << 16) + (238 + (int) (Math.random() * 20.0D) - 10 << 8) + (238 + (int) (Math.random() * 20.0D) - 10);
        int color2 = 238 + (int) (Math.random() * 20.0D) - 10 << 16;
        ourSprite.setRaster();
        for (int y = 1; y < SCENE_SIZE - 1; ++y) {
            for (int x = 1; x < SCENE_SIZE - 1; ++x) {
                if ((tileSettings[z][x][y] & 24) == 0) {
                    drawObject(z, x, y, color1, color2);
                }
                if (z < 3 && (tileSettings[z + 1][x][y] & 8) != 0) {
                    drawObject(z + 1, x, y, color1, color2);
                }
            }
        }
    } finally {
        getBufferProvider().setRaster();
        setMinimapSprite(theirSprite);
    }
    return ourSprite;
}
Also used : RSSpritePixels(net.runelite.rs.api.RSSpritePixels) RSRegion(net.runelite.rs.api.RSRegion) 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