diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpot.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpot.java index 048df1847b2..6b9823c6181 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpot.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpot.java @@ -24,6 +24,8 @@ */ package net.runelite.client.plugins.fishing; +import net.runelite.api.ItemID; + import java.util.HashMap; import java.util.Map; import static net.runelite.api.NpcID.FISHING_SPOT_1506; @@ -58,32 +60,32 @@ public enum FishingSpot { - SHRIMP("Shrimp, Anchovies", "shrimp", + SHRIMP("Shrimp, Anchovies", ItemID.RAW_SHRIMPS, FISHING_SPOT_1518, FISHING_SPOT_1525, FISHING_SPOT_1528, FISHING_SPOT_1530, FISHING_SPOT_1544, FISHING_SPOT_7155, FISHING_SPOT_7469 ), - LOBSTER("Lobster, Swordfish, Tuna", "lobster", + LOBSTER("Lobster, Swordfish, Tuna", ItemID.RAW_LOBSTER, FISHING_SPOT_1510, FISHING_SPOT_1519, FISHING_SPOT_1521, FISHING_SPOT_1522, FISHING_SPOT_7199, FISHING_SPOT_7470 ), - SHARK("Shark, Bass", "shark", + SHARK("Shark, Bass", ItemID.RAW_SHARK, FISHING_SPOT_1511, FISHING_SPOT_1520, FISHING_SPOT_7200 ), - MONKFISH("Monkfish", "monkfish", + MONKFISH("Monkfish", ItemID.RAW_MONKFISH, FISHING_SPOT_4316 ), - SALMON("Salmon, Trout", "salmon", + SALMON("Salmon, Trout", ItemID.RAW_SALMON, FISHING_SPOT_1506, FISHING_SPOT_1508, FISHING_SPOT_1515, FISHING_SPOT_1526, FISHING_SPOT_1527 ), - BARB_FISH("Sturgeon, Salmon, Trout", "barb", + BARB_FISH("Sturgeon, Salmon, Trout", ItemID.LEAPING_STURGEON, FISHING_SPOT_1542 ), - ANGLERFISH("Anglerfish", "anglerfish", + ANGLERFISH("Anglerfish", ItemID.RAW_ANGLERFISH, FISHING_SPOT_6825 ), - MINNOW("Minnow", "minnow", + MINNOW("Minnow", ItemID.MINNOW, FISHING_SPOT_7730, FISHING_SPOT_7731, FISHING_SPOT_7732, FISHING_SPOT_7733, FISHING_SPOT_7734 ); @@ -91,7 +93,7 @@ public enum FishingSpot private static final Map fishingSpots = new HashMap<>(); private final String name; - private final String image; + private final int itemSpriteId; private final int[] spots; static @@ -107,10 +109,10 @@ public enum FishingSpot } } - FishingSpot(String spot, String image, int... spots) + FishingSpot(String spot, int itemSpriteId, int... spots) { this.name = spot; - this.image = image; + this.itemSpriteId = itemSpriteId; this.spots = spots; } @@ -119,9 +121,9 @@ public String getName() return name; } - public String getImage() + public int getItemSpriteId() { - return image; + return itemSpriteId; } public int[] getIds() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotOverlay.java index 26f5c724df2..8f2cc6503ca 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotOverlay.java @@ -28,15 +28,12 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.io.InputStream; import java.util.ArrayList; import java.util.List; -import javax.imageio.ImageIO; import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.NPC; +import net.runelite.api.SpritePixels; import net.runelite.api.queries.NPCQuery; import net.runelite.client.RuneLite; import net.runelite.client.ui.overlay.Overlay; @@ -49,8 +46,6 @@ class FishingSpotOverlay extends Overlay { private static final Logger logger = LoggerFactory.getLogger(FishingSpotOverlay.class); - private final BufferedImage[] imgCache = new BufferedImage[FishingSpot.values().length]; - private final List ids = new ArrayList<>(); private final RuneLite runelite = RuneLite.getRunelite(); @@ -86,10 +81,10 @@ public Dimension render(Graphics2D graphics) Color color = npc.getId() == FishingSpot.FLYING_FISH ? Color.RED : Color.CYAN; if (config.showIcons()) { - BufferedImage fishImage = getFishImage(spot); - if (fishImage != null) + SpritePixels fishSprite = getFishSprite(spot); + if (fishSprite != null) { - OverlayUtil.renderActorOverlayImage(graphics, npc, fishImage, color.darker()); + OverlayUtil.renderActorOverlaySprite(graphics, npc, fishSprite, color.darker()); } } else @@ -102,28 +97,9 @@ public Dimension render(Graphics2D graphics) return null; } - private BufferedImage getFishImage(FishingSpot spot) + private SpritePixels getFishSprite(FishingSpot spot) { - int fishIdx = spot.ordinal(); - BufferedImage fishImage = null; - - if (imgCache[fishIdx] != null) - { - return imgCache[fishIdx]; - } - - try - { - InputStream in = FishingSpotOverlay.class.getResourceAsStream(spot.getImage() + ".png"); - fishImage = ImageIO.read(in); - imgCache[fishIdx] = fishImage; - } - catch (IOException e) - { - logger.warn("Error Loading fish icon", e); - } - - return fishImage; + return client.createItemSprite(spot.getItemSpriteId(), 5, 1, SpritePixels.DEFAULT_SHADOW_COLOR, 0, false); } public void updateConfig() diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/anglerfish.png b/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/anglerfish.png deleted file mode 100644 index dfa4666ebf8..00000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/anglerfish.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/barb.png b/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/barb.png deleted file mode 100644 index 1fb97cde710..00000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/barb.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/lobster.png b/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/lobster.png deleted file mode 100644 index 8c76b053c05..00000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/lobster.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/minnow.png b/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/minnow.png deleted file mode 100644 index 7829433de1a..00000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/minnow.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/monkfish.png b/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/monkfish.png deleted file mode 100644 index 0b0f0faf284..00000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/monkfish.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/salmon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/salmon.png deleted file mode 100644 index d59b4494c7a..00000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/salmon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/shark.png b/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/shark.png deleted file mode 100644 index 2624fb4e456..00000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/shark.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/shrimp.png b/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/shrimp.png deleted file mode 100644 index 54cf89512bd..00000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/fishing/shrimp.png and /dev/null differ