diff options
5 files changed, 54 insertions, 36 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java index 27527ced3..6bc3da6f3 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java @@ -332,13 +332,6 @@ public class InventoryConfig { public boolean itemStars = false; @Expose - @ConfigOption(name = "Highlight Depleted Bonzo's Masks", - desc = "Highlights used Bonzo's Masks with a background.") - @ConfigEditorBoolean - @FeatureToggle - public boolean highlightDepletedBonzosMasks = false; - - @Expose @ConfigOption(name = "Missing Tasks", desc = "Highlight missing tasks in the SkyBlock Level Guide inventory.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/ItemAbilityConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/ItemAbilityConfig.java index 4b245db4d..f32a39f2f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/ItemAbilityConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/ItemAbilityConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.*; @@ -36,4 +37,34 @@ public class ItemAbilityConfig { @ConfigEditorColour @ConfigAccordionId(id = 1) public String fireVeilWandDisplayColor = "0:245:255:85:85"; + + @ConfigOption(name = "Chicken Head", desc = "") + @Accordion + @Expose + public ChickenHeadConfig chickenHead = new ChickenHeadConfig(); + + public static class ChickenHeadConfig { + + @Expose + @ConfigOption(name = "Checken Head Timer", desc = "Show the cooldown until the next time you can lay an egg with the Chicken Head.") + @ConfigEditorBoolean + @FeatureToggle + public boolean displayTimer = false; + + @Expose + public Position position = new Position(-372, 73, false, true); + + @Expose + @ConfigOption(name = "Hide Chat", desc = "Hide the 'You laid an egg!' chat message.") + @ConfigEditorBoolean + @FeatureToggle + public boolean hideChat = true; + } + + @Expose + @ConfigOption(name = "Depleted Bonzo's Masks", + desc = "Highlights used Bonzo's Masks and Spirit Masks with a background.") + @ConfigEditorBoolean + @FeatureToggle + public boolean depletedBonzosMasks = false; } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index c597abb6e..e994fb21a 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -226,28 +226,6 @@ public class MiscConfig { public boolean hideCloseRedstoneparticles = true; @Expose - @ConfigOption(name = "Chicken Head Timer", desc = "") - @ConfigEditorAccordion(id = 10) - public boolean chickenHeadTimer = false; - - @Expose - @ConfigOption(name = "Enabled", desc = "Show the cooldown until the next time you can lay an egg with the Chicken Head.") - @ConfigEditorBoolean - @ConfigAccordionId(id = 10) - @FeatureToggle - public boolean chickenHeadTimerDisplay = false; - - @Expose - @ConfigOption(name = "Hide Chat", desc = "Hide the 'You laid an egg!' chat message.") - @ConfigEditorBoolean - @ConfigAccordionId(id = 10) - @FeatureToggle - public boolean chickenHeadTimerHideChat = true; - - @Expose - public Position chickenHeadTimerPosition = new Position(-372, 73, false, true); - - @Expose @ConfigOption(name = "Estimated Item Value", desc = "(Prices for Enchantments, Reforge Stones, Gemstones, Drill Parts and more)") @ConfigEditorAccordion(id = 11) public boolean estimatedItemValue = false; 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 |