aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt
index 258c06c12..29ac6bf3b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt
@@ -4,21 +4,28 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.ConfigLoadEvent
import at.hannibal2.skyhanni.events.FishingBobberCastEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
+import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.SeaCreatureFishEvent
import at.hannibal2.skyhanni.features.fishing.FishingAPI
import at.hannibal2.skyhanni.features.fishing.SeaCreatureManager
import at.hannibal2.skyhanni.test.command.ErrorManager
+import at.hannibal2.skyhanni.utils.InventoryUtils
+import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzUtils.addButton
import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut
import at.hannibal2.skyhanni.utils.LorenzUtils.sumAllValues
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
+import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.StringUtils.allLettersFirstUppercase
+import at.hannibal2.skyhanni.utils.StringUtils.matches
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker
import at.hannibal2.skyhanni.utils.tracker.TrackerData
import com.google.gson.annotations.Expose
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.time.Duration.Companion.seconds
object SeaCreatureTracker {
@@ -26,6 +33,9 @@ object SeaCreatureTracker {
private val tracker = SkyHanniTracker("Sea Creature Tracker", { Data() }, { it.fishing.seaCreatureTracker })
{ drawDisplay(it) }
+ private val trophyArmorNames by RepoPattern.pattern("fishing.trophyfishing.armor", "(BRONZE|SILVER|GOLD|DIAMOND)_HUNTER_(HELMET|CHESTPLATE|LEGGINGS|BOOTS)")
+ private var trophyFishingCooldown = SimpleTimeMark.farPast()
+ private var isTrophyFishing = false
class Data : TrackerData() {
override fun reset() {
@@ -155,5 +165,19 @@ object SeaCreatureTracker {
tracker.resetCommand(args, "shresetseacreaturetracker")
}
- private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled
+ private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled && !isTrophyFishing
+
+ private fun isWearingTrophyArmor(): Boolean {
+ val armorInternalNames = InventoryUtils.getArmor()
+ return armorInternalNames.all { armorInternal ->
+ trophyArmorNames.matches(armorInternal?.getInternalName()?.asString().toString())
+ }
+ }
+
+ @SubscribeEvent
+ fun onTick (event: LorenzTickEvent) {
+ if (trophyFishingCooldown.passedSince() < 3.seconds) return
+ trophyFishingCooldown = SimpleTimeMark.now()
+ isTrophyFishing = isWearingTrophyArmor()
+ }
}