From c39ab7897416ec32941a8c5fb08352c78208e5f0 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 22 Jan 2023 19:58:49 +0100 Subject: Add odger waypoint. --- .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 1 + .../skyhanni/config/features/Fishing.java | 6 +++ .../skyhanni/features/fishing/OdgerWaypoint.kt | 62 ++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/fishing/OdgerWaypoint.kt (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index aaca16d2d..af12bb09c 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -173,6 +173,7 @@ public class SkyHanniMod { loadModule(new BarnFishingTimer()); loadModule(new CrimsonIsleReputationHelper(this)); loadModule(new SharkFishCounter()); + loadModule(new OdgerWaypoint()); Commands.INSTANCE.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java b/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java index 00fe136eb..325dd1333 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Fishing.java @@ -31,6 +31,12 @@ public class Fishing { @ConfigAccordionId(id = 0) public boolean trophyFishSilverHider = false; + @Expose + @ConfigOption(name = "Odger Waypoint", desc = "Show the Odger waypoint when trophy fishes are in the inventory and no lava rod in hand.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean odgerLocation = true; + @ConfigOption(name = "Thunder Spark", desc = "") @ConfigEditorAccordion(id = 1) public boolean thunderSpark = false; diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/OdgerWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/OdgerWaypoint.kt new file mode 100644 index 000000000..4af5e0fbe --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/OdgerWaypoint.kt @@ -0,0 +1,62 @@ +package at.hannibal2.skyhanni.features.fishing + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import net.minecraft.client.Minecraft +import net.minecraftforge.client.event.RenderWorldLastEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent + +class OdgerWaypoint { + private val location = LorenzVec(-373, 207, -808) + + private var tick = 0 + private var hasLavaRodInHand = false + private var trophyFishInInv = false + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (event.phase != TickEvent.Phase.START) return + + if (!LorenzUtils.inSkyBlock) return + if (!SkyHanniMod.feature.fishing.odgerLocation) return + + tick++ + + if (tick % 10 == 0) { + hasLavaRodInHand = isLavaFishingRod() + + trophyFishInInv = Minecraft.getMinecraft().thePlayer.inventoryContainer.inventorySlots + .mapNotNull { it?.stack } + .map { it.getLore() } + .any { it.last().endsWith("TROPHY FISH") } + } + } + + private fun isLavaFishingRod(): Boolean { + val heldItem = Minecraft.getMinecraft().thePlayer.heldItem ?: return false + val isRod = heldItem.name?.contains("Rod") ?: return false + if (!isRod) return false + + return heldItem.getLore().any { it.contains("Lava Rod") } + } + + @SubscribeEvent + fun onRenderWorld(event: RenderWorldLastEvent) { + if (!LorenzUtils.inSkyBlock) return + if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return + if (!SkyHanniMod.feature.fishing.odgerLocation) return + if (hasLavaRodInHand) return + if (!trophyFishInInv) return + + event.drawWaypointFilled(location, LorenzColor.WHITE.toColor()) + event.drawDynamicText(location, "Odger", 1.5) + } +} \ No newline at end of file -- cgit