aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-05-22 20:15:46 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-05-22 20:15:46 +0200
commit1017af091e5e00fecb315cb5c71ae04dd98c35d3 (patch)
tree131a33da8b98db081a7c31b850a2051db75973ac
parenteb68a59b4670d548fa4c0a493ad1d19029faeb5b (diff)
downloadskyhanni-1017af091e5e00fecb315cb5c71ae04dd98c35d3.tar.gz
skyhanni-1017af091e5e00fecb315cb5c71ae04dd98c35d3.tar.bz2
skyhanni-1017af091e5e00fecb315cb5c71ae04dd98c35d3.zip
code cleanup
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/OdgerWaypoint.kt17
1 files changed, 6 insertions, 11 deletions
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