From 1017af091e5e00fecb315cb5c71ae04dd98c35d3 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 22 May 2023 20:15:46 +0200 Subject: code cleanup --- .../skyhanni/features/fishing/OdgerWaypoint.kt | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/fishing') diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/OdgerWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/OdgerWaypoint.kt index a41a174a0..0e8a61f87 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/OdgerWaypoint.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/OdgerWaypoint.kt @@ -10,7 +10,6 @@ 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 @@ -25,18 +24,13 @@ class OdgerWaypoint { @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { if (event.phase != TickEvent.Phase.START) return - - if (!LorenzUtils.inSkyBlock) return - if (!SkyHanniMod.feature.fishing.odgerLocation) return + if (!isEnabled()) return tick++ - if (tick % 10 == 0) { hasLavaRodInHand = isLavaFishingRod() - trophyFishInInv = Minecraft.getMinecraft().thePlayer.inventoryContainer.inventorySlots - .mapNotNull { it?.stack } - .map { it.getLore() } + trophyFishInInv = InventoryUtils.getItemsInOwnInventory().map { it.getLore() } .any { it.isNotEmpty() && it.last().endsWith("TROPHY FISH") } } } @@ -51,13 +45,14 @@ class OdgerWaypoint { @SubscribeEvent fun onRenderWorld(event: RenderWorldLastEvent) { - if (!LorenzUtils.inSkyBlock) return - if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return - if (!SkyHanniMod.feature.fishing.odgerLocation) return + if (!isEnabled()) return if (hasLavaRodInHand) return if (!trophyFishInInv) return event.drawWaypointFilled(location, LorenzColor.WHITE.toColor()) event.drawDynamicText(location, "Odger", 1.5) } + + fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.fishing.odgerLocation && + LorenzUtils.skyBlockIsland == IslandType.CRIMSON_ISLE } \ No newline at end of file -- cgit