Search in sources :

Example 16 with NPC

use of net.runelite.api.NPC in project runelite by runelite.

the class FishingSpotOverlay method render.

@Override
public Dimension render(Graphics2D graphics) {
    NPC[] fishingSpots = plugin.getFishingSpots();
    if (fishingSpots == null) {
        return null;
    }
    for (NPC npc : fishingSpots) {
        FishingSpot spot = FishingSpot.getSpot(npc.getId());
        if (spot == null) {
            continue;
        }
        Color color = npc.getGraphic() == GraphicID.FLYING_FISH ? Color.RED : Color.CYAN;
        if (config.showIcons()) {
            BufferedImage fishImage = getFishImage(spot);
            if (fishImage != null) {
                OverlayUtil.renderActorOverlayImage(graphics, npc, fishImage, color.darker(), npc.getLogicalHeight());
            }
        } else {
            String text = spot.getName();
            OverlayUtil.renderActorOverlay(graphics, npc, text, color.darker());
        }
    }
    return null;
}
Also used : NPC(net.runelite.api.NPC) Color(java.awt.Color) BufferedImage(java.awt.image.BufferedImage)

Aggregations

NPC (net.runelite.api.NPC)16 NPCComposition (net.runelite.api.NPCComposition)6 LocalPoint (net.runelite.api.coords.LocalPoint)3 Color (java.awt.Color)2 Client (net.runelite.api.Client)2 Player (net.runelite.api.Player)2 Point (net.runelite.api.Point)2 Query (net.runelite.api.Query)2 Inject (net.runelite.api.mixins.Inject)2 NPCQuery (net.runelite.api.queries.NPCQuery)2 Subscribe (com.google.common.eventbus.Subscribe)1 Dimension (java.awt.Dimension)1 FontMetrics (java.awt.FontMetrics)1 Point (java.awt.Point)1 Rectangle (java.awt.Rectangle)1 BufferedImage (java.awt.image.BufferedImage)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Actor (net.runelite.api.Actor)1 GameObject (net.runelite.api.GameObject)1