diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-17 10:37:54 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-17 10:37:54 +0200 |
commit | e55b901cf4368f030dd10519946e54f1129ab78a (patch) | |
tree | 4b9ed42ef108e5d30acfe4dfeb7f0da50324d4e1 /src/main/java/at/hannibal2/skyhanni/features/misc | |
parent | a7b379611090e42bee57d14970f7700b5f6b0158 (diff) | |
download | skyhanni-e55b901cf4368f030dd10519946e54f1129ab78a.tar.gz skyhanni-e55b901cf4368f030dd10519946e54f1129ab78a.tar.bz2 skyhanni-e55b901cf4368f030dd10519946e54f1129ab78a.zip |
migrate frozen treasure tracker and winter time config into event winter
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
3 files changed, 24 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt index 949a326a9..6b33e0b47 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -28,7 +29,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object BestiaryData { - private val config get() = SkyHanniMod.feature.misc.bestiaryData + private val config get() = SkyHanniMod.feature.combat.bestiary private var display = emptyList<List<Any>>() private val mobList = mutableListOf<BestiaryMob>() private val stackList = mutableMapOf<Int, ItemStack>() @@ -95,6 +96,11 @@ object BestiaryData { inInventory = false } + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "misc.bestiaryData", "combat.bestiary") + } + private fun update() { display = drawDisplay() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/FrozenTreasureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/FrozenTreasureTracker.kt index eb99d1674..e80c5b15b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/FrozenTreasureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/FrozenTreasureTracker.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.Storage import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ProfileStorageData @@ -21,7 +22,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.concurrent.fixedRateTimer class FrozenTreasureTracker { - private val config get() = SkyHanniMod.feature.misc.frozenTreasureTracker + private val config get() = SkyHanniMod.feature.event.winter.frozenTreasureTracker private var display = emptyList<List<Any>>() private var estimatedIce = 0L private var lastEstimatedIce = 0L @@ -150,6 +151,11 @@ class FrozenTreasureTracker { config.position.renderStringsAndItems(display, posLabel = "Frozen Treasure Tracker") } + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "misc.frozenTreasureTracker", "event.winter.frozenTreasureTracker") + } + private fun onJerryWorkshop() = LorenzUtils.inIsland(IslandType.WINTER) private fun inGlacialCave() = onJerryWorkshop() && ScoreboardData.sidebarLinesFormatted.contains(" §7⏣ §3Glacial Cave") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt index b8f41204b..0ec010924 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.utils.LorenzUtils @@ -17,6 +18,7 @@ import kotlin.time.Duration.Companion.seconds class TimeFeatures { private val config get() = SkyHanniMod.feature.misc.timeConfigs + private val winterConfig get() = SkyHanniMod.feature.event.winter private val format = SimpleDateFormat("HH:mm:ss") @@ -32,7 +34,7 @@ class TimeFeatures { config.realTimePos.renderString(format.format(System.currentTimeMillis()), posLabel = "Real Time") } - if (config.winterTime && IslandType.WINTER.isInIsland()) { + if (winterConfig.islandCloseTime && IslandType.WINTER.isInIsland()) { val timeTillNextYear = startOfNextYear.getValue().timeUntil() val alreadyInNextYear = timeTillNextYear > 5.days val text = if (alreadyInNextYear) { @@ -40,7 +42,13 @@ class TimeFeatures { } else { "§fJerry's Workshop §ecloses in §b${timeTillNextYear.format()}" } - config.winterTimePos.renderString(text, posLabel = "Winter Time") + winterConfig.islandCloseTimePosition.renderString(text, posLabel = "Winter Time") } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "misc.timeConfigs.winterTime", "event.winter.islandCloseTime") + event.move(2, "misc.timeConfigs.winterTimePos", "event.winter.islandCloseTimePosition") + } }
\ No newline at end of file |