summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/fishing
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-02-10 00:24:52 +0100
committerGitHub <noreply@github.com>2024-02-10 00:24:52 +0100
commit4559e5ff05e19817a21ae49f1c0d8a97d273f6a1 (patch)
treee72dac91d07fc84bea80548c89e13276caa68b81 /src/main/java/at/hannibal2/skyhanni/features/fishing
parentd3a7cc4ab970b457b7950489da781539e45e0dce (diff)
downloadskyhanni-4559e5ff05e19817a21ae49f1c0d8a97d273f6a1.tar.gz
skyhanni-4559e5ff05e19817a21ae49f1c0d8a97d273f6a1.tar.bz2
skyhanni-4559e5ff05e19817a21ae49f1c0d8a97d273f6a1.zip
Splitting many utils functions from LorenzUtils up into other classes: ChatUtils, CollectionUtils, ConditionalUtils. And code cleanup #978
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/fishing')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/FishingBaitWarnings.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/FishingDetection.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyRarity.kt3
18 files changed, 60 insertions, 31 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt
index 24506a22b..d4b741472 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ChumBucketHider.kt
@@ -4,15 +4,16 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.ConfigLoadEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
+import at.hannibal2.skyhanni.utils.ConditionalUtils
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.onToggle
import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraft.entity.Entity
import net.minecraft.entity.item.EntityArmorStand
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class ChumBucketHider {
+
private val config get() = SkyHanniMod.feature.fishing.chumBucketHider
private val titleEntity = mutableListOf<Entity>()
private val hiddenEntities = mutableListOf<Entity>()
@@ -73,7 +74,7 @@ class ChumBucketHider {
@SubscribeEvent
fun onConfigLoad(event: ConfigLoadEvent) {
- onToggle(config.enabled, config.hideBucket, config.hideOwn) { reset() }
+ ConditionalUtils.onToggle(config.enabled, config.hideBucket, config.hideOwn) { reset() }
}
private fun reset() {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt
index abcf3a234..173f5a0d2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt
@@ -28,6 +28,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.seconds
object FishingAPI {
+
val lavaBlocks = listOf(Blocks.lava, Blocks.flowing_lava)
private val waterBlocks = listOf(Blocks.water, Blocks.flowing_water)
@@ -121,5 +122,4 @@ object FishingAPI {
}
return 1
}
-
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingBaitWarnings.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingBaitWarnings.kt
index 1177ad7e2..348ec0342 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingBaitWarnings.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingBaitWarnings.kt
@@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.features.fishing.FishingAPI.isBait
import at.hannibal2.skyhanni.utils.BlockUtils.getBlockAt
+import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -19,6 +20,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.seconds
class FishingBaitWarnings {
+
private val config get() = SkyHanniMod.feature.fishing.fishingBaitWarnings
private var bobber: EntityFishHook? = null
private var lastBait: String? = null
@@ -76,13 +78,13 @@ class FishingBaitWarnings {
private fun showBaitChangeWarning(before: String, after: String) {
SoundUtils.playClickSound()
LorenzUtils.sendTitle("§eBait changed!", 2.seconds)
- LorenzUtils.chat("Fishing Bait changed: $before -> $after")
+ ChatUtils.chat("Fishing Bait changed: $before -> $after")
}
private fun showNoBaitWarning() {
SoundUtils.playErrorSound()
LorenzUtils.sendTitle("§cNo bait is used!", 2.seconds)
- LorenzUtils.chat("You do not use any fishing baits!")
+ ChatUtils.chat("You do not use any fishing baits!")
}
private fun isEnabled() = LorenzUtils.inSkyBlock && FishingAPI.isFishing() && !LorenzUtils.inKuudraFight
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingDetection.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingDetection.kt
index 38775705d..bbd029100 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingDetection.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingDetection.kt
@@ -16,6 +16,7 @@ import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds
object FishingDetection {
+
var isFishing = false
private var holdingRod = false
private var lastRodCastLocation: LorenzVec? = null
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt
index be076222f..73fe5e23a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt
@@ -13,6 +13,7 @@ import net.minecraftforge.event.entity.EntityJoinWorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class FishingHookDisplay {
+
private val config get() = SkyHanniMod.feature.fishing.fishingHookDisplay
private var armorStand: EntityArmorStand? = null
private val potentionArmorStands = mutableListOf<EntityArmorStand>()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt
index 2b633f0a4..4257d7790 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt
@@ -22,6 +22,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.seconds
class FishingTimer {
+
private val config get() = SkyHanniMod.feature.fishing.barnTimer
private val barnLocation = LorenzVec(108, 89, -252)
@@ -76,7 +77,8 @@ class FishingTimer {
}
}
- private fun countMobs() = EntityUtils.getEntities<EntityArmorStand>().map { entity -> FishingAPI.seaCreatureCount(entity) }.sum()
+ private fun countMobs() =
+ EntityUtils.getEntities<EntityArmorStand>().map { entity -> FishingAPI.seaCreatureCount(entity) }.sum()
private fun isRightLocation(): Boolean {
inHollows = false
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt
index 0d9bbb9c9..325411045 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt
@@ -9,13 +9,13 @@ import at.hannibal2.skyhanni.events.SeaCreatureFishEvent
import at.hannibal2.skyhanni.events.withAlpha
import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
+import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy
import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth
import at.hannibal2.skyhanni.utils.EntityUtils.hasNameTagWith
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
-import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy
import at.hannibal2.skyhanni.utils.LorenzUtils.ignoreDerpy
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SoundUtils
@@ -31,6 +31,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.seconds
class SeaCreatureFeatures {
+
private val config get() = SkyHanniMod.feature.fishing.rareCatches
private var rareSeaCreatures = listOf<EntityLivingBase>()
private var lastRareCatch = SimpleTimeMark.farPast()
@@ -58,7 +59,8 @@ class SeaCreatureFeatures {
if (config.alertOtherCatches && lastRareCatch.passedSince() > 1.seconds) {
val creature = SeaCreatureManager.allFishingMobs[creatureType.nametag]
- LorenzUtils.sendTitle("${creature?.rarity?.chatColorCode ?: "§6"}RARE SEA CREATURE!", 1.5.seconds, 3.6, 7f)
+ val text = "${creature?.rarity?.chatColorCode ?: "§6"}RARE SEA CREATURE!"
+ LorenzUtils.sendTitle(text, 1.5.seconds, 3.6, 7f)
if (config.playSound) SoundUtils.playBeepSound()
}
}
@@ -104,8 +106,9 @@ class SeaCreatureFeatures {
enum class RareSeaCreatureType(
val clazz: Class<out EntityLivingBase>,
val nametag: String,
- vararg val health: Int
+ vararg val health: Int,
) {
+
WATER_HYDRA(EntityZombie::class.java, "Water Hydra", 500_000),
SEA_EMPEROR(EntityGuardian::class.java, "Sea Emperor", 750_000, 800_000),
SEA_EMPEROR_RIDER(EntitySkeleton::class.java, "Sea Emperor", 750_000, 800_000),
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt
index 5843bb97c..bfff1d7be 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt
@@ -62,6 +62,7 @@ class SeaCreatureManager {
}
companion object {
+
private val seaCreatureMap = mutableMapOf<String, SeaCreature>()
var allFishingMobs = mapOf<String, SeaCreature>()
var allVariants = mapOf<String, List<String>>()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt
index 1b1689e1f..72997fc6d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureMessageShortener.kt
@@ -7,6 +7,7 @@ import net.minecraft.util.ChatComponentText
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class SeaCreatureMessageShortener {
+
private val config get() = SkyHanniMod.feature.fishing
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt
index f84a72d53..8f201648b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt
@@ -5,12 +5,14 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.SeaCreatureFishEvent
+import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class SharkFishCounter {
+
private var counter = mutableListOf(0, 0, 0, 0)
private var display = ""
private var hasWaterRodInHand = false
@@ -56,7 +58,7 @@ class SharkFishCounter {
val g = counter[3] // Great White
val total = count.addSeparators()
val funnyComment = funnyComment(count)
- LorenzUtils.chat("You caught $total §f(§a$n §9$b §5$t §6$g§f) §esharks during this fishing contest. $funnyComment")
+ ChatUtils.chat("You caught $total §f(§a$n §9$b §5$t §6$g§f) §esharks during this fishing contest. $funnyComment")
counter = mutableListOf(0, 0, 0, 0)
display = ""
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt
index 97945eb21..e2d1b297e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt
@@ -19,6 +19,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.milliseconds
class ShowFishingItemName {
+
private val config get() = SkyHanniMod.feature.fishing.fishedItemName
private var hasRodInHand = false
private var cache = TimeLimitedCache<EntityItem, Pair<LorenzVec, String>>(750.milliseconds)
@@ -81,5 +82,4 @@ class ShowFishingItemName {
}
fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled
-
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt
index 5a92ae51a..f8e5f8a2f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt
@@ -7,9 +7,10 @@ import at.hannibal2.skyhanni.events.ItemAddEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.features.fishing.FishingAPI
+import at.hannibal2.skyhanni.utils.ChatUtils
+import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.DelayedRun
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.NEUInternalName
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
@@ -31,6 +32,7 @@ import kotlin.time.Duration.Companion.seconds
typealias CategoryName = String
object FishingProfitTracker {
+
val config get() = SkyHanniMod.feature.fishing.fishingProfitTracker
private val coinsChatPattern = ".* CATCH! §r§bYou found §r§6(?<coins>.*) Coins§r§b\\.".toPattern()
@@ -42,6 +44,7 @@ object FishingProfitTracker {
{ it.fishing.fishingProfitTracker }) { drawDisplay(it) }
class Data : ItemTrackerData() {
+
override fun resetItems() {
totalCatchAmount = 0
}
@@ -190,7 +193,7 @@ object FishingProfitTracker {
if (FishingAPI.lastActiveFishingTime.passedSince() > 10.minutes) return
if (!isAllowedItem(internalName)) {
- LorenzUtils.debug("Ignored non-fishing item pickup: $internalName'")
+ ChatUtils.debug("Ignored non-fishing item pickup: $internalName'")
return
}
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 8bfcadde7..34c94d198 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
@@ -9,13 +9,14 @@ 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.CollectionUtils.addAsSingletonList
+import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut
+import at.hannibal2.skyhanni.utils.CollectionUtils.sumAllValues
+import at.hannibal2.skyhanni.utils.ConditionalUtils
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
@@ -33,11 +34,15 @@ 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 val trophyArmorNames by RepoPattern.pattern(
+ "fishing.trophyfishing.armor",
+ "(BRONZE|SILVER|GOLD|DIAMOND)_HUNTER_(HELMET|CHESTPLATE|LEGGINGS|BOOTS)"
+ )
private var lastArmorCheck = SimpleTimeMark.farPast()
private var isTrophyFishing = false
class Data : TrackerData() {
+
override fun reset() {
amount.clear()
}
@@ -143,7 +148,7 @@ object SeaCreatureTracker {
@SubscribeEvent
fun onConfigLoad(event: ConfigLoadEvent) {
- LorenzUtils.onToggle(config.showPercentage) {
+ ConditionalUtils.onToggle(config.showPercentage) {
tracker.update()
}
}
@@ -172,7 +177,7 @@ object SeaCreatureTracker {
}
@SubscribeEvent
- fun onTick (event: LorenzTickEvent) {
+ fun onTick(event: LorenzTickEvent) {
if (lastArmorCheck.passedSince() < 3.seconds) return
lastArmorCheck = SimpleTimeMark.now()
isTrophyFishing = isWearingTrophyArmor()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt
index 99b8240a6..bdd085ac1 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt
@@ -16,6 +16,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class OdgerWaypoint {
+
private val config get() = SkyHanniMod.feature.fishing.trophyFishing
private val location = LorenzVec(-373, 207, -808)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt
index 2775becc7..dcafc6603 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt
@@ -14,6 +14,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import org.lwjgl.input.Keyboard
class TrophyFishFillet {
+
@SubscribeEvent
fun onTooltip(event: LorenzToolTipEvent) {
if (!isEnabled()) return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt
index 6be896fb3..311661ed7 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt
@@ -1,12 +1,12 @@
package at.hannibal2.skyhanni.features.fishing.trophy
import at.hannibal2.skyhanni.data.ProfileStorageData
+import at.hannibal2.skyhanni.data.jsonobjects.repo.TrophyFishJson
+import at.hannibal2.skyhanni.data.jsonobjects.repo.TrophyFishJson.TrophyFishInfo
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.StringUtils.splitLines
-import at.hannibal2.skyhanni.data.jsonobjects.repo.TrophyFishJson
-import at.hannibal2.skyhanni.data.jsonobjects.repo.TrophyFishJson.TrophyFishInfo
import net.minecraft.event.HoverEvent
import net.minecraft.util.ChatComponentText
import net.minecraft.util.ChatStyle
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt
index c152de886..507e3e7bb 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt
@@ -6,10 +6,10 @@ import at.hannibal2.skyhanni.config.features.fishing.trophyfishing.ChatMessagesC
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.fishes
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.getTooltip
+import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut
+import at.hannibal2.skyhanni.utils.CollectionUtils.sumAllValues
import at.hannibal2.skyhanni.utils.ConfigUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
-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.NumberUtil.ordinal
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
@@ -18,6 +18,7 @@ import net.minecraft.util.ChatComponentText
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class TrophyFishMessages {
+
private val trophyFishPattern =
"§6§lTROPHY FISH! §r§bYou caught an? §r(?<displayName>§[0-9a-f](?:§k)?[\\w -]+) §r(?<displayRarity>§[0-9a-f]§l\\w+)§r§b\\.".toPattern()
private val config get() = SkyHanniMod.feature.fishing.trophyFishing.chatMessages
@@ -51,12 +52,15 @@ class TrophyFishMessages {
var edited = original
if (config.enabled) {
- edited = ChatComponentText("§6§lTROPHY FISH! " + when (config.design) {
- DesignFormat.STYLE_1 -> if (amount == 1) "§c§lFIRST §r$displayRarity $displayName"
- else "§7$amount. §r$displayRarity $displayName"
- DesignFormat.STYLE_2 -> "§bYou caught a $displayName $displayRarity§b. §7(${amount.addSeparators()})"
- else -> "§bYou caught your ${amount.addSeparators()}${amount.ordinal()} $displayRarity $displayName§b."
- })
+ edited = ChatComponentText(
+ "§6§lTROPHY FISH! " + when (config.design) {
+ DesignFormat.STYLE_1 -> if (amount == 1) "§c§lFIRST §r$displayRarity $displayName"
+ else "§7$amount. §r$displayRarity $displayName"
+
+ DesignFormat.STYLE_2 -> "§bYou caught a $displayName $displayRarity§b. §7(${amount.addSeparators()})"
+ else -> "§bYou caught your ${amount.addSeparators()}${amount.ordinal()} $displayRarity $displayName§b."
+ }
+ )
}
if (config.totalAmount) {
@@ -79,7 +83,7 @@ class TrophyFishMessages {
private fun shouldBlockTrophyFish(rarity: TrophyRarity, amount: Int) =
config.bronzeHider && rarity == TrophyRarity.BRONZE && amount != 1
- || config.silverHider && rarity == TrophyRarity.SILVER && amount != 1
+ || config.silverHider && rarity == TrophyRarity.SILVER && amount != 1
@SubscribeEvent
fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyRarity.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyRarity.kt
index 7f3ff8524..e376d97f2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyRarity.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyRarity.kt
@@ -11,6 +11,7 @@ enum class TrophyRarity(val formatCode: String) {
val formattedString get() = "$formatCode${name.firstLetterUppercase()}"
companion object {
+
fun getByName(rawName: String) = entries.firstOrNull { rawName.uppercase().endsWith(it.name) }
}
-} \ No newline at end of file
+}