diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
21 files changed, 287 insertions, 102 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt b/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt index 8afd758a7..dfa187c0d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chroma/ChromaShader.kt @@ -1,17 +1,22 @@ package at.hannibal2.skyhanni.features.chroma import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.chroma.ChromaConfig.Direction import at.hannibal2.skyhanni.data.MinecraftData import at.hannibal2.skyhanni.mixins.transformers.AccessorMinecraft +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.shader.Shader import at.hannibal2.skyhanni.utils.shader.Uniform import net.minecraft.client.Minecraft +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent /** * Modified from SkyblockAddons * * Credit: [ChromaShader.java](https://github.com/BiscuitDevelopment/SkyblockAddons/blob/main/src/main/java/codes/biscuit/skyblockaddons/shader/chroma/ChromaShader.java) */ + object ChromaShader : Shader("chroma", "chroma") { val config get() = SkyHanniMod.feature.chroma val INSTANCE: ChromaShader @@ -26,8 +31,8 @@ object ChromaShader : Shader("chroma", "chroma") { (MinecraftData.totalTicks / 2) + (Minecraft.getMinecraft() as AccessorMinecraft).timer.renderPartialTicks ticks = when (config.chromaDirection) { - 0, 2 -> ticks - 1, 3 -> -ticks + Direction.FORWARD_RIGHT, Direction.BACKWARD_RIGHT -> ticks + Direction.FORWARD_LEFT, Direction.BACKWARD_LEFT -> -ticks else -> ticks } @@ -39,10 +44,17 @@ object ChromaShader : Shader("chroma", "chroma") { } registerUniform(Uniform.UniformType.BOOL, "forwardDirection") { when (config.chromaDirection) { - 0, 1 -> true - 2, 3 -> false + Direction.FORWARD_RIGHT, Direction.FORWARD_LEFT -> true + Direction.BACKWARD_RIGHT, Direction.BACKWARD_LEFT -> false else -> true } } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.transform(14, "config.chromaDirection") { element -> + ConfigUtils.migrateIntToEnum(element, Direction::class.java) + } + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt index daf5caddd..b7d3718c7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt @@ -2,10 +2,14 @@ package at.hannibal2.skyhanni.features.combat import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.combat.BestiaryConfig +import at.hannibal2.skyhanni.config.features.combat.BestiaryConfig.DisplayTypeEntry +import at.hannibal2.skyhanni.config.features.combat.BestiaryConfig.NumberFormatEntry import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzColor @@ -99,6 +103,12 @@ object BestiaryData { @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.bestiaryData", "combat.bestiary") + event.transform(14, "combat.bestiary.numberFormat") { element -> + ConfigUtils.migrateIntToEnum(element, NumberFormatEntry::class.java) + } + event.transform(14, "combat.bestiary.displayType") { element -> + ConfigUtils.migrateIntToEnum(element, DisplayTypeEntry::class.java) + } } private fun update() { @@ -209,14 +219,14 @@ object BestiaryData { private fun sortMobList(): MutableList<BestiaryMob> { val sortedMobList = when (config.displayType) { - 0 -> mobList.sortedBy { it.percentToMax() } - 1 -> mobList.sortedBy { it.percentToTier() } - 2 -> mobList.sortedBy { it.totalKills } - 3 -> mobList.sortedByDescending { it.totalKills } - 4 -> mobList.sortedBy { it.killNeededToMax() } - 5 -> mobList.sortedByDescending { it.killNeededToMax() } - 6 -> mobList.sortedBy { it.killNeededToNextLevel() } - 7 -> mobList.sortedByDescending { it.killNeededToNextLevel() } + DisplayTypeEntry.GLOBAL_MAX -> mobList.sortedBy { it.percentToMax() } + DisplayTypeEntry.GLOBAL_NEXT -> mobList.sortedBy { it.percentToTier() } + DisplayTypeEntry.LOWEST_TOTAL -> mobList.sortedBy { it.totalKills } + DisplayTypeEntry.HIGHEST_TOTAL -> mobList.sortedByDescending { it.totalKills } + DisplayTypeEntry.LOWEST_MAX -> mobList.sortedBy { it.killNeededToMax() } + DisplayTypeEntry.HIGHEST_MAX -> mobList.sortedByDescending { it.killNeededToMax() } + DisplayTypeEntry.LOWEST_NEXT -> mobList.sortedBy { it.killNeededToNextLevel() } + DisplayTypeEntry.HIGHEST_NEXT -> mobList.sortedByDescending { it.killNeededToNextLevel() } else -> mobList.sortedBy { it.totalKills } }.toMutableList() return sortedMobList @@ -270,34 +280,34 @@ object BestiaryData { "§c§lMAXED! §7(§b${mob.actualRealTotalKill.formatNumber()}§7 kills)" } else { when (displayType) { - 0, 1 -> { + DisplayTypeEntry.GLOBAL_MAX, DisplayTypeEntry.GLOBAL_NEXT -> { val currentKill = when (displayType) { - 0 -> mob.totalKills - 1 -> mob.currentKillToNextLevel + DisplayTypeEntry.GLOBAL_MAX -> mob.totalKills + DisplayTypeEntry.GLOBAL_NEXT -> mob.currentKillToNextLevel else -> 0 } val killNeeded = when (displayType) { - 0 -> mob.killToMax - 1 -> mob.killNeededForNextLevel + DisplayTypeEntry.GLOBAL_MAX -> mob.killToMax + DisplayTypeEntry.GLOBAL_NEXT -> mob.killNeededForNextLevel else -> 0 } "§7(§b${currentKill.formatNumber()}§7/§b${killNeeded.formatNumber()}§7) §a${ ((currentKill.toDouble() / killNeeded) * 100).roundToPrecision( 2 ) - }§6% ${if (displayType == 1) "§ato level ${mob.getNextLevel()}" else ""}" + }§6% ${if (displayType == DisplayTypeEntry.GLOBAL_NEXT) "§ato level ${mob.getNextLevel()}" else ""}" } - 2, 3 -> { + DisplayTypeEntry.LOWEST_TOTAL, DisplayTypeEntry.HIGHEST_TOTAL -> { "§6${mob.totalKills.formatNumber()} §7total kills" } - 4, 5 -> { + DisplayTypeEntry.LOWEST_MAX, DisplayTypeEntry.HIGHEST_MAX -> { "§6${mob.killNeededToMax().formatNumber()} §7kills needed" } - 6, 7 -> { + DisplayTypeEntry.LOWEST_NEXT, DisplayTypeEntry.HIGHEST_NEXT -> { "§6${mob.killNeededToNextLevel().formatNumber()} §7kills needed" } @@ -310,17 +320,19 @@ object BestiaryData { private fun addButtons(newDisplay: MutableList<List<Any>>) { newDisplay.addButton( prefix = "§7Number Format: ", - getName = FormatType.entries[config.numberFormat].type, + getName = FormatType.entries[config.numberFormat.ordinal].type, // todo: avoid ordinal onChange = { - config.numberFormat = (config.numberFormat + 1) % 2 + // todo: avoid ordinal + config.numberFormat = BestiaryConfig.NumberFormatEntry.entries[(config.numberFormat.ordinal + 1) % 2] update() }) newDisplay.addButton( prefix = "§7Display Type: ", - getName = DisplayType.entries[config.displayType].type, + getName = DisplayType.entries[config.displayType.ordinal].type, // todo: avoid ordinal onChange = { - config.displayType = (config.displayType + 1) % 8 + // todo: avoid ordinal + config.displayType = DisplayTypeEntry.entries[(config.displayType.ordinal + 1) % 8] update() }) @@ -417,8 +429,8 @@ object BestiaryData { } private fun Long.formatNumber(): String = when (config.numberFormat) { - 0 -> NumberUtil.format(this) - 1 -> this.addSeparators() + BestiaryConfig.NumberFormatEntry.SHORT -> NumberUtil.format(this) + BestiaryConfig.NumberFormatEntry.LONG -> this.addSeparators() else -> "0" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/BossType.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/BossType.kt index 045eaaa78..11f16ae7f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/BossType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/BossType.kt @@ -1,8 +1,8 @@ package at.hannibal2.skyhanni.features.combat.damageindicator -import at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry +import at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory -typealias Type = DamageIndicatorBossEntry +typealias Type = BossCategory enum class BossType( val fullName: String, diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt index 42fee548c..6228ff5aa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt @@ -2,7 +2,8 @@ package at.hannibal2.skyhanni.features.combat.damageindicator import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator -import at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry +import at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory +import at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.NameVisibility import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.events.BossHealthChangeEvent import at.hannibal2.skyhanni.events.DamageIndicatorDeathEvent @@ -196,9 +197,9 @@ class DamageIndicatorManager { } var bossName = when (config.bossName) { - 0 -> "" - 1 -> data.bossType.fullName - 2 -> data.bossType.shortName + NameVisibility.HIDDEN -> "" + NameVisibility.FULL_NAME -> data.bossType.fullName + NameVisibility.SHORT_NAME -> data.bossType.shortName else -> data.bossType.fullName } @@ -873,7 +874,10 @@ class DamageIndicatorManager { event.move(3, "slayer.endermanPhaseDisplay", "slayer.endermen.phaseDisplay") event.move(3, "slayer.blazePhaseDisplay", "slayer.blazes.phaseDisplay") event.transform(11, "combat.damageIndicator.bossesToShow") { element -> - ConfigUtils.migrateIntArrayListToEnumArrayList(element, DamageIndicatorBossEntry::class.java) + ConfigUtils.migrateIntArrayListToEnumArrayList(element, BossCategory::class.java) + } + event.transform(14, "combat.damageIndicator.bossName") { element -> + ConfigUtils.migrateIntToEnum(element, NameVisibility::class.java) } } 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 b1abdc2d5..cd3af1f77 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 @@ -2,9 +2,11 @@ package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.fishing.trophyfishing.ChatMessagesConfig.DesignFormat 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.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut import at.hannibal2.skyhanni.utils.LorenzUtils.sumAllValues @@ -42,7 +44,7 @@ class TrophyFishMessages { val amount = trophyFishCounts.addOrPut(rarity, 1) event.blockedReason = "trophy_fish" - if (config.enabled && config.design == 0 && amount == 1) { + if (config.enabled && config.design == DesignFormat.STYLE_1 && amount == 1) { LorenzUtils.chat("§6§lTROPHY FISH! §c§lFIRST §r$displayRarity $displayName", prefix = false) return } @@ -57,8 +59,8 @@ class TrophyFishMessages { val component = ChatComponentText( if (config.enabled) { "§6§lTROPHY FISH! " + when (config.design) { - 0 -> "§7$amount. §r$displayRarity $displayName$totalText" - 1 -> "§bYou caught a $displayName $displayRarity§b. §7(${amount.addSeparators()})$totalText" + DesignFormat.STYLE_1 -> "§7$amount. §r$displayRarity $displayName$totalText" + DesignFormat.STYLE_2 -> "§bYou caught a $displayName $displayRarity§b. §7(${amount.addSeparators()})$totalText" else -> "§bYou caught your ${amount.addSeparators()}${amount.ordinal()} $displayRarity $displayName§b.$totalText" } } else event.message @@ -84,5 +86,8 @@ class TrophyFishMessages { event.move(2, "fishing.trophyFishDuplicateHider", "fishing.trophyFishing.chatMessages.duplicateHider") event.move(2, "fishing.trophyFishBronzeHider", "fishing.trophyFishing.chatMessages.bronzeHider") event.move(2, "fishing.trophyFishSilverHider", "fishing.trophyFishing.chatMessages.silverHider") + event.transform(14, "fishing.trophyFishing.chatMessages.design") { element -> + ConfigUtils.migrateIntToEnum(element, DesignFormat::class.java) + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index f86c3d23c..8faf2a5b6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigFileType import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.garden.NextJacobContestConfig.ShareContestsEntry import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -11,6 +12,7 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon import at.hannibal2.skyhanni.utils.APIUtil +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -238,7 +240,7 @@ object GardenNextJacobContest { fun shareContestConfirmed(array: Array<String>) { if (array.size == 1) { if (array[0] == "enable") { - config.shareAutomatically = 1 + config.shareAutomatically = ShareContestsEntry.AUTO SkyHanniMod.feature.storage.contestSendingAsked = true LorenzUtils.chat("§2Enabled automatic sharing of future contests!") } @@ -247,7 +249,7 @@ object GardenNextJacobContest { if (contests.size == maxContestsPerYear) { sendContests() } - if (!SkyHanniMod.feature.storage.contestSendingAsked && config.shareAutomatically == 0) { + if (!SkyHanniMod.feature.storage.contestSendingAsked && config.shareAutomatically == ShareContestsEntry.ASK) { LorenzUtils.clickableChat( "§2Click here to automatically share future contests!", "shsendcontests enable" @@ -451,9 +453,10 @@ object GardenNextJacobContest { && (GardenAPI.inGarden() || config.everywhere) private fun isFetchEnabled() = isEnabled() && config.fetchAutomatically - private fun isSendEnabled() = isFetchEnabled() && config.shareAutomatically != 2 // 2 = Disabled + private fun isSendEnabled() = + isFetchEnabled() && config.shareAutomatically != ShareContestsEntry.DISABLED private fun askToSendContests() = - config.shareAutomatically == 0 // 0 = Ask, 1 = Send (Only call if isSendEnabled()) + config.shareAutomatically == ShareContestsEntry.ASK // (Only call if isSendEnabled()) private fun fetchContestsIfAble() { if (isFetchingContests || contests.size == maxContestsPerYear || !isFetchEnabled()) return @@ -564,5 +567,8 @@ object GardenNextJacobContest { event.move(3, "garden.nextJacobContestWarnTime", "garden.nextJacobContests.warnTime") event.move(3, "garden.nextJacobContestWarnPopup", "garden.nextJacobContests.warnPopup") event.move(3, "garden.nextJacobContestPos", "garden.nextJacobContests.pos") + event.transform(14, "garden.nextJacobContests.shareAutomatically") { element -> + ConfigUtils.migrateIntToEnum(element, ShareContestsEntry::class.java) + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt index bebeb71f8..186f3d34f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt @@ -1,10 +1,12 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.garden.TooltipTweaksConfig.CropTooltipFortuneEntry import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.garden.FarmingFortuneDisplay.Companion.getAbilityFortune import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld @@ -79,8 +81,8 @@ class ToolTooltipTweaks { val cropString = if (hiddenFortune != 0.0) " §6[+${hiddenFortune.roundToInt()}]" else "" val fortuneLine = when (config.cropTooltipFortune) { - 0 -> "§7Farming Fortune: §a+${displayedFortune.formatStat()}$ffdString$reforgeString" - 1 -> "§7Farming Fortune: §a+${displayedFortune.formatStat()}$ffdString$reforgeString$cropString" + CropTooltipFortuneEntry.DEFAULT -> "§7Farming Fortune: §a+${displayedFortune.formatStat()}$ffdString$reforgeString" + CropTooltipFortuneEntry.SHOW -> "§7Farming Fortune: §a+${displayedFortune.formatStat()}$ffdString$reforgeString$cropString" else -> "§7Farming Fortune: §a+${totalFortune.formatStat()}$ffdString$reforgeString$cropString" } iterator.set(fortuneLine) @@ -158,5 +160,8 @@ class ToolTooltipTweaks { event.move(3, "garden.compactToolTooltips", "garden.tooltipTweak.compactToolTooltips") event.move(3, "garden.fortuneTooltipKeybind", "garden.tooltipTweak.fortuneTooltipKeybind") event.move(3, "garden.cropTooltipFortune", "garden.tooltipTweak.cropTooltipFortune") + event.transform(14, "garden.tooltipTweak.cropTooltipFortune") { element -> + ConfigUtils.migrateIntToEnum(element, CropTooltipFortuneEntry::class.java) + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index 5d14fc142..9e6e83d1f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -1,6 +1,9 @@ package at.hannibal2.skyhanni.features.garden.composter import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.garden.composter.ComposterConfig +import at.hannibal2.skyhanni.config.features.garden.composter.ComposterConfig.OverlayPriceTypeEntry +import at.hannibal2.skyhanni.config.features.garden.composter.ComposterConfig.RetrieveFromEntry import at.hannibal2.skyhanni.data.SackAPI import at.hannibal2.skyhanni.data.SackStatus import at.hannibal2.skyhanni.data.jsonobjects.repo.GardenJson @@ -16,6 +19,7 @@ import at.hannibal2.skyhanni.features.bazaar.BazaarApi import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.composter.ComposterAPI.getLevel import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -443,7 +447,7 @@ object ComposterOverlay { private fun retrieveMaterials(internalName: String, itemName: String, itemsNeeded: Int) { if (itemsNeeded == 0 || internalName == "BIOFUEL") return - if (config.retrieveFrom == 0 && !LorenzUtils.noTradeMode) { + if (config.retrieveFrom == ComposterConfig.RetrieveFromEntry.BAZAAR && !LorenzUtils.noTradeMode) { BazaarApi.searchForBazaarItem(itemName, itemsNeeded) return } @@ -492,7 +496,7 @@ object ComposterOverlay { } private fun getPrice(internalName: String): Double { - val useSellPrice = config.overlayPriceType == 1 + val useSellPrice = config.overlayPriceType == ComposterConfig.OverlayPriceTypeEntry.BUY_ORDER val price = NEUItems.getPrice(internalName, useSellPrice) if (internalName == "BIOFUEL" && price > 20_000) return 20_000.0 @@ -578,5 +582,11 @@ object ComposterOverlay { event.move(3, "garden.composterOverlayOrganicMatterPos", "garden.composters.overlayOrganicMatterPos") event.move(3, "garden.composterOverlayFuelExtrasPos", "garden.composters.overlayFuelExtrasPos") event.move(3, "garden.composterRoundDown", "garden.composters.roundDown") + event.transform(14, "garden.composters.overlayPriceType") { element -> + ConfigUtils.migrateIntToEnum(element, OverlayPriceTypeEntry::class.java) + } + event.transform(14, "garden.composters.retrieveFrom") { element -> + ConfigUtils.migrateIntToEnum(element, RetrieveFromEntry::class.java) + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt index 6190bc27b..2072010c9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.garden.cropmilestones.NextConfig +import at.hannibal2.skyhanni.config.features.garden.cropmilestones.NextConfig.BestTypeEntry import at.hannibal2.skyhanni.data.GardenCropMilestones import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter import at.hannibal2.skyhanni.data.GardenCropMilestones.isMaxed @@ -9,6 +11,7 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.sorted import at.hannibal2.skyhanni.utils.TimeUnit @@ -56,7 +59,7 @@ class GardenBestCropTime { updateTimeTillNextCrop() } - val gardenExp = config.next.bestType == 0 + val gardenExp = config.next.bestType == NextConfig.BestTypeEntry.GARDEN_EXP val sorted = if (gardenExp) { val helpMap = mutableMapOf<CropType, Long>() for ((crop, time) in timeTillNextCrop) { @@ -136,5 +139,8 @@ class GardenBestCropTime { event.move(3, "garden.cropMilestoneShowCurrent", "garden.cropMilestones.next.showCurrent") event.move(3, "garden.cropMilestoneBestCompact", "garden.cropMilestones.next.bestCompact") event.move(3, "garden.cropMilestoneBestHideTitle", "garden.cropMilestones.next.bestHideTitle") + event.transform(14, "garden.cropMilestones.next.bestType") { element -> + ConfigUtils.migrateIntToEnum(element, BestTypeEntry::class.java) + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt index 934a73ef2..6a411e064 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestSpawn.kt @@ -1,8 +1,12 @@ package at.hannibal2.skyhanni.features.garden.pests +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.garden.pests.PestSpawnConfig +import at.hannibal2.skyhanni.config.features.garden.pests.PestSpawnConfig.ChatMessageFormatEntry import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.garden.pests.PestSpawnEvent import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -35,7 +39,7 @@ class PestSpawn { } } - if (blocked && config.chatMessageFormat != 0) { + if (blocked && config.chatMessageFormat != PestSpawnConfig.ChatMessageFormatEntry.HYPIXEL) { event.blockedReason = "pests_spawn" } } @@ -47,11 +51,18 @@ class PestSpawn { LorenzUtils.sendTitle("§aPest Spawn! §e$amount §ain §b$plotName§a!", 7.seconds) } - if (config.chatMessageFormat == 1) { + if (config.chatMessageFormat == PestSpawnConfig.ChatMessageFormatEntry.COMPACT) { LorenzUtils.clickableChat( "§aPest Spawn! §e$amount §ain §b$plotName§a!", "tptoplot $plotName" ) } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.transform(14, "garden.pests.pestSpawn.chatMessageFormat") { element -> + ConfigUtils.migrateIntToEnum(element, ChatMessageFormatEntry::class.java) + } + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 6e24bee4b..86aad2468 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.visitor import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.garden.visitor.VisitorConfig.HighlightMode import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -386,10 +387,10 @@ class GardenVisitorFeatures { @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!GardenAPI.inGarden()) return - if (!config.needs.display && config.highlightStatus == 3) return + if (!config.needs.display && config.highlightStatus == HighlightMode.DISABLED) return if (!event.isMod(10)) return - if (GardenAPI.onBarnPlot && config.highlightStatus != 3) { + if (GardenAPI.onBarnPlot && config.highlightStatus != HighlightMode.DISABLED) { checkVisitorsReady() } } @@ -467,13 +468,13 @@ class GardenVisitorFeatures { } } - if ((config.highlightStatus == 0 || config.highlightStatus == 2) && entity is EntityLivingBase) { + if ((config.highlightStatus == HighlightMode.COLOR || config.highlightStatus == HighlightMode.BOTH) && entity is EntityLivingBase) { val color = visitor.status.color if (color != -1) { RenderLivingEntityHelper.setEntityColor( entity, color - ) { config.highlightStatus == 0 || config.highlightStatus == 2 } + ) { config.highlightStatus == HighlightMode.COLOR || config.highlightStatus == HighlightMode.BOTH } } // Haven't gotten either of the known effected visitors (Vex and Leo) so can't test for sure if (color == -1 || !GardenAPI.inGarden()) RenderLivingEntityHelper.removeEntityColor(entity) @@ -624,6 +625,9 @@ class GardenVisitorFeatures { drops } + event.transform(14, "garden.visitors.highlightStatus") { element -> + ConfigUtils.migrateIntToEnum(element, HighlightMode::class.java) + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt index 55323ef57..c71cf1c86 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt +++ b/ |
