diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt | 14 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/ChickenHeadTimer.kt | 16 |
2 files changed, 23 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt index ba0952451..72c265cc6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.inventory import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old @@ -18,6 +19,7 @@ import kotlin.time.Duration.Companion.seconds */ @OptIn(ExperimentalTime::class) class HighlightBonzoMasks { + private val config get() = SkyHanniMod.feature.itemAbilities val maskTimers = mutableMapOf<String, CooldownTimer>() @@ -33,7 +35,7 @@ class HighlightBonzoMasks { @SubscribeEvent fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { - if (!SkyHanniMod.feature.inventory.highlightDepletedBonzosMasks) return + if (!config.depletedBonzosMasks) return for (slot in event.gui.inventorySlots.inventorySlots) { val item = slot.stack ?: continue val maskType = maskType(item) ?: continue @@ -69,10 +71,16 @@ class HighlightBonzoMasks { maskTimers.clear() } + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "inventory.highlightDepletedBonzosMasks", "itemAbilities.depletedBonzosMasks") + } + companion object { data class CooldownTimer(val timeMark: TimeMark, val duration: Duration) { - val percentComplete: Double get() = - timeMark.elapsedNow().toDouble(DurationUnit.SECONDS) / duration.toDouble(DurationUnit.SECONDS) + val percentComplete: Double + get() = + timeMark.elapsedNow().toDouble(DurationUnit.SECONDS) / duration.toDouble(DurationUnit.SECONDS) val isActive: Boolean get() = timeMark.elapsedNow() < duration diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ChickenHeadTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ChickenHeadTimer.kt index 3b393b624..e5ce90ae8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ChickenHeadTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ChickenHeadTimer.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.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -15,7 +16,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ChickenHeadTimer { private var hasChickenHead = false private var lastTime = 0L - private val config get() = SkyHanniMod.feature.misc + private val config get() = SkyHanniMod.feature.itemAbilities.chickenHead @SubscribeEvent fun onTick(event: LorenzTickEvent) { @@ -38,7 +39,7 @@ class ChickenHeadTimer { if (!hasChickenHead) return if (event.message == "§aYou laid an egg!") { lastTime = System.currentTimeMillis() - if (config.chickenHeadTimerHideChat) { + if (config.hideChat) { event.blockedReason = "chicken_head_timer" } } @@ -60,8 +61,15 @@ class ChickenHeadTimer { "Chicken Head Timer: §b$formatDuration" } - config.chickenHeadTimerPosition.renderString(displayText, posLabel = "Chicken Head Timer") + config.position.renderString(displayText, posLabel = "Chicken Head Timer") } - fun isEnabled() = LorenzUtils.inSkyBlock && config.chickenHeadTimerDisplay + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "misc.chickenHeadTimerHideChat", "itemAbilities.chickenHead.hideChat") + event.move(2, "misc.chickenHeadTimerPosition", "itemAbilities.chickenHead.position") + event.move(2, "misc.chickenHeadTimerDisplay", "itemAbilities.chickenHead.displayTimer") + } + + fun isEnabled() = LorenzUtils.inSkyBlock && config.displayTimer }
\ No newline at end of file |