diff options
author | Walker Selby <git@walkerselby.com> | 2023-10-15 12:50:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-15 13:50:14 +0200 |
commit | 0bdfaab9e486f0c6adc576e3a939838ef1827c80 (patch) | |
tree | 9bb2f1bd50b62590220440b94f2cad0fda7f9e9b /src/main/java/at/hannibal2/skyhanni/features | |
parent | 202759b6752741e32c3b2d3e022ea8d71400188f (diff) | |
download | skyhanni-0bdfaab9e486f0c6adc576e3a939838ef1827c80.tar.gz skyhanni-0bdfaab9e486f0c6adc576e3a939838ef1827c80.tar.bz2 skyhanni-0bdfaab9e486f0c6adc576e3a939838ef1827c80.zip |
Internal Change: Config deprecations (#542)
migrate the config, removed id system entirely #542
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
58 files changed, 826 insertions, 298 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt index cbe4d4f56..6772e67cf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchRegex @@ -9,7 +10,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.trimWhiteSpaceAndResets import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ChatFilter { - private val config get() = SkyHanniMod.feature.chat + private val config get() = SkyHanniMod.feature.chat.filterType @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { @@ -348,4 +349,18 @@ class ChatFilter { else -> false } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "chat.hypixelHub", "chat.filterType.hypixelHub") + event.move(3, "chat.empty", "chat.filterType.empty") + event.move(3, "chat.warping", "chat.filterType.warping") + event.move(3, "chat.guildExp", "chat.filterType.guildExp") + event.move(3, "chat.friendJoinLeft", "chat.filterType.friendJoinLeft") + event.move(3, "chat.winterGift", "chat.filterType.winterGift") + event.move(3, "chat.powderMining", "chat.filterType.powderMining") + event.move(3, "chat.killCombo", "chat.filterType.killCombo") + event.move(3, "chat.profileJoin", "chat.filterType.profileJoin") + event.move(3, "chat.others", "chat.filterType.others") + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt index 099d52067..739eaa123 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/WatchdogHider.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.ChatManager import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.LorenzUtils @@ -15,7 +16,7 @@ class WatchdogHider { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (!LorenzUtils.onHypixel || !SkyHanniMod.feature.chat.watchDog) return + if (!LorenzUtils.onHypixel || !SkyHanniMod.feature.chat.filterType.watchDog) return when (event.message) { watchdogStartLine -> { @@ -48,6 +49,11 @@ class WatchdogHider { private const val watchdogAnnouncementLine = "§4[WATCHDOG ANNOUNCEMENT]" private const val watchdogEndLine = "§c" } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "chat.watchDog", "chat.filterType.watchDog") + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt index e63c925df..60ed955a3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.chat.playerchat import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.dungeon.DungeonMilestonesDisplay import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager @@ -10,6 +11,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class PlayerChatModifier { + private val config get() = SkyHanniMod.feature.chat.playerMessage private val patterns = mutableListOf<Regex>() init { @@ -58,7 +60,7 @@ class PlayerChatModifier { private fun cutMessage(input: String): String { var string = input - if (SkyHanniMod.feature.chat.playerRankHider) { + if (config.playerRankHider) { for (pattern in patterns) { string = string.replace(pattern, "§b$1") } @@ -72,7 +74,7 @@ class PlayerChatModifier { } } - if (SkyHanniMod.feature.chat.chatFilter && string.contains("§r§f: ") && PlayerChatFilter.shouldChatFilter(string)) { + if (config.chatFilter && string.contains("§r§f: ") && PlayerChatFilter.shouldChatFilter(string)) { string = string.replace("§r§f: ", "§r§7: ") } @@ -84,4 +86,12 @@ class PlayerChatModifier { return string } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "chat.playerRankHider", "chat.playerMessage.playerRankHider") + event.move(3, "chat.chatFilter", "chat.playerMessage.chatFilter") + } + + } diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt index b8fa406b9..f9f84f9f7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt @@ -455,7 +455,7 @@ class DamageIndicatorManager { entity.setHellionShield(null) } - if (!SkyHanniMod.feature.slayer.blazePhaseDisplay) return "" + if (!SkyHanniMod.feature.slayer.blazes.phaseDisplay) return "" var calcHealth = health val calcMaxHealth: Int @@ -610,7 +610,7 @@ class DamageIndicatorManager { calcHealth.toLong(), calcMaxHealth.toLong() ).getChatColor() + NumberUtil.format(calcHealth) - if (!SkyHanniMod.feature.slayer.endermanPhaseDisplay) { + if (!SkyHanniMod.feature.slayer.endermen.phaseDisplay) { result = "" entityData.namePrefix = "" } @@ -854,6 +854,8 @@ class DamageIndicatorManager { @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "damageIndicator", "combat.damageIndicator") + event.move(3,"slayer.endermanPhaseDisplay", "slayer.endermen.phaseDisplay") + event.move(3, "slayer.blazePhaseDisplay", "slayer.blazes.phaseDisplay") } fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt index 6d0afd651..31e8c611e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.DamageIndicatorFinalBossEvent import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent @@ -18,6 +19,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DungeonCleanEnd { + private val config get() = SkyHanniMod.feature.dungeon.cleanEnd + private var bossDone = false private var chestsSpawned = false private var lastBossId: Int = -1 @@ -25,7 +28,7 @@ class DungeonCleanEnd { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { if (!LorenzUtils.inDungeons) return - if (!SkyHanniMod.feature.dungeon.cleanEndToggle) return + if (!config.toggle) return val message = event.message @@ -36,7 +39,7 @@ class DungeonCleanEnd { private fun shouldBlock(): Boolean { if (!LorenzUtils.inDungeons) return false - if (!SkyHanniMod.feature.dungeon.cleanEndToggle) return false + if (!config.toggle) return false if (!bossDone) return false @@ -63,7 +66,7 @@ class DungeonCleanEnd { @SubscribeEvent fun onEntityHealthUpdate(event: EntityHealthUpdateEvent) { if (!LorenzUtils.inDungeons) return - if (!SkyHanniMod.feature.dungeon.cleanEndToggle) return + if (!config.toggle) return if (bossDone) return if (lastBossId == -1) return if (event.entity.entityId != lastBossId) return @@ -83,7 +86,7 @@ class DungeonCleanEnd { if (entity == Minecraft.getMinecraft().thePlayer) return - if (SkyHanniMod.feature.dungeon.cleanEndF3IgnoreGuardians + if (config.F3IgnoreGuardians && DungeonAPI.isOneOf("F3", "M3") && entity is EntityGuardian && entity.entityId != lastBossId @@ -111,4 +114,11 @@ class DungeonCleanEnd { event.isCanceled = true } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "dungeon.cleanEndToggle", "dungeon.cleanEnd.toggle") + event.move(3, "dungeon.cleanEndF3IgnoreGuardians", "dungeon.cleanEnd.F3IgnoreGuardians") + } + }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt index 7b423af28..ddfd622a7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.DungeonBossRoomEnterEvent import at.hannibal2.skyhanni.events.DungeonEnterEvent @@ -64,7 +65,7 @@ class DungeonCopilot { foundKeyOrDoor = true } - if (foundKeyOrDoor && SkyHanniMod.feature.dungeon.messageFilterKeysAndDoors) { + if (foundKeyOrDoor && SkyHanniMod.feature.dungeon.messageFilter.keysAndDoors) { event.blockedReason = "dungeon_keys_and_doors" } @@ -125,13 +126,20 @@ class DungeonCopilot { } private fun isEnabled(): Boolean { - return LorenzUtils.inDungeons && SkyHanniMod.feature.dungeon.copilotEnabled + return LorenzUtils.inDungeons && SkyHanniMod.feature.dungeon.dungeonCopilot.enabled } @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!isEnabled()) return - SkyHanniMod.feature.dungeon.copilotPos.renderString(nextStep, posLabel = "Dungeon Copilot") + SkyHanniMod.feature.dungeon.dungeonCopilot.pos.renderString(nextStep, posLabel = "Dungeon Copilot") + } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "dungeon.messageFilterKeysAndDoors", "dungeon.messageFilter.keysAndDoors") + event.move(3,"dungeon.copilotEnabled", "dungeon.dungeonCopilot.enabled") + event.move(3,"dungeon.copilotPos", "dungeon.dungeonCopilot.pos") } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt index 1428a120a..dd086cf2f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.EntityMovementData import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.EntityMoveEvent @@ -21,6 +22,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DungeonHideItems { + private val config get() = SkyHanniMod.feature.dungeon.objectHider + private val hideParticles = mutableMapOf<EntityArmorStand, Long>() private val movingSkeletonSkulls = mutableMapOf<EntityArmorStand, Long>() @@ -61,18 +64,18 @@ class DungeonHideItems { if (entity is EntityItem) { val stack = entity.entityItem - if (SkyHanniMod.feature.dungeon.hideReviveStone && stack.cleanName() == "Revive Stone") { + if (config.hideReviveStone && stack.cleanName() == "Revive Stone") { event.isCanceled = true } - if (SkyHanniMod.feature.dungeon.hideJournalEntry && stack.cleanName() == "Journal Entry") { + if (config.hideJournalEntry && stack.cleanName() == "Journal Entry") { event.isCanceled = true } } if (entity !is EntityArmorStand) return - if (SkyHanniMod.feature.dungeon.hideSuperboomTNT) { + if (config.hideSuperboomTNT) { if (entity.name.startsWith("§9Superboom TNT")) { event.isCanceled = true } @@ -84,7 +87,7 @@ class DungeonHideItems { } } - if (SkyHanniMod.feature.dungeon.hideBlessing) { + if (config.hideBlessing) { if (entity.name.startsWith("§dBlessing of ")) { event.isCanceled = true } @@ -95,7 +98,7 @@ class DungeonHideItems { } } - if (SkyHanniMod.feature.dungeon.hideReviveStone) { + if (config.hideReviveStone) { if (entity.name == "§6Revive Stone") { event.isCanceled = true } @@ -107,7 +110,7 @@ class DungeonHideItems { } } - if (SkyHanniMod.feature.dungeon.hidePremiumFlesh) { + if (config.hidePremiumFlesh) { if (entity.name == "§9Premium Flesh") { event.isCanceled = true hideParticles[entity] = System.currentTimeMillis() @@ -121,7 +124,7 @@ class DungeonHideItems { if (isSkeletonSkull(entity)) { EntityMovementData.addToTrack(entity) - if (SkyHanniMod.feature.dungeon.hideSkeletonSkull) { + if (config.hideSkeletonSkull) { val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0) if (lastMove + 100 > System.currentTimeMillis()) { return @@ -130,7 +133,7 @@ class DungeonHideItems { } } - if (SkyHanniMod.feature.dungeon.hideHealerOrbs) { + if (config.hideHealerOrbs) { when { entity.name.startsWith("§c§lDAMAGE §e") -> event.isCanceled = true entity.name.startsWith("§c§lABILITY DAMAGE §e") -> event.isCanceled = true @@ -152,7 +155,7 @@ class DungeonHideItems { } } - if (SkyHanniMod.feature.dungeon.hideHealerFairy) { + if (config.hideHealerFairy) { val itemStack = entity.inventory[0] if (itemStack != null && itemStack.getSkullTexture() == healerFairyTexture) { event.isCanceled = true @@ -164,7 +167,7 @@ class DungeonHideItems { @SubscribeEvent fun onReceivePacket(event: ReceiveParticleEvent) { if (!LorenzUtils.inDungeons) return - if (!SkyHanniMod.feature.dungeon.hideSuperboomTNT && !SkyHanniMod.feature.dungeon.hideReviveStone) return + if (!config.hideSuperboomTNT && !config.hideReviveStone) return val packetLocation = event.location for (armorStand in hideParticles.filter { it.value + 100 > System.currentTimeMillis() }.map { it.key }) { @@ -223,4 +226,16 @@ class DungeonHideItems { hideParticles.clear() movingSkeletonSkulls.clear() } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "dungeon.hideSuperboomTNT", "dungeon.objectHider.hideSuperboomTNT") + event.move(3, "dungeon.hideBlessing", "dungeon.objectHider.hideBlessing") + event.move(3, "dungeon.hideReviveStone", "dungeon.objectHider.hideReviveStone") + event.move(3, "dungeon.hidePremiumFlesh", "dungeon.objectHider.hidePremiumFlesh") + event.move(3, "dungeon.hideJournalEntry", "dungeon.objectHider.hideJournalEntry") + event.move(3, "dungeon.hideSkeletonSkull", "dungeon.objectHider.hideSkeletonSkull") + event.move(3, "dungeon.hideHealerOrbs", "dungeon.objectHider.hideHealerOrbs") + event.move(3, "dungeon.hideHealerFairy", "dungeon.objectHider.hideHealerFairy") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt index 2a044adef..776a11a14 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.dungeon import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils @@ -14,7 +15,7 @@ class DungeonLevelColor { @SubscribeEvent fun onItemTooltip(event: ItemTooltipEvent) { if (!LorenzUtils.inSkyBlock) return - if (!SkyHanniMod.feature.dungeon.partyFinderColoredClassLevel) return + if (!SkyHanniMod.feature.dungeon.partyFinder.coloredClassLevel) return if (event.toolTip == null) return val chestName = InventoryUtils.openInventoryName() @@ -34,6 +35,11 @@ class DungeonLevelColor { } } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "dungeon.partyFinderColoredClassLevel", "dungeon.partyFinder.coloredClassLevel") + } } fun getColor(level: Int): String { 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 c841eff38..1bb7cb1d5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.fishing 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.events.LorenzTickEvent @@ -18,7 +19,7 @@ import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class FishingTimer { - private val config get() = SkyHanniMod.feature.fishing + private val config get() = SkyHanniMod.feature.fishing.barnTimer private val barnLocation = LorenzVec(108, 89, -252) private var rightLocation = false @@ -29,7 +30,7 @@ class FishingTimer { @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!LorenzUtils.inSkyBlock) return - if (!config.barnTimer) return + if (!config.enabled) return if (event.repeatSeconds(3)) { rightLocation = isRightLocation() @@ -46,7 +47,7 @@ class FishingTimer { if (currentCount == 0) return val duration = System.currentTimeMillis() - startTime - val barnTimerAlertTime = config.barnTimerAlertTime * 1_000 + val barnTimerAlertTime = config.alertTime * 1_000 if (duration > barnTimerAlertTime && duration < barnTimerAlertTime + 3_000) { SoundUtils.playBeepSound() } @@ -82,9 +83,9 @@ class FishingTimer { private fun isRightLocation(): Boolean { inHollows = false - if (config.barnTimerForStranded && LorenzUtils.isStrandedProfile) return true + if (config.forStranded && LorenzUtils.isStrandedProfile) return true - if (config.barnTimerCrystalHollows && IslandType.CRYSTAL_HOLLOWS.isInIsland()) { + if (config.crystalHollows && IslandType.CRYSTAL_HOLLOWS.isInIsland()) { inHollows = true return true } @@ -99,17 +100,28 @@ class FishingTimer { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock) return - if (!config.barnTimer) return + if (!config.enabled) return if (!rightLocation) return if (currentCount == 0) return val duration = System.currentTimeMillis() - startTime - val barnTimerAlertTime = config.barnTimerAlertTime * 1_000 + val barnTimerAlertTime = config.alertTime * 1_000 val color = if (duration > barnTimerAlertTime) "§c" else "§e" val timeFormat = TimeUtils.formatDuration(duration, biggestUnit = TimeUnit.MINUTE) val name = if (currentCount == 1) "sea creature" else "sea creatures" val text = "$color$timeFormat §8(§e$currentCount §b$name§8)" - config.barnTimerPos.renderString(text, posLabel = "BarnTimer") + config.pos.renderString(text, posLabel = "BarnTimer") + } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "fishing.barnTimer", "fishing.barnTimer.enabled") + event.move(3, "fishing.barnTimerAlertTime", "fishing.barnTimer.alertTime") + event.move(3, "fishing.barnTimerCrystalHollows", "fishing.barnTimer.crystalHollows") + event.move(3, "fishing.barnTimerForStranded", "fishing.barnTimer.forStranded") + event.move(3, "fishing.wormLimitAlert", "fishing.barnTimer.wormLimitAlert") + event.move(3, "fishing.manualResetTimer", "fishing.barnTimer.manualResetTimer") + event.move(3, "fishing.barnTimerPos", "fishing.barnTimer.pos") } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt index c1af6224d..dca61807d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -21,7 +22,7 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AnitaMedalProfit { - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.anitaShop private var display = emptyList<List<Any>>() companion object { @@ -44,7 +45,7 @@ class AnitaMedalProfit { @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { - if (!config.anitaMedalProfitEnabled) return + if (!config.medalProfitEnabled) return if (event.inventoryName != "Anita") return if (GardenVisitorFeatures.inVisitorInventory) return @@ -138,7 +139,7 @@ class AnitaMedalProfit { @SubscribeEvent fun onBackgroundDraw(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { if (inInventory) { - config.anitaMedalProfitPos.renderStringsAndItems( + config.medalProfitPos.renderStringsAndItems( display, extraSpace = 5, itemScale = 1.7, @@ -146,4 +147,10 @@ class AnitaMedalProfit { ) } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"garden.anitaMedalProfitEnabled", "garden.anitaShop.medalProfitEnabled") + event.move(3,"garden.anitaMedalProfitPos", "garden.anitaShop.medalProfitPos") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index 40a603b7c..789c0f352 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.CropAccessoryData import at.hannibal2.skyhanni.data.GardenCropMilestones import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter @@ -80,7 +81,7 @@ class FarmingFortuneDisplay { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!isEnabled()) return - config.farmingFortunePos.renderStringsAndItems(display, posLabel = "True Farming Fortune") + config.pos.renderStringsAndItems(display, posLabel = "True Farming Fortune") } @SubscribeEvent @@ -137,18 +138,18 @@ class FarmingFortuneDisplay { toolCounterFortune + getTurboCropFortune(tool, currentCrop) + getDedicationFortune(tool, currentCrop) } - private fun isEnabled(): Boolean = GardenAPI.inGarden() && config.farmingFortuneDisplay + private fun isEnabled(): Boolean = GardenAPI.inGarden() && config.display companion object { - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.farmingFortunes private val latestFF: MutableMap<CropType, Double>? get() = GardenAPI.config?.latestTrueFarmingFortune private val currentCrop get() = GardenAPI.getCurrentlyFarmedCrop() private var tabFortune: Double = 0.0 private var toolFortune: Double = 0.0 - private val baseFortune: Double get() = if (config.farmingFortuneDropMultiplier) 100.0 else 0.0 + private val baseFortune: Double get() = if (config.dropMultiplier) 100.0 else 0.0 private val upgradeFortune: Double? get() = currentCrop?.getUpgradeLevel()?.let { it * 5.0 } private val accessoryFortune: Double? get() = currentCrop?.let { @@ -281,4 +282,11 @@ class FarmingFortuneDisplay { fun CropType.getLatestTrueFarmingFortune() = latestFF?.get(this) } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"garden.farmingFortuneDisplay", "garden.farmingFortunes.display") + event.move(3,"garden.farmingFortuneDropMultiplier", "garden.farmingFortunes.dropMultiplier") + event.move(3,"garden.farmingFortunePos", "garden.farmingFortunes.pos") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt index da7636cd6..228f133e9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt @@ -12,10 +12,10 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeUtils object GardenCropTimeCommand { - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.moneyPerHours fun onCommand(args: Array<String>) { - if (!config.moneyPerHourDisplay) { + if (!config.display) { LorenzUtils.chat("§c[SkyHanni] §cshcroptime requires 'Show money per Hour' feature to be enabled to work!") return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt index 7e5d3321f..c10292032 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -17,7 +18,7 @@ import kotlin.math.roundToLong import kotlin.time.Duration.Companion.milliseconds class GardenLevelDisplay { - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.gardenLevels private val expToNextLevelPattern = ".* §e(?<nextLevelExp>.*)§6/.*".toPattern() private val overflowPattern = ".*§r §6(?<overflow>.*) XP".toPattern() private val namePattern = "Garden Level (?<currentLevel>.*)".toPattern() @@ -106,8 +107,14 @@ class GardenLevelDisplay { fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!isEnabled()) return - config.gardenLevelPos.renderString(display, posLabel = "Garden Level") + config.pos.renderString(display, posLabel = "Garden Level") } - private fun isEnabled() = GardenAPI.inGarden() && config.gardenLevelDisplay + private fun isEnabled() = GardenAPI.inGarden() && config.display + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "garden.gardenLevelDisplay", "garden.gardenLevels.display") + event.move(3, "garden.gardenLevelPos", "garden.gardenLevels.pos") + } }
\ No newline at end of file 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 1e904ea4f..26dc9e7dd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -98,7 +99,7 @@ object GardenNextJacobContest { @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { - if (!config.nextJacobContestDisplay) return + if (!config.display) return val backItem = event.inventoryItems[48] ?: return val backName = backItem.name @@ -215,7 +216,7 @@ object GardenNextJacobContest { fun shareContestConfirmed(array: Array<String>) { if (array.size == 1) { if (array[0] == "enable") { - config.nextJacobContestsShareAutomatically = 1 + config.shareAutomatically = 1 SkyHanniMod.feature.storage.contestSendingAsked = true LorenzUtils.chat("§e[SkyHanni] §2Enabled automatic sharing of future contests!") } @@ -224,7 +225,7 @@ object GardenNextJacobContest { if (contests.size == maxContestsPerYear) { sendContests() } - if (!SkyHanniMod.feature.storage.contestSendingAsked && config.nextJacobContestsShareAutomatically == 0) { + if (!SkyHanniMod.feature.storage.contestSendingAsked && config.shareAutomatically == 0) { LorenzUtils.clickableChat( "§e[SkyHanni] §2Click here to automatically share future contests!", "shsendcontests enable" @@ -311,8 +312,8 @@ object GardenNextJacobContest { } private fun warn(timeInMillis: Long, crops: List<CropType>) { - if (!config.nextJacobContestWarn) return - if (config.nextJacobContestWarnTime <= timeInMillis / 1000) return + if (!config.warn) return + if (config.warnTime <= timeInMillis / 1000) return if (System.currentTimeMillis() < lastWarningTime) return lastWarningTime = System.currentTimeMillis() + 60_000 * 40 @@ -322,7 +323,7 @@ object GardenNextJacobContest { LorenzUtils.sendTitle("§eFarming Contest!", 5.seconds) SoundUtils.playBeepSound() - if (config.nextJacobContestWarnPopup && !Display.isActive()) { + if (config.warnPopup && !Display.isActive()) { SkyHanniMod.coroutineScope.launch { openPopupWindow( "Farming Contest soon!\n" + @@ -375,15 +376,15 @@ object GardenNextJacobContest { if (!isEnabled()) return if (display.isEmpty()) { - config.nextJacobContestPos.renderStrings(simpleDisplay, posLabel = "Garden Next Jacob Contest") + config.pos.renderStrings(simpleDisplay, posLabel = "Garden Next Jacob Contest") } else { - config.nextJacobContestPos.renderSingleLineWithItems(display, 1.7, posLabel = "Garden Next Jacob Contest") + config.pos.renderSingleLineWithItems(display, 1.7, posLabel = "Garden Next Jacob Contest") } } @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { - if (!config.nextJacobContestDisplay) return + if (!config.display) return if (!inCalendar) return if (display.isNotEmpty()) { @@ -394,13 +395,13 @@ object GardenNextJacobContest { } } - private fun isEnabled() = LorenzUtils.inSkyBlock && config.nextJacobContestDisplay - && (GardenAPI.inGarden() || config.nextJacobContestEverywhere) + private fun isEnabled() = LorenzUtils.inSkyBlock && config.display + && (GardenAPI.inGarden() || config.everywhere) - private fun isFetchEnabled() = isEnabled() && config.nextJacobContestsFetchAutomatically - private fun isSendEnabled() = isFetchEnabled() && config.nextJacobContestsShareAutomatically != 2 // 2 = Disabled + private fun isFetchEnabled() = isEnabled() && config.fetchAutomatically + private fun isSendEnabled() = isFetchEnabled() && config.shareAutomatically != 2 // 2 = Disabled private fun askToSendContests() = - config.nextJacobContestsShareAutomatically == 0 // 0 = Ask, 1 = Send (Only call if isSendEnabled()) + config.shareAutomatically == 0 // 0 = Ask, 1 = Send (Only call if isSendEnabled()) private fun fetchContestsIfAble() { if (isFetchingContests || contests.size == maxContestsPerYear || !isFetchEnabled()) return @@ -494,8 +495,21 @@ object GardenNextJacobContest { null } - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.nextJacobContests private val nextContestCrops = mutableListOf<CropType>() - fun isNextCrop(cropName: CropType) = nextContestCrops.contains(cropName) && config.nextJacobContestOtherGuis + fun isNextCrop(cropName: CropType) = nextContestCrops.contains(cropName) && config.otherGuis + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "garden.nextJacobContestDisplay", "garden.nextJacobContests.display") + event.move(3, "garden.nextJacobContestEverywhere", "garden.nextJacobContests.everywhere") + event.move(3, "garden.nextJacobContestOtherGuis", "garden.nextJacobContests.otherGuis") + event.move(3, "garden.nextJacobContestsFetchAutomatically", "garden.nextJacobContests.fetchAutomatically") + event.move(3, "garden.nextJacobContestsShareAutomatically", "garden.nextJacobContests.shareAutomatically") + event.move(3, "garden.nextJacobContestWarn", "garden.nextJacobContests.warn") + event.move(3, "garden.nextJacobContestWarnTime", "garden.nextJacobContests.warnTime") + event.move(3, "garden.nextJacobContestWarnPopup", "garden.nextJacobContests.warnPopup") + event.move(3, "garden.nextJacobContestPos", "garden.nextJacobContests.pos") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt index b5999eed2..7dc971a23 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent @@ -18,8 +19,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class GardenOptimalSpeed { - private val config get() = SkyHanniMod.feature.garden - private val configCustomSpeed get() = config.optimalSpeedCustom + private val config get() = SkyHanniMod.feature.garden.optimalSpeeds + private val configCustomSpeed get() = config.customSpeed private var currentSpeed = 100 private var optimalSpeed = -1 private val currentSpeedPattern = " Speed: §r§f✦(?<speed>.*)".toPattern() @@ -51,7 +52,7 @@ class GardenOptimalSpeed { val gui = event.gui if (gui !is GuiEditSign) return if (!gui.isRancherSign()) return - config.optimalSpeedSignPosition.renderStringsAndItems( + config.signPosition.renderStringsAndItems( rancherOverlayList, posLabel = "Optimal Speed Rancher Overlay" ) @@ -86,15 +87,15 @@ class GardenOptimalSpeed { val text = "Optimal Speed: §f$optimalSpeed" if (optimalSpeed != currentSpeed) { - config.optimalSpeedPos.renderString("§c$text", posLabel = "Garden Optimal Speed") + config.pos.renderString("§c$text", posLabel = "Garden Optimal Speed") warn() } else { - config.optimalSpeedPos.renderString("§a$text", posLabel = "Garden Optimal Speed") + config.pos.renderString("§a$text", posLabel = "Garden Optimal Speed") } } private fun warn() { - if (!config.optimalSpeedWarning) return + if (!config.warning) return if (!Minecraft.getMinecraft().thePlayer.onGround) return if (GardenAPI.onBarnPlot) return if (System.currentTimeMillis() < lastWarnTime + 20_000) return @@ -106,6 +107,25 @@ class GardenOptimalSpeed { } } - private fun isRancherOverlayEnabled() = GardenAPI.inGarden() && config.optimalSpeedSignEnabled - private fun isEnabled() = GardenAPI.inGarden() && config.optimalSpeedEnabled + private fun isRancherOverlayEnabled() = GardenAPI.inGarden() && config.signEnabled + private fun isEnabled() = GardenAPI.inGarden() && config.enabled + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"garden.optimalSpeedEnabled", "garden.optimalSpeeds.enabled") + event.move(3,"garden.optimalSpeedWarning", "garden.optimalSpeeds.warning") + event.move(3,"garden.optimalSpeedSignEnabled", "garden.optimalSpeeds.signEnabled") + event.move(3,"garden.optimalSpeedSignPosition", "garden.optimalSpeeds.signPosition") + event.move(3,"garden.optimalSpeedPos", "garden.optimalSpeeds.pos") + event.move(3,"garden.optimalSpeedCustom.wheat", "garden.optimalSpeeds.customSpeed.wheat") + event.move(3,"garden.optimalSpeedCustom.carrot", "garden.optimalSpeeds.customSpeed.carrot") + event.move(3,"garden.optimalSpeedCustom.potato", "garden.optimalSpeeds.customSpeed.potato") + event.move(3,"garden.optimalSpeedCustom.netherWart", "garden.optimalSpeeds.customSpeed.netherWart") + event.move(3,"garden.optimalSpeedCustom.pumpkin", "garden.optimalSpeeds.customSpeed.pumpkin") + event.move(3,"garden.optimalSpeedCustom.melon", "garden.optimalSpeeds.customSpeed.melon") + event.move(3,"garden.optimalSpeedCustom.cocoaBeans", "garden.optimalSpeeds.customSpeed.cocoaBeans") + event.move(3,"garden.optimalSpeedCustom.sugarCane", "garden.optimalSpeeds.customSpeed.sugarCane") + event.move(3,"garden.optimalSpeedCustom.cactus", "garden.optimalSpeeds.customSpeed.cactus") + event.move(3,"garden.optimalSpeedCustom.mushroom", "garden.optimalSpeeds.customSpeed.mushroom") + } }
\ No newline at end of file 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 c0cc75670..017cd8580 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.garden.FarmingFortuneDisplay.Companion.getAbilityFortune import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType @@ -18,7 +19,7 @@ import java.text.DecimalFormat import kotlin.math.roundToInt class ToolTooltipTweaks { - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.tooltipTweak private val tooltipFortunePattern = "^§5§o§7Farming Fortune: §a\\+([\\d.]+)(?: §2\\(\\+\\d\\))?(?: §9\\(\\+(\\d+)\\))?$".toRegex() private val counterStartLine = setOf("§5§o§6Logarithmic Counter", "§5§o§6Collection Analysis") @@ -152,4 +153,11 @@ class ToolTooltipTweaks { add("$description${value.formatStat()}") } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"garden.compactToolTooltips", "garden.tooltipTweak.compactToolTooltips") + event.move(3,"garden.fortuneTooltipKeybind", "garden.tooltipTweak.fortuneTooltipKeybind") + event.move(3,"garden.cropTooltipFortune", "garden.tooltipTweak.cropTooltipFortune") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt index dede1d708..0e3540061 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.composter import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.garden.GardenAPI @@ -18,7 +19,7 @@ import kotlin.time.Duration.Companion.seconds import kotlin.time.DurationUnit class ComposterDisplay { - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.composters private val hidden get() = GardenAPI.config private var display = emptyList<List<Any>>() private var composterEmptyTime: Duration? = null @@ -44,7 +45,7 @@ class ComposterDisplay { @SubscribeEvent fun onTabListUpdate(event: TabListUpdateEvent) { - if (!(config.composterDisplayEnabled && GardenAPI.inGarden())) return + if (!(config.displayEnabled && GardenAPI.inGarden())) return readData(event.tabList) @@ -137,21 +138,21 @@ class ComposterDisplay { } private fun sendNotify() { - if (!config.composterNotifyLowEnabled) return + if (!config.notifyLow.enabled) return val hidden = hidden ?: return - if (ComposterAPI.getOrganicMatter() <= config.composterNotifyLowOrganicMatter && System.currentTimeMillis() >= hidden.informedAboutLowMatter) { - if (config.composterNotifyLowTitle) { + if (ComposterAPI.getOrganicMatter() <= config.notifyLow.organicMatter && System.currentTimeMillis() >= hidden.informedAboutLowMatter) { + if (config.notifyLow.title) { LorenzUtils.sendTitle("§cYour Organic Matter is low", 4.seconds) } LorenzUtils.chat("§e[SkyHanni] §cYour Organic Matter is low!") hidden.informedAboutLowMatter = System.currentTimeMillis() + 60_000 * 5 } - if (ComposterAPI.getFuel() <= config.composterNotifyLowFuel && + if (ComposterAPI.getFuel() <= config.notifyLow.fuel && System.currentTimeMillis() >= hidden.informedAboutLowFuel ) { - if (config.composterNotifyLowTitle) { + if (config.notifyLow.title) { LorenzUtils.sendTitle("§cYour Fuel is low", 4.seconds) } LorenzUtils.chat("§e[SkyHanni] §cYour Fuel is low!") @@ -163,8 +164,8 @@ class ComposterDisplay { fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock) return - if (GardenAPI.inGarden() && config.composterDisplayEnabled) { - config.composterDisplayPos.renderStringsAndItems(display, posLabel = "Composter Display") + if (GardenAPI.inGarden() && config.displayEnabled) { + config.displayPos.renderStringsAndItems(display, posLabel = "Composter Display") } checkWarningsAndOutsideGarden() @@ -186,14 +187,14 @@ class ComposterDisplay { } } else "?" - if (!GardenAPI.inGarden() && config.composterDisplayOutsideGarden) { + if (!GardenAPI.inGarden() && config.displayOutsideGarden) { val list = Collections.singletonList(listOf(NEUItems.getItemStack("BUCKET", true), "§b$format")) - config.composterOutsideGardenPos.renderStringsAndItems(list, posLabel = "Composter Outside Garden Display") + config.outsideGardenPos.renderStringsAndItems(list, posLabel = "Composter Outside Garden Display") } } private fun warn(warningMessage: String) { - if (!config.composterWarnAlmostClose) return + if (!config.warnAlmostClose) return val storage = GardenAPI.config ?: return if (LorenzUtils.inDungeons) return @@ -204,4 +205,18 @@ class ComposterDisplay { LorenzUtils.chat("§e[SkyHanni] $warningMessage") LorenzUtils.sendTitle("§eComposter Warning!", 3.seconds) } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "garden.composterDisplayEnabled", "garden.composters.displayEnabled") + event.move(3, "garden.composterDisplayOutsideGarden", "garden.composters.displayOutsideGarden") + event.move(3, "garden.composterWarnAlmostClose", "garden.composters.warnAlmostClose") + event.move(3, "garden.composterDisplayPos", "garden.composters.displayPos") + event.move(3, "garden.composterOutsideGardenPos", "garden.composters.outsideGardenPos") + event.move(3, "garden.composterNotifyLowEnabled", "garden.composters.notifyLow.enabled") + event.move(3, "garden.composterNotifyLowEnabled", "garden.composters.notifyLow.enabled") + event.move(3, "garden.composterNotifyLowTitle", "garden.composters.notifyLow.title") + event.move(3, "garden.composterNotifyLowOrganicMatter", "garden.composters.notifyLow.organicMatter") + event.move(3, "garden.composterNotifyLowFuel", "garden.composters.notifyLow.fuel") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt index 11680d0a0..103f235c5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.composter import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -17,7 +18,7 @@ class ComposterInventoryNumbers { @SubscribeEvent fun onRenderItemTip(event: RenderInventoryItemTipEvent) { if (!GardenAPI.inGarden()) return - if (!SkyHanniMod.feature.garden.composterInventoryNumbers) return + if (!SkyHanniMod.feature.garden.composters.inventoryNumbers) return if (event.inventoryName != "Composter") return @@ -66,4 +67,9 @@ class ComposterInventoryNumbers { } } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "garden.composterInventoryNumbers", "garden.composters.inventoryNumbers") + } }
\ No newline at end of file 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 83da09fd5..aa1fc4d28 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,7 @@ package at.hannibal2.skyhanni.features.garden.composter import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.SackAPI import at.hannibal2.skyhanni.data.model.ComposterUpgrade import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -49,7 +50,7 @@ class ComposterOverlay { private var organicMatterFactors: Map<String, Double> = emptyMap() private var fuelFactors: Map<String, Double> = emptyMap() - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.composters private var organicMatterDisplay = emptyList<List<Any>>() private var fuelExtraDisplay = emptyList<List<Any>>() @@ -119,7 +120,7 @@ class ComposterOverlay { @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!GardenAPI.inGarden()) return - if (!config.composterOverlay) return + if (!config.overlay) return inComposter = event.inventoryName == "Composter" inComposterUpgrades = event.inventoryName == "Composter Upgrades" if (!inComposter && !inComposterUpgrades) return @@ -399,7 +400,7 @@ class ComposterOverlay { val item = NEUItems.getItemStack(internalName) val itemName = item.name!! val price = getPrice(internalName) - val itemsNeeded = if (config.composterRoundDown) { + val itemsNeeded = if (config.roundDown) { val amount = missing / factor if (amount > .75 && amount < 1.0) { 1.0 @@ -444,7 +445,7 @@ class ComposterOverlay { private fun retrieveMaterials(internalName: String, itemName: String, itemsNeeded: Int) { if (itemsNeeded == 0 || internalName == "BIOFUEL") return - if (config.composterOverlayRetrieveFrom == 0 && !LorenzUtils.noTradeMode) { + if (config.retrieveFrom == 0 && !LorenzUtils.noTradeMode) { BazaarApi.searchForBazaarItem(itemName, itemsNeeded) return } @@ -489,7 +490,7 @@ class ComposterOverlay { } private fun getPrice(internalName: String): Double { - val useSellPrice = config.composterOverlayPriceType == 1 + val useSellPrice = config.overlayPriceType == 1 val price = NEUItems.getPrice(internalName, useSellPrice) if (internalName == "BIOFUEL" && price > 20_000) return 20_000.0 @@ -549,11 +550,11 @@ class ComposterOverlay { @SubscribeEvent fun onBackgroundDraw(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { if (inInventory) { - config.composterOverlayOrganicMatterPos.renderStringsAndItems( + config.overlayOrganicMatterPos.renderStringsAndItems( organicMatterDisplay, posLabel = "Composter Overlay Organic Matter" ) - config.composterOverlayFuelExtrasPos.renderStringsAndItems( + config.overlayFuelExtrasPos.renderStringsAndItems( fuelExtraDisplay, posLabel = "Composter Overlay Fuel Extras" ) @@ -565,4 +566,14 @@ class ComposterOverlay { HOUR("Hour", 60 * 60), DAY("Day", 60 * 60 * 24), } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "garden.composterOverlay", "garden.composters.overlay") + event.move(3, "garden.composterOverlayPriceType", "garden.composters.overlayPriceType") + event.move(3, "garden.composterOverlayRetrieveFrom", "garden.composters.retrieveFrom") + event.move(3, "garden.composterOverlayOrganicMatterPos", "garden.composters.overlayOrganicMatterPos") + event.move(3, "garden.composterOverlayFuelExtrasPos", "garden.composters.overlayFuelExtrasPos") + event.move(3, "garden.composterRoundDown", "garden.composters.roundDown") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt index 26b070935..cb74cfde5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.composter import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.InventoryUtils @@ -18,12 +19,12 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class GardenComposterInventoryFeatures { - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.composters @SubscribeEvent fun onTooltip(event: ItemTooltipEvent) { if (!GardenAPI.inGarden()) return - if (!config.composterUpgradePrice) return + if (!config.upgradePrice) return if (InventoryUtils.openInventoryName() != "Composter Upgrades") return @@ -77,7 +78,7 @@ class GardenComposterInventoryFeatures { @SubscribeEvent fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { if (!LorenzUtils.inSkyBlock) return - if (!config.composterHighLightUpgrade) return + if (!config.highlightUpgrade) return if (InventoryUtils.openInventoryName() == "Composter Upgrades") { if (event.gui !is GuiChest) return @@ -95,4 +96,10 @@ class GardenComposterInventoryFeatures { } } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "garden.composterUpgradePrice", "garden.composters.upgradePrice") + event.move(3, "garden.composterHighLightUpgrade", "garden.composters.highlightUpgrade") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt index beb210cdc..e02b358b9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt @@ -106,7 +106,7 @@ class JacobContestFFNeededDisplay { private fun formatFarmingFortune(farmingFortune: Double): String { var ff = farmingFortune - if (!config.farmingFortuneDropMultiplier) { + if (!config.farmingFortunes.dropMultiplier) { ff -= 100 if (ff < 100) { ff = 0.0 diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt index 55d8bd66e..bb4b36d3e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.contest import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiRenderItemEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -24,7 +25,7 @@ class JacobFarmingContestsInventory { private val formatDay = SimpleDateFormat("dd MMMM yyyy", Locale.US) private val formatTime = SimpleDateFormat("HH:mm", Locale.US) - private val config get() = SkyHanniMod.feature.inventory + private val config get() = SkyHanniMod.feature.inventory.jacobFarmingContests // Render the contests a tick delayed to feel smoother private var hideEverything = true @@ -55,7 +56,7 @@ class JacobFarmingContestsInventory { } val time = FarmingContestAPI.getSbTimeFor(name) ?: continue FarmingContestAPI.addContest(time, item) - if (config.jacobFarmingContestRealTime) { + if (config.realTime) { readRealTime(time, slot) } } @@ -73,7 +74,7 @@ class JacobFarmingContestsInventory { fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { if (!LorenzUtils.inSkyBlock) return if (!InventoryUtils.openInventoryName().contains("Your Contests")) return - if (!config.jacobFarmingContestHighlightRewards) return + if (!config.highlightRewards) return // hide green border for a tick if (hideEverything) return @@ -98,7 +99,7 @@ class JacobFarmingContestsInventory { if (!InventoryUtils.openInventoryName().contains("Your Contests")) return val slot = event.slot.slotNumber - if (config.jacobFarmingContestRealTime) { + if (config.realTime) { realTime[slot]?.let { val toolTip = event.toolTip if (toolTip.size > 1) { @@ -111,7 +112,7 @@ class JacobFarmingContestsInventory { @SubscribeEvent fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost) { if (!LorenzUtils.inSkyBlock) return - if (!config.jacobFarmingContestMedalIcon) return + if (!config.medalIcon) return if (!InventoryUtils.openInventoryName().contains("Your Contests")) return val stack = event.stack ?: return @@ -129,7 +130,7 @@ class JacobFarmingContestsInventory { var y = event.y + 1 var scale = .7f - if (finneganContest && config.jacobFarmingContestFinneganIcon) { + if (finneganContest && config.finneganIcon) { stackTip = "§${medalEarned.color}▲" x = event.x + 5 y = event.y - 2 @@ -140,4 +141,12 @@ class JacobFarmingContestsInventory { } } } + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"inventory.jacobFarmingContestHighlightRewards","inventory.jacobFarmingContests.highlightRewards") + event.move(3,"inventory.jacobFarmingContestHideDuplicates","inventory.jacobFarmingContests.hideDuplicates") + event.move(3,"inventory.jacobFarmingContestRealTime","inventory.jacobFarmingContests.realTime") + event.move(3,"inventory.jacobFarmingContestFinneganIcon","inventory.jacobFarmingContests.finneganIcon") + event.move(3,"inventory.jacobFarmingContestMedalIcon","inventory.jacobFarmingContests.medalIcon") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index 12e9c2f80..cd9a3f555 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -49,7 +50,7 @@ object CropMoneyDisplay { } private var display = emptyList<List<Any>>() - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.moneyPerHours private var loaded = false private var ready = false private val cropNames = mutableMapOf<NEUInternalName, CropType>() @@ -65,7 +66,7 @@ object CropMoneyDisplay { if (!isEnabled()) return if (!GardenAPI.hideExtraGuis()) { - config.moneyPerHourPos.renderStringsAndItems(display, posLabel = "Garden Crop Money Per Hour") + config.pos.renderStringsAndItems(display, posLabel = "Garden Crop Money Per Hour") } } @@ -79,7 +80,7 @@ object CropMoneyDisplay { if (!isEnabled()) return if (!event.repeatSeconds(5)) return - if (GardenAPI.getCurrentlyFarmedCrop() == null && !config.moneyPerHourAlwaysOn) return + if (GardenAPI.getCurrentlyFarmedCrop() == null && !config.alwaysOn) return update() } @@ -93,7 +94,7 @@ object CropMoneyDisplay { private fun drawDisplay(): List<List<Any>> { val newDisplay = mutableListOf<List<Any>>() - val title = if (config.moneyPerHourCompact) { + val title = if (config.compact) { "§7Money/Hour:" } else { "§7Money per Hour when selling:" @@ -105,11 +106,11 @@ object CropMoneyDisplay { return newDisplay } - if (GardenAPI.getCurrentlyFarmedCrop() == null && !config.moneyPerHourAlwaysOn) return newDisplay + if (GardenAPI.getCurrentlyFarmedCrop() == null && !config.alwaysOn) return newDisplay newDisplay.addAsSingletonList(fullTitle(title)) - if (!config.cropMilestoneProgress) { + if (!SkyHanniMod.feature.garden.cropMilestones.progress) { newDisplay.addAsSingletonList("§cCrop Milestone Progress Display is disabled!") return newDisplay } @@ -121,7 +122,7 @@ object CropMoneyDisplay { val reforgeName = InventoryUtils.getItemInHand()?.getReforgeName() toolHasBountiful?.put(it, reforgeName == "bountiful") - if (GardenAPI.mushroomCowPet && it != CropType.MUSHROOM && config.moneyPerHourMooshroom) { + if (GardenAPI.mushroomCowPet && it != CropType.MUSHROOM && config.mooshroom) { val redMushroom = "ENCHANTED_RED_MUSHROOM".asInternalName() val brownMushroom = "ENCHANTED_BROWN_MUSHROOM".asInternalName() val (redPrice, brownPrice) = if (LorenzUtils.noTradeMode) { @@ -139,7 +140,7 @@ object CropMoneyDisplay { extraMushroomCowPerkCoins = perSecond * 60 * 60 } - if (InventoryUtils.getItemInHand()?.getInternalName()?.contains("DICER") == true && config.moneyPerHourDicer) { + if (InventoryUtils.getItemInHand()?.getInternalName()?.contains("DICER") == true && config.dicer) { val (dicerDrops, internalName) = when (it) { CropType.MELON -> GardenCropSpeed.latestMelonDicer to "ENCHANTED_MELON".asInternalName() CropType.PUMPKIN -> GardenCropSpeed.latestPumpkinDicer to "ENCHANTED_PUMPKIN".asInternalName() @@ -152,7 +153,7 @@ object CropMoneyDisplay { extraDicerCoins = 60 * 60 * GardenCropSpeed.getRecentBPS() * dicerDrops * price } - if (config.moneyPerHourArmor) { + if (config.armor) { val amountPerHour = it.multiplier * GardenCropSpeed.getRecentBPS() * FarmingArmorDrops.getDropsPerHour(it) extraArmorCoins = amountPerHour * it.specialDropType.asInternalName().getNpcPrice() @@ -179,14 +180,14 @@ object CropMoneyDisplay { number++ val crop = cropNames[internalName]!! val isCurrent = crop == GardenAPI.getCurrentlyFarmedCrop() - if (number > config.moneyPerHourShowOnlyBest && (!config.moneyPerHourShowCurrent || !isCurrent)) continue + if (number > config.showOnlyBest && (!config.showCurrent || !isCurrent)) continue val debug = isCurrent && showCalculation if (debug) { newDisplay.addAsSingletonList("final calculation for: $internalName/$crop") } val list = mutableListOf<Any>() - if (!config.moneyPerHourCompact) { + if (!config.compact) { list.add("§7$number# ") } @@ -197,21 +198,21 @@ object CropMoneyDisplay { list.add(internalName.getItemStack()) } - if (cropNames[internalName] == CropType.WHEAT && config.moneyPerHourMergeSeeds) { + if (cropNames[internalName] == CropType.WHEAT && config.mergeSeeds) { list.add(getItemStack("BOX_OF_SEEDS", true)) } } catch (e: NullPointerException) { e.printStackTrace() } - if (!config.moneyPerHourCompact) { + if (!config.compact) { val itemName = internalName.getItemNameOrNull()?.removeColor() ?: continue val currentColor = if (isCurrent) "§e" else "§7" val contestFormat = if (GardenNextJacobContest.isNextCrop(crop)) "§n" else "" list.add("$currentColor$contestFormat$itemName§7: ") } - val coinsColor = if (isCurrent && config.moneyPerHourCompact) "§e" else "§6" + val coinsColor = if (isCurrent && config.compact) "§e" else "§6" val moneyArray = moneyPerHourData[internalName]!! for (price in moneyArray) { @@ -231,20 +232,20 @@ object CropMoneyDisplay { newDisplay.add(list) } - return if (config.moneyPerHourHideTitle) newDisplay.drop(1) else newDisplay + return if (config.hideTitle) newDisplay.drop(1) else newDisplay } private fun fullTitle(title: String): String { val titleText: String val nameList = mutableListOf<String>() - if (config.moneyPerHourUseCustomFormat) { + if (config.useCustomFormat) { val map = mapOf( 0 to "Sell Offer", 1 to "Instant Sell", 2 to "NPC Price", ) val list = mutableListOf<String>() - for (index in config.moneyPerHourCustomFormat) { + for (index in config.customFormat) { map[index]?.let { list.add(it) } @@ -261,7 +262,7 @@ object CropMoneyDisplay { return "$title §7($titleText§7)" } - private fun format(moneyPerHour: Double) = if (config.moneyPerHourCompactPrice) { + private fun format(moneyPerHour: Double) = if (config.compactPrice) { NumberUtil.format(moneyPerHour) } else { LorenzUtils.formatInteger(moneyPerHour.toLong()) @@ -274,9 +275,9 @@ object CropMoneyDisplay { var seedsPerHour = 0.0 val onlyNpcPrice = - (!config.moneyPerHourUseCustomFormat && LorenzUtils.noTradeMode) || - (config.moneyPerHourUseCustomFormat && config.moneyPerHourCustomFormat.size == 1 && - config.moneyPerHourCustomFormat[0] == 2) + (!config.useCustomFormat && LorenzUtils.noTradeMode) || + (config.useCustomFormat && config.customFormat.size == 1 && + config.customFormat[0] == 2) for ((internalName, amount) in multipliers.moveEntryToTop { isSeeds(it.key) }) { val crop = cropNames[internalName]!! @@ -331,7 +332,7 @@ object CropMoneyDisplay { debugList.addAsSingletonList(" instantSell: ${instantSell.addSeparators()}") } - if (crop == CropType.WHEAT && config.moneyPerHourMergeSeeds) { + if (crop == CropType.WHEAT && config.mergeSeeds) { if (isSeeds) { seedsPrice = bazaarData seedsPerHour = cropsPerHour @@ -350,7 +351,7 @@ object CropMoneyDisplay { } val bountifulMoney = - if (toolHasBountiful?.get(crop) == true && config.moneyPerHourBountiful) speedPerHour * 0.2 else 0.0 + if (toolHasBountiful?.get(crop) == true && config.bountiful) speedPerHour * 0.2 else 0.0 if (debug && bountifulMoney > 0.0) { debugList.addAsSingletonList(" bountifulCoins: ${bountifulMoney.addSeparators()}") } @@ -364,14 +365,14 @@ object CropMoneyDisplay { internalName.equals("ENCHANTED_SEEDS") || internalName.equals("SEEDS") private fun formatNumbers(sellOffer: Double, instantSell: Double, npcPrice: Double): Array<Double> { - return if (config.moneyPerHourUseCustomFormat) { + return if (config.useCustomFormat) { val map = mapOf( 0 to sellOffer, 1 to instantSell, 2 to npcPrice, ) val newList = mutableListOf<Double>() - for (index in config.moneyPerHourCustomFormat) { + for (index in config.customFormat) { map[index]?.let { newList.add(it) } @@ -416,5 +417,24 @@ object CropMoneyDisplay { } } - private fun isEnabled() = GardenAPI.inGarden() && config.moneyPerHourDisplay + private fun isEnabled() = GardenAPI.inGarden() && config.display + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "garden.moneyPerHourDisplay", "garden.moneyPerHours.display") + event.move(3, "garden.moneyPerHourShowOnlyBest", "garden.moneyPerHours.showOnlyBest") + event.move(3, "garden.moneyPerHourShowCurrent", "garden.moneyPerHours.showCurrent") + event.move(3, "garden.moneyPerHourAlwaysOn", "garden.moneyPerHours.alwaysOn") + event.move(3, "garden.moneyPerHourCompact", "garden.moneyPerHours.compact") + event.move(3, "garden.moneyPerHourCompactPrice", "garden.moneyPerHours.compactPrice") + event.move(3, "garden.moneyPerHourUseCustomFormat", "garden.moneyPerHours.useCustomFormat") + event.move(3, "garden.moneyPerHourCustomFormat", "garden.moneyPerHours.customFormat") + event.move(3, "garden.moneyPerHourMergeSeeds", "garden.moneyPerHours.mergeSeeds") + event.move(3, "garden.moneyPerHourBountiful", "garden.moneyPerHours.bountiful") + event.move(3, "garden.moneyPerHourMooshroom", "garden.moneyPerHours.mooshroom") + event.move(3, "garden.moneyPerHourArmor", "garden.moneyPerHours.armor") + event.move(3, "garden.moneyPerHourDicer", "garden.moneyPerHours.dicer") + event.move(3, "garden.moneyPerHourHideTitle", "garden.moneyPerHours.hideTitle") + event.move(3, "garden.moneyPerHourPos", "garden.moneyPerHours.pos") + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropCounter.kt index 35fb5eaa5..4282e5e8f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropCounter.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -18,7 +19,7 @@ class DicerRngDropCounter { private var display = emptyList<String>() private val drops = mutableMapOf<CropType, MutableMap<DropRarity, Int>>() private val itemDrops = mutableListOf<ItemDrop>() - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.dicerCounters init { initDrops() @@ -55,7 +56,7 @@ class DicerRngDropCounter { @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!GardenAPI.inGarden()) return - if (!config.dicerCounterHideChat && !config.dicerCounterDisplay) return + if (!config.hideChat && !config.display) return val message = event.message for (drop in itemDrops) { @@ -63,7 +64,7 @@ class DicerRngDropCounter { addDrop(drop.crop, drop.rarity) saveConfig() update() - if (config.dicerCounterHideChat) { + if (config.hideChat) { event.blockedReason = "dicer_rng_drop_counter" } return @@ -109,7 +110,7 @@ class DicerRngDropCounter { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (isEnabled()) { - config.dicerCounterPos.renderStrings(display, posLabel = "Dicer Counter") + config.pos.renderStrings(display, posLabel = "Dicer Counter") } } @@ -138,5 +139,12 @@ class DicerRngDropCounter { } } - fun isEnabled() = GardenAPI.inGarden() && config.dicerCounterDisplay + fun isEnabled() = GardenAPI.inGarden() && config.display + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "garden.dicerCounterDisplay", "garden.dicerCounters.display") + event.move(3, "garden.dicerCounterHideChat", "garden.dicerCounters.hideChat") + event.move(3, "garden.dicerCounterPos", "garden.dicerCounters.pos") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt index 375398098..db232600a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -26,7 +27,7 @@ class FarmingArmorDrops { private var hasArmor = false private val armorPattern = "(FERMENTO|CROPIE|SQUASH|MELON)_(LEGGINGS|CHESTPLATE|BOOTS|HELMET)".toPattern() - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.farmingArmorDrop enum class ArmorDropType(val dropName: String, val chatMessage: String) { CROPIE("§9Cropie", "§6§lRARE CROP! §r§f§r§9Cropie §r§b(Armor Set Bonus)"), @@ -45,7 +46,7 @@ class FarmingArmorDrops { for (dropType in ArmorDropType.entries) { if (dropType.chatMessage == event.message) { addDrop(dropType) - if (config.farmingArmorDropsHideChat) { + if (config.hideChat) { event.blockedReason = "farming_armor_drops" } } @@ -81,16 +82,16 @@ class FarmingArmorDrops { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!GardenAPI.inGarden()) return - if (!config.farmingArmorDropsEnabled) return + if (!config.enabled) return if (!hasArmor) return - config.farmingArmorDropsPos.renderStrings(display, posLabel = "Farming Armor Drops") + config.pos.renderStrings(display, posLabel = "Farming Armor Drops") } @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!GardenAPI.inGarden()) return - if (!config.farmingArmorDropsEnabled) return + if (!config.enabled) return if (event.isMod(30)) { checkArmor() @@ -142,4 +143,11 @@ class FarmingArmorDrops { return currentArmorDropChance } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"garden.farmingArmorDropsEnabled", "garden.farmingArmorDrop.enabled") + event.move(3,"garden.farmingArmorDropsHideChat", "garden.farmingArmorDrop.hideChat") + event.move(3,"garden.farmingArmorDropsPos", "garden.farmingArmorDrop.pos") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index 474f0e814..f7d9659dc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -29,9 +29,9 @@ class FarmingWeightDisplay { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent) { - val shouldShow = apiError || (config.eliteFarmingWeightIgnoreLow || weight >= 200) + val shouldShow = apiError || (config.ignoreLow || weight >= 200) if (isEnabled() && shouldShow) { - config.eliteFarmingWeightPos.renderRenderables(display, posLabel = "Farming Weight Display") + config.pos.renderRenderables(display, posLabel = "Farming Weight Display") } } @@ -72,10 +72,18 @@ class FarmingWeightDisplay { @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(1, "garden.eliteFarmingWeightoffScreenDropMessage", "garden.eliteFarmingWeightOffScreenDropMessage") + event.move(3, "garden.eliteFarmingWeightDisplay","garden.eliteFarmingWeights.display") + event.move(3, "garden.eliteFarmingWeightPos","garden.eliteFarmingWeights.pos") + event.move(3, "garden.eliteFarmingWeightLeaderboard","garden.eliteFarmingWeights.leaderboard") + event.move(3, "garden.eliteFarmingWeightOvertakeETA","garden.eliteFarmingWeights.overtakeETA") + event.move(3, "garden.eliteFarmingWeightOffScreenDropMessage","garden.eliteFarmingWeights.offScreenDropMessage") + event.move(3, "garden.eliteFarmingWeightOvertakeETAAlways","garden.eliteFarmingWeights.overtakeETAAlways") + event.move(3, "garden.eliteFarmingWeightETAGoalRank","garden.eliteFarmingWeights.ETAGoalRank") + event.move(3, "garden.eliteFarmingWeightIgnoreLow","garden.eliteFarmingWeights.ignoreLow") } companion object { - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.eliteFarmingWeights private val localCounter = mutableMapOf<CropType, Long>() private var display = emptyList<Renderable>() @@ -166,7 +174,7 @@ class FarmingWeightDisplay { openWebsite(LorenzUtils.getPlayerName()) }) - if (isEtaEnabled() && (weightPerSecond != -1.0 || config.eliteFarmingWeightOvertakeETAAlways)) { + if (isEtaEnabled() && (weightPerSecond != -1.0 || config.overtakeETAAlways)) { getETA()?.let { list.add(it) } @@ -175,7 +183,7 @@ class FarmingWeightDisplay { } private fun getLeaderboard(): String { - if (!config.eliteFarmingWeightLeaderboard) return "" + if (!config.leaderboard) return "" // Fetching new leaderboard position every 10.5 minutes if (System.currentTimeMillis() > lastLeaderboardUpdate + 630_000) { @@ -204,7 +212,7 @@ class FarmingWeightDisplay { } private fun getRankGoal(): Int { - val value = config.eliteFarmingWeightETAGoalRank + val value = config.ETAGoalRank var goal = 10000 // Check that the provided string is valid @@ -212,7 +220,7 @@ class FarmingWeightDisplay { if (parsed < 1 || parsed > goal) { LorenzUtils.error("[SkyHanni] Invalid Farming Weight Overtake Goal!") LorenzUtils.chat("§eEdit the Overtake Goal config value with a valid number [1-10000] to use this feature!") - config.eliteFarmingWeightETAGoalRank = goal.toString() + config.ETAGoalRank = goal.toString() } else { goal = parsed } @@ -312,8 +320,8 @@ class FarmingWeightDisplay { ) } - private fun isEnabled() = GardenAPI.inGarden() && config.eliteFarmingWeightDisplay - private fun isEtaEnabled() = config.eliteFarmingWeightOvertakeETA + private fun isEnabled() = GardenAPI.inGarden() && config.display + private fun isEtaEnabled() = config.overtakeETA fun addCrop(crop: CropType, addedCounter: Int) { val before = getExactWeight() @@ -345,7 +353,7 @@ class FarmingWeightDisplay { SkyHanniMod.coroutineScope.launch { val wasNotLoaded = leaderboardPosition == -1 leaderboardPosition = loadLeaderboardPosition() - if (wasNotLoaded && config.eliteFarmingWeightOffScreenDropMessage) { + if (wasNotLoaded && config.offScreenDropMessage) { checkOffScreenLeaderboardChanges() } ProfileStorageData.profileSpecific?.garden?.farmingWeight?.lastFarmingWeightLeaderboard = 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 30afb0418..ba5945762 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,7 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.GardenCropMilestones import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter import at.hannibal2.skyhanni.data.GardenCropMilestones.isMaxed @@ -12,12 +13,13 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.sorted import at.hannibal2.skyhanni.utils.TimeUnit import at.hannibal2.skyhanni.utils.TimeUtils +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class GardenBestCropTime { var display = emptyList<List<Any>>() companion object { - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.cropMilestones val timeTillNextCrop = mutableMapOf<CropType, Long>() fun reset() { @@ -34,7 +36,7 @@ class GardenBestCropTime { val currentTier = GardenCropMilestones.getTierForCropCount(counter, crop) val cropsForCurrentTier = GardenCropMilestones.getCropsForTier(currentTier, crop) - val nextTier = if (config.cropMilestoneBestShowMaxedNeeded.get()) 46 else currentTier + 1 + val nextTier = if (config.bestShowMaxedNeeded.get()) 46 else currentTier + 1 val cropsForNextTier = GardenCropMilestones.getCropsForTier(nextTier, crop) val have = counter - cropsForCurrentTier @@ -54,7 +56,7 @@ class GardenBestCropTime { updateTimeTillNextCrop() } - val gardenExp = config.cropMilestoneBestType == 0 + val gardenExp = config.next.bestType == 0 val sorted = if (gardenExp) { val helpMap = mutableMapOf<CropType, Long>() for ((crop, time) in timeTillNextCrop) { @@ -70,16 +72,16 @@ class GardenBestCropTime { } - if (!config.cropMilestoneBestHideTitle) { + if (!config.next.bestHideTitle) { val title = if (gardenExp) "§2Garden Experience" else "§bSkyBlock Level" - if (config.cropMilestoneBestCompact) { + if (config.next.bestCompact) { newList.addAsSingletonList("§eBest Crop Time") } else { newList.addAsSingletonList("§eBest Crop Time §7($title§7)") } } - if (!config.cropMilestoneProgress) { + if (!config.progress) { newList.addAsSingletonList("§cCrop Milestone Progress Display is disabled!") return newList } @@ -93,14 +95,14 @@ class GardenBestCropTime { for (crop in sorted.keys) { if (crop.isMaxed()) continue val millis = timeTillNextCrop[crop]!! - val biggestUnit = TimeUnit.entries[config.cropMilestoneHighestTimeFormat.get()] + val biggestUnit = TimeUnit.entries[config.highestTimeFormat.get()] val duration = TimeUtils.formatDuration(millis, biggestUnit, maxUnits = 2) val isCurrent = crop == currentCrop number++ - if (number > config.cropMilestoneShowOnlyBest && (!config.cropMilestoneShowCurrent || !isCurrent)) continue + if (number > config.next.showOnlyBest && (!config.next.showCurrent || !isCurrent)) continue val list = mutableListOf<Any>() - if (!config.cropMilestoneBestCompact) { + if (!config.next.bestCompact) { list.add("§7$number# ") } list.addCropIcon(crop) @@ -108,14 +110,14 @@ class GardenBestCropTime { val color = if (isCurrent) "§e" else "§7" val contestFormat = if (GardenNextJacobContest.isNextCrop(crop)) "§n" else "" val currentTier = GardenCropMilestones.getTierForCropCount(crop.getCounter(), crop) - val nextTier = if (config.cropMilestoneBestShowMaxedNeeded.get()) 46 else currentTier + 1 + val nextTier = if (config.bestShowMaxedNeeded.get()) 46 else currentTier + 1 - val cropName = if (!config.cropMilestoneBestCompact) crop.cropName + " " else "" - val tier = if (!config.cropMilestoneBestCompact) "$currentTier➜$nextTier§r " else "" + val cropName = if (!config.next.bestCompact) crop.cropName + " " else "" + val tier = if (!config.next.bestCompact) "$currentTier➜$nextTier§r " else "" list.add("$color$contestFormat$cropName$tier§b$duration") - if (gardenExp && !config.cropMilestoneBestCompact) { + if (gardenExp && !config.next.bestCompact) { val gardenExpForTier = getGardenExpForTier(nextTier) list.add(" §7(§2$gardenExpForTier §7Exp)") } @@ -125,4 +127,13 @@ class GardenBestCropTime { } private fun getGardenExpForTier(gardenLevel: Int) = if (gardenLevel > 30) 300 else gardenLevel * 10 + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "garden.cropMilestoneBestType", "garden.cropMilestones.next.bestType") + event.move(3, "garden.cropMilestoneShowOnlyBest", "garden.cropMilestones.next.showOnlyBest") + 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") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt index 52b5f7f3c..a26365bcd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.GardenCropMilestones import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter import at.hannibal2.skyhanni.data.GardenCropMilestones.isMaxed @@ -32,7 +33,7 @@ object GardenCropMilestoneDisplay { private var progressDisplay = emptyList<List<Any>>() private var mushroomCowPerkDisplay = emptyList<List<Any>>() private val cultivatingData = mutableMapOf<CropType, Long>() - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.cropMilestones private val bestCropTime = GardenBestCropTime() private var lastPlaySoundTime = 0L @@ -41,8 +42,8 @@ object GardenCropMilestoneDisplay { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { LorenzUtils.onToggle( - config.cropMilestoneBestShowMaxedNeeded, - config.cropMilestoneHighestTimeFormat, + config.bestShowMaxedNeeded, + config.highestTimeFormat, ) { GardenBestCropTime.updateTimeTillNextCrop() update() @@ -54,18 +55,18 @@ object GardenCropMilestoneDisplay { if (!isEnabled()) return if (GardenAPI.hideExtraGuis()) return - config.cropMilestoneProgressDisplayPos.renderStringsAndItems( + config.progressDisplayPos.renderStringsAndItems( progressDisplay, posLabel = "Crop Milestone Progress" ) - if (config.cropMilestoneMushroomPetPerkEnabled) { - config.cropMilestoneMushroomPetPerkPos.renderStringsAndItems( + if (config.mushroomPetPerk.enabled) { + config.mushroomPetPerk.pos.renderStringsAndItems( mushroomCowPerkDisplay, posLabel = "Mushroom Cow Perk" ) } - if (config.cropMilestoneBestDisplay) { - config.cropMilestoneNextDisplayPos.renderStringsAndItems(bestCropTime.display, posLabel = "Best Crop Time") + if (config.next.bestDisplay) { + config.next.displayPos.renderStringsAndItems(bestCropTime.display, posLabel = "Best Crop Time") } } @@ -121,7 +122,7 @@ object GardenCropMilestoneDisplay { progressDisplay = drawProgressDisplay(it) } - if (config.cropMilestoneBestDisplay && config.cropMilestoneBestAlwaysOn || currentCrop != null) { + if (config.next.bestDisplay && config.next.bestAlwaysOn || currentCrop != null) { bestCropTime.display = bestCropTime.drawBestDisplay(currentCrop) } } @@ -132,7 +133,7 @@ object GardenCropMilestoneDisplay { lineMap[0] = Collections.singletonList("§6Crop Milestones") val currentTier = GardenCropMilestones.getTierForCropCount(counter, crop) - val nextTier = if (config.cropMilestoneBestShowMaxedNeeded.get()) 46 else currentTier + 1 + val nextTier = if (config.bestShowMaxedNeeded.get()) 46 else currentTier + 1 val list = mutableListOf<Any>() list.addCropIcon(crop) @@ -144,7 +145,7 @@ object GardenCropMilestoneDisplay { lineMap[1] = list val cropsForNextTier = GardenCropMilestones.getCropsForTier(nextTier, crop) - val (have, need) = if (config.cropMilestoneBestShowMaxedNeeded.get()) { + val (have, need) = if (config.bestShowMaxedNeeded.get()) { Pair(counter, cropsForNextTier) } else { val cropsForCurrentTier = GardenCropMilestones.getCropsForTier(currentTier, crop) @@ -175,7 +176,7 @@ object GardenCropMilestoneDisplay { val missingTimeSeconds = missing / farmingFortuneSpeed val millis = missingTimeSeconds * 1000 GardenBestCropTime.timeTillNextCrop[crop] = millis - val biggestUnit = TimeUnit.entries[config.cropMilestoneHighestTimeFormat.get()] + val biggestUnit = TimeUnit.entries[config.highestTimeFormat.get()] val duration = TimeUtils.formatDuration(millis, biggestUnit) tryWarn(millis, "§b${crop.cropName} $nextTier in $duration") val speedText = "§7In §b$duration" @@ -208,7 +209,7 @@ object GardenCropMilestoneDisplay { } private fun tryWarn(millis: Long, title: String) { - if (!config.cropMilestoneWarnClose) return + if (!config.warnClose) return if (GardenCropSpeed.lastBrokenTime + 500 <= System.currentTimeMillis()) return if (millis > 5_900) return @@ -223,7 +224,7 @@ object GardenCropMilestoneDisplay { private fun formatDisplay(lineMap: HashMap<Int, List<Any>>): MutableList<List<Any>> { val newList = mutableListOf<List<Any>>() - for (index in config.cropMilestoneText) { + for (index in config.text) { lineMap[index]?.let { newList.add(it) } @@ -269,7 +270,7 @@ object GardenCropMilestoneDisplay { val missingTimeSeconds = missing / blocksPerSecond val millis = missingTimeSeconds * 1000 - val biggestUnit = TimeUnit.entries[config.cropMilestoneHighestTimeFormat.get()] + val biggestUnit = TimeUnit.entries[config.highestTimeFormat.get()] val duration = TimeUtils.formatDuration(millis.toLong(), biggestUnit) lineMap[3] = Collections.singletonList("§7In §b$duration") } @@ -278,7 +279,7 @@ object GardenCropMilestoneDisplay { lineMap[4] = Collections.singletonList("§7Percentage: §e$percentageFormat") val newList = mutableListOf<List<Any>>() - for (index in config.cropMilestoneMushroomPetPerkText) { + for (index in config.mushroomPetPerk.text) { lineMap[index]?.let { newList.add(it) } @@ -286,5 +287,22 @@ object GardenCropMilestoneDisplay { mushroomCowPerkDisplay = newList } - private fun isEnabled() = GardenAPI.inGarden() && config.cropMilestoneProgress + private fun isEnabled() = GardenAPI.inGarden() && config.progress + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"garden.cropMilestoneProgress", "garden.cropMilestones.progress") + event.move(3, "garden.cropMilestoneWarnClose", "garden.cropMilestones.warnClose") + event.move(3, "garden.cropMilestoneHighestTimeFormat","garden.cropMilestones.highestTimeFormat") + event.move(3,"garden.cropMilestoneBestShowMaxedNeeded","garden.cropMilestones.bestShowMaxedNeeded") + event.move(3,"garden.cropMilestoneText","garden.cropMilestones.text") + event.move(3,"garden.blocksBrokenPrecision", "garden.cropMilestones.blocksBrokenPrecision") + event.move(3, "garden.cropMilestoneProgressDisplayPos", "garden.cropMilestones.progressDisplayPos") + event.move(3, "garden.cropMilestoneBestDisplay", "garden.cropMilestones.next.bestDisplay") + event.move(3, "garden.cropMilestoneBestAlwaysOn", "garden.cropMilestones.next.bestAlwaysOn") + event.move(3, "garden.cropMilestoneNextDisplayPos", "garden.cropMilestones.next.displayPos") + event.move(3,"garden.cropMilestoneMushroomPetPerkEnabled","garden.cropMilestones.mushroomPetPerk.enabled") + event.move(3,"garden.cropMilestoneMushroomPetPerkText","garden.cropMilestones.mushroomPetPerk.text") + event.move(3,"garden.cropMilestoneMushroomPetPerkPos","garden.cropMilestones.mushroomPetPerk.pos") + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt index d557d89d9..0ac20c8bc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.ClickType import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter import at.hannibal2.skyhanni.data.GardenCropMilestones.setCounter @@ -85,7 +86,7 @@ object GardenCropSpeed { if (blocksSpeedList.isEmpty()) return secondsStopped++ } else { - if (secondsStopped >= config.blocksBrokenResetTime) { + if (secondsStopped >= config.cropMilestones.blocksBrokenResetTime) { resetSpeed() } blocksSpeedList = blocksSpeedList.editCopy { @@ -194,4 +195,10 @@ object GardenCropSpeed { fun CropType.getLatestBlocksPerSecond() = latestBlocksPerSecond?.get(this) fun isSpeedDataEmpty() = cropsPerSecond?.values?.sum()?.let { it == 0 } ?: true + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"garden.blocksBrokenResetTime", "garden.cropMilestones.blocksBrokenResetTime") + + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt index 16393cbab..7c93f3b99 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt @@ -1,35 +1,37 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.mixins.transformers.AccessorKeyBinding import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiEditSign import net.minecraft.client.settings.KeyBinding +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.spongepowered.asm.mixin.injection.callback.CallbackInfo import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable import java.util.IdentityHashMap object GardenCustomKeybinds { - private val shConfig get() = SkyHanniMod.feature.garden + private val shConfig get() = SkyHanniMod.feature.garden.keyBind private val mcSettings get() = Minecraft.getMinecraft().gameSettings private val map: MutableMap<KeyBinding, () -> Int> = IdentityHashMap() private var lastWindowOpenTime = 0L init { - map[mcSettings.keyBindAttack] = { shConfig.keyBindAttack } - map[mcSettings.keyBindUseItem] = { shConfig.keyBindUseItem } - map[mcSettings.keyBindLeft] = { shConfig.keyBindLeft } - map[mcSettings.keyBindRight] = { shConfig.keyBindRight } - map[mcSettings.keyBindForward] = { shConfig.keyBindForward } - map[mcSettings.keyBindBack] = { shConfig.keyBindBack } - map[mcSettings.keyBindJump] = { shConfig.keyBindJump } - map[mcSettings.keyBindSneak] = { shConfig.keyBindSneak } + map[mcSettings.keyBindAttack] = { shConfig.attack } + map[mcSettings.keyBindUseItem] = { shConfig.useItem } + map[mcSettings.keyBindLeft] = { shConfig.left } + map[mcSettings.keyBindRight] = { shConfig.right } + map[mcSettings.keyBindForward] = { shConfig.forward } + map[mcSettings.keyBindBack] = { shConfig.back } + map[mcSettings.keyBindJump] = { shConfig.jump } + map[mcSettings.keyBindSneak] = { shConfig.sneak } } - private fun isEnabled() = GardenAPI.inGarden() && shConfig.keyBindEnabled + private fun isEnabled() = GardenAPI.inGarden() && shConfig.enabled private fun isActive(): Boolean { if (!isEnabled()) return false @@ -65,4 +67,17 @@ object GardenCustomKeybinds { keyBinding as AccessorKeyBinding keyBinding.pressTime_skyhanni++ } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "garden.keyBindEnabled", "garden.keyBind.enabled") + event.move(3, "garden.keyBindAttack", "garden.keyBind.attack") + event.move(3, "garden.keyBindUseItem", "garden.keyBind.useItem") + event.move(3, "garden.keyBindLeft", "garden.keyBind.left") + event.move(3, "garden.keyBindRight", "garden.keyBind.right") + event.move(3, "garden.keyBindForward", "garden.keyBind.forward") + event.move(3, "garden.keyBindBack", "garden.keyBind.back") + event.move(3, "garden.keyBindJump", "garden.keyBind.jump") + event.move(3, "garden.keyBindSneak", "garden.keyBind.sneak") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt index e0e7da8e2..01381e80a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.inventory import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.InventoryUtils @@ -16,7 +17,7 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AnitaExtraFarmingFortune { - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.anitaShop private var levelPrice = emptyMap<Int, AnitaUpgradeCostsJson.Price>() @SubscribeEvent @@ -79,4 +80,9 @@ class AnitaExtraFarmingFortune { levelPrice = map } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"garden.extraFarmingFortune", "garden.anitaShop.extraFarmingFortune") + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt index 2c545983c..db3803c09 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.inventory import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.GardenCropMilestones import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter import at.hannibal2.skyhanni.events.CropMilestoneUpdateEvent @@ -22,7 +23,7 @@ class GardenCropMilestoneInventory { @SubscribeEvent fun onCropMilestoneUpdate(event: CropMilestoneUpdateEvent) { - if (!config.numberAverageCropMilestone) return + if (!config.number.averageCropMilestone) return val tiers = mutableListOf<Double>() for (cropType in CropType.entries) { @@ -53,7 +54,7 @@ class GardenCropMilestoneInventory { @SubscribeEvent fun onItemTooltipLow(event: ItemTooltipEvent) { if (!LorenzUtils.inSkyBlock) return - if (!config.cropMilestoneTotalProgress) return + if (!config.tooltipTweak.cropMilestoneTotalProgress) return val itemStack = event.itemStack ?: return val crop = GardenCropMilestones.getCropTypeByLore(itemStack) ?: return @@ -74,4 +75,10 @@ class GardenCropMilestoneInventory { event.toolTip.add(index, "$progressBar §e${counter.addSeparators()}§6/§e${NumberUtil.format(maxCounter)}") event.toolTip.add(index, "§7Progress to Tier $maxTier: §e$percentageFormat") } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"garden.numberAverageCropMilestone", "garden.number.averageCropMilestone") + event.move(3, "garden.cropMilestoneTotalProgress", "garden.tooltipTweak.cropMilestoneTotalProgress") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt index c62b0c84d..87b496912 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.inventory import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.model.ComposterUpgrade import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.features.garden.GardenAPI @@ -12,7 +13,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class GardenInventoryNumbers { - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.number private var patternTierProgress = "§7Progress to Tier (?<tier>.*): §e(?:.*)".toPattern() private var patternUpgradeTier = "§7Current Tier: §[ea](?<tier>.*)§7/§a.*".toPattern() @@ -22,7 +23,7 @@ class GardenInventoryNumbers { if (!GardenAPI.inGarden()) return if (InventoryUtils.openInventoryName() == "Crop Milestones") { - if (!config.numberCropMilestone) return + if (!config.cropMilestone) return event.stack.getLore() .map { patternTierProgress.matcher(it) } @@ -32,7 +33,7 @@ class GardenInventoryNumbers { } if (InventoryUtils.openInventoryName() == "Crop Upgrades") { - if (!config.numberCropUpgrades) return + if (!config.cropUpgrades) return event.stack.getLore() .map { patternUpgradeTier.matcher(it) } @@ -42,7 +43,7 @@ class GardenInventoryNumbers { } if (InventoryUtils.openInventoryName() == "Composter Upgrades") { - if (!config.numberComposterUpgrades) return + if (!config.composterUpgrades) return event.stack.name?.let { ComposterUpgrade.regex.matchMatcher(it) { @@ -52,4 +53,12 @@ class GardenInventoryNumbers { } } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"garden.numberCropMilestone", "garden.number.cropMilestone") + event.move(3,"garden.numberCropUpgrades", "garden.number.cropUpgrades") + event.move(3,"garden.numberComposterUpgrades", "garden.number.composterUpgrades") + } + }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt index fbcbdc131..b9d73689c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.inventory import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -20,7 +21,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SkyMartCopperPrice { private val pattern = "§c(?<amount>.*) Copper".toPattern() private var display = emptyList<List<Any>>() - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.skyMart companion object { var inInventory = false @@ -46,7 +47,7 @@ class SkyMartCopperPrice { val amountFormat = NumberUtil.format(amount) val name = stack.nameWithEnchantment!! - val advancedStats = if (config.skyMartCopperPriceAdvancedStats) { + val advancedStats = if (config.copperPriceAdvancedStats) { " §7(§6$priceFormat §7/ §c$amountFormat Copper§7)" } else "" val pair = Pair("$name§f:", "§6§l$perFormat$advancedStats") @@ -69,7 +70,7 @@ class SkyMartCopperPrice { @SubscribeEvent fun onBackgroundDraw(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { if (inInventory) { - config.skyMartCopperPricePos.renderStringsAndItems( + config.copperPricePos.renderStringsAndItems( display, extraSpace = 5, itemScale = 1.7, @@ -78,5 +79,12 @@ class SkyMartCopperPrice { } } - private fun isEnabled() = GardenAPI.inGarden() && config.skyMartCopperPrice + private fun isEnabled() = GardenAPI.inGarden() && config.copperPrice + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "garden.skyMartCopperPrice", "garden.skyMart.copperPrice") + event.move(3, "garden.skyMartCopperPriceAdvancedStats", "garden.skyMart.copperPriceAdvancedStats") + event.move(3, "garden.skyMartCopperPricePos", "garden.skyMart.copperPricePos") + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt index 84bbf4a4b..49a1e8c56 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt @@ -35,7 +35,7 @@ class GardenVisitorColorNames { var visitorItems = mapOf<String, List<String>>() fun getColoredName(name: String): String { - if (!SkyHanniMod.feature.garden.visitorColoredName) return name + if (!SkyHanniMod.feature.garden.visitors.coloredName) return name val cleanName = name.removeColor() val color = visitorColor[cleanName] ?: return name diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt index 7391bbdd6..788023d1e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.visitor import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.Storage import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.ConfigLoadEvent @@ -22,7 +23,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object GardenVisitorDropStatistics { - private val config get() = SkyHanniMod.feature.garden.visitorDropsStatistics + private val config get() = SkyHanniMod.feature.garden.visitors.dropsStatistics private var display = emptyList<List<Any>>() private var acceptedVisitors = 0 @@ -226,7 +227,17 @@ object GardenVisitorDropStatistics { if (!GardenAPI.inGarden()) return if (GardenAPI.hideExtraGuis()) return if (config.onlyOnBarn && !GardenAPI.onBarnPlot) return - config.visitorDropPos.renderStringsAndItems(display, posLabel = "Visitor Stats") + config.pos.renderStringsAndItems(display, posLabel = "Visitor Stats") + } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "garden.visitorDropsStatistics.enabled", "garden.visitors.dropsStatistics.enabled") + event.move(3, "garden.visitorDropsStatistics.textFormat", "garden.visitors.dropsStatistics.textFormat") + event.move(3, "garden.visitorDropsStatistics.displayNumbersFirst", "garden.visitors.dropsStatistics.displayNumbersFirst") + event.move(3, "garden.visitorDropsStatistics.displayIcons", "garden.visitors.dropsStatistics.displayIcons") + event.move(3, "garden.visitorDropsStatistics.onlyOnBarn", "garden.visitors.dropsStatistics.onlyOnBarn") + event.move(3, "garden.visitorDropsStatistics.visitorDropPos", "garden.visitors.dropsStatistics.pos") } } 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 a276348e8..8c7ceba3a 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.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -71,7 +72,7 @@ import org.lwjgl.input.Keyboard import kotlin.math.round import kotlin.time.Duration.Companion.seconds -private val config get() = SkyHanniMod.feature.garden +private val config get() = SkyHanniMod.feature.garden.visitors class GardenVisitorFeatures { private var visitors = mapOf<String, Visitor>() @@ -114,7 +115,7 @@ class GardenVisitorFeatures { inVisitorInventory = true - if (!config.visitorNeedsDisplay && config.visitorHighlightStatus == 3) return + if (!config.needs.display && config.highlightStatus == 3) return var name = npcItem.name ?: return if (name.length == name.removeColor().length + 4) { @@ -191,7 +192,7 @@ class GardenVisitorFeatures { private fun drawDisplay(): List<List<Any>> { val newDisplay = mutableListOf<List<Any>>() - if (!config.visitorNeedsDisplay) return newDisplay + if (!config.needs.display) return newDisplay val requiredItems = mutableMapOf<NEUInternalName, Int>() val newVisitors = mutableListOf<String>() @@ -226,7 +227,7 @@ class GardenVisitorFeatures { } }) { GardenAPI.inGarden() && !NEUItems.neuHasFocus() }) - if (config.visitorNeedsShowPrice) { + if (config.needs.showPrice) { val price = internalName.getPrice() * amount totalPrice += price val format = NumberUtil.format(price) @@ -253,7 +254,7 @@ class GardenVisitorFeatures { val list = mutableListOf<Any>() list.add(" §7- $displayName") - if (config.visitorItemPreview) { + if (config.needs.itemPreview) { val items = GardenVisitorColorNames.visitorItems[visitor.removeColor()] if (items == null) { val text = "Visitor '$visitor' has no items in repo!" @@ -304,14 +305,14 @@ class GardenVisitorFeatures { if (event.slot.stack?.name != "§cRefuse Offer") return visitor.hasReward()?.let { - if (config.visitorRewardWarning.preventRefusing) { - if (config.visitorRewardWarning.bypassKey.isKeyHeld()) { + if (config.rewardWarning.preventRefusing) { + if (config.rewardWarning.bypassKey.isKeyHeld()) { LorenzUtils.chat("§e[SkyHanni] §cBypassed blocking refusal of visitor ${visitor.visitorName} §7(${it.displayName}§7)") return } event.isCanceled = true LorenzUtils.chat("§e[SkyHanni] §cBlocked refusing visitor ${visitor.visitorName} §7(${it.displayName}§7)") - if (config.visitorRewardWarning.bypassKey == Keyboard.KEY_NONE) { + if (config.rewardWarning.bypassKey == Keyboard.KEY_NONE) { LorenzUtils.clickableChat( "§eIf you want to deny this visitor, set a keybind in §e/sh bypass", "sh bypass" @@ -348,7 +349,7 @@ class GardenVisitorFeatures { fun onCheckRender(event: CheckRenderEntityEvent<*>) { if (!GardenAPI.inGarden()) return if (!GardenAPI.onBarnPlot) return - if (config.visitorHighlightStatus != 1 && config.visitorHighlightStatus != 2) return + if (config.highlightStatus != 1 && config.highlightStatus != 2) return val entity = event.entity if (entity is EntityArmorStand && entity.name == "§e§lCLICK") { @@ -360,7 +361,7 @@ class GardenVisitorFeatures { fun onRenderWorld(event: LorenzRenderWorldEvent) { if (!GardenAPI.inGarden()) return if (!GardenAPI.onBarnPlot) return - if (config.visitorHighlightStatus != 1 && config.visitorHighlightStatus != 2) return + if (config.highlightStatus != 1 && config.highlightStatus != 2) return for (visitor in visitors.values) { visitor.getNameTagEntity()?.let { @@ -368,7 +369,7 @@ class GardenVisitorFeatures { if (it.distanceToPlayer() < 15) { val text = visitor.status.displayName event.drawString(location.add(0.0, 2.23, 0.0), text) - if (config.visitorRewardWarning.showOverName) { + if (config.rewardWarning.showOverName) { visitor.hasReward()?.let { reward -> val name = reward.displayName @@ -433,7 +434,7 @@ class GardenVisitorFeatures { visitor.allRewards = foundRewards if (wasEmpty) { visitor.hasReward()?.let { reward -> - if (config.visitorRewardWarning.notifyInChat) { + if (config.rewardWarning.notifyInChat) { LorenzUtils.chat("§e[SkyHanni] Found Visitor Reward ${reward.displayName}§e!") } } @@ -445,7 +446,7 @@ class GardenVisitorFeatures { var offset = 0 for ((i, formattedLine) in finalList.toMutableList().withIndex()) { val index = i + offset - if (config.visitorExperiencePrice) { + if (config.inventory.experiencePrice) { gardenExperiencePattern.matchMatcher(formattedLine) { val gardenExp = group("amount").replace(",", "").toInt() val pricePerCopper = NumberUtil.format((totalPrice / gardenExp).toInt()) @@ -458,8 +459,8 @@ class GardenVisitorFeatures { val pricePerCopper = NumberUtil.format((totalPrice / copper).toInt()) val timePerCopper = TimeUtils.formatDuration((timeRequired / copper) * 1000) var copperLine = formattedLine - if (config.visitorCopperPrice) copperLine += " §7(§6$pricePerCopper §7per)" - if (config.visitorCopperTime) { + if (config.inventory.copperPrice) copperLine += " §7(§6$pricePerCopper §7per)" + if (config.inventory.copperTime) { copperLine += if (timeRequired != -1L) " §7(§b$timePerCopper §7per)" else " §7(§cno speed data!§7)" } finalList.set(index, copperLine) @@ -473,7 +474,7 @@ class GardenVisitorFeatures { val internalName = NEUItems.getInternalNameOrNull(itemName)?.replace("◆_", "") ?: continue val price = internalName.getPrice() * amount - if (config.visitorShowPrice) { + if (config.inventory.showPrice) { val format = NumberUtil.format(price) finalList[index] = "$formattedLine §7(§6$format§7)" } @@ -491,7 +492,7 @@ class GardenVisitorFeatures { val duration = TimeUtils.formatDuration(timeRequired * 1000) "in §b$duration" } ?: "§cno speed data!" - if (config.visitorExactAmountAndTime) { + if (config.inventory.exactAmountAndTime) { finalList.add(index + 1, "§7- $formattedName($formattedSpeed§7)") offset++ } @@ -502,10 +503,10 @@ class GardenVisitorFeatures { @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!GardenAPI.inGarden()) return - if (!config.visitorNeedsDisplay && config.visitorHighlightStatus == 3) return + if (!config.needs.display && config.highlightStatus == 3) return if (!event.isMod(10)) return - if (GardenAPI.onBarnPlot && config.visitorHighlightStatus != 3) { + if (GardenAPI.onBarnPlot && config.highlightStatus != 3) { checkVisitorsReady() } } @@ -582,10 +583,10 @@ class GardenVisitorFeatures { logger.log("New visitor detected: '$name'") - if (config.visitorNotificationTitle && System.currentTimeMillis() > LorenzUtils.lastWorldSwitch + 2_000) { + if (config.notificationTitle && System.currentTimeMillis() > LorenzUtils.lastWorldSwitch + 2_000) { LorenzUtils.sendTitle("§eNew Visitor", 5.seconds) } - if (config.visitorNotificationChat) { + if (config.notificationChat) { val displayName = GardenVisitorColorNames.getColoredName(name) LorenzUtils.chat("§e[SkyHanni] $displayName §eis visiting your garden!") } @@ -613,7 +614,7 @@ class GardenVisitorFeatures { @SubscribeEvent fun onTabListText(event: TabListLineRenderEvent) { if (!GardenAPI.inGarden()) return - if (!SkyHanniMod.feature.garden.visitorColoredName) return + if (!config.coloredName) return val text = event.text val replace = fromHypixelName(text) val visitor = visitors[replace] @@ -624,11 +625,11 @@ class GardenVisitorFeatures { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (config.visitorHypixelArrivedMessage && newVisitorArrivedMessage.matcher(event.message).matches()) { + if (config.hypixelArrivedMessage && newVisitorArrivedMessage.matcher(event.message).matches()) { event.blockedReason = "new_visitor_arrived" } - if (GardenAPI.inGarden() && config.visitorHideChat && hideVisitorMessage(event.message)) { + if (GardenAPI.inGarden() && config.hideChat && hideVisitorMessage(event.message)) { event.blockedReason = "garden_visitor_message" } } @@ -663,13 +664,13 @@ class GardenVisitorFeatures { } } - if ((config.visitorHighlightStatus == 0 || config.visitorHighlightStatus == 2) && entity is EntityLivingBase) { + if ((config.highlightStatus == 0 || config.highlightStatus == 2) && entity is EntityLivingBase) { val color = visitor.status.color if (color != -1) { RenderLivingEntityHelper.setEntityColor( entity, color - ) { config.visitorHighlightStatus == 0 || config.visitorHighlightStatus == 2 } + ) { config.highlightStatus == 0 || config.highlightStatus == 2 } } // 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) @@ -748,42 +749,42 @@ class GardenVisitorFeatures { @SubscribeEvent fun onRenderInSigns(event: DrawScreenEvent.Post) { if (!GardenAPI.inGarden()) return - if (!config.visitorNeedsDisplay) return + if (!config.needs.display) return val gui = event.gui if (gui !is GuiEditSign) return - if (config.visitorNeedsOnlyWhenClose && !GardenAPI.onBarnPlot) return + if (config.needs.onlyWhenClose && !GardenAPI.onBarnPlot) return if (!GardenAPI.hideExtraGuis()) { - config.visitorNeedsPos.renderStringsAndItems(display, posLabel = "Visitor Items Needed") + config.needs.pos.renderStringsAndItems(display, posLabel = "Visitor Items Needed") } } @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent) { - if (!config.visitorNeedsDisplay) return + if (!config.needs.display) return if (showGui()) { - config.visitorNeedsPos.renderStringsAndItems(display, posLabel = "Visitor Items Needed") + config.needs.pos.renderStringsAndItems(display, posLabel = "Visitor Items Needed") } } private fun showGui(): Boolean { - if (config.visitorNeedsInBazaarAlley && LorenzUtils.skyBlockIsland == IslandType.HUB && LorenzUtils.skyBlockArea == "Bazaar Alley") { + if (config.needs.inBazaarAlley && LorenzUtils.skyBlockIsland == IslandType.HUB && LorenzUtils.skyBlockArea == "Bazaar Alley") { return true } if (GardenAPI.hideExtraGuis()) return false if (GardenAPI.inGarden()) { if (GardenAPI.onBarnPlot) return true - if (!config.visitorNeedsOnlyWhenClose) return true + if (!config.needs.onlyWhenClose) return true } return false } @SubscribeEvent(priority = EventPriority.HIGH) fun onRenderLiving(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) { - if (!SkyHanniMod.feature.garden.visitorColoredName) return + if (!config.coloredName) return val entity = event.entity val entityId = entity.entityId for (visitor in visitors.values) { @@ -812,7 +813,7 @@ class GardenVisitorFeatures { for (internalName in allRewards) { val reward = VisitorReward.getByInternalName(internalName) ?: continue - if (config.visitorRewardWarning.drops.contains(reward.ordinal)) { + if (config.rewardWarning.drops.contains(reward.ordinal)) { return reward } } @@ -828,5 +829,32 @@ class GardenVisitorFeatures { ACCEPTED("§7Accepted", LorenzColor.DARK_GRAY.toColor().withAlpha(80)), REFUSED("§cRefused", LorenzColor.RED.toColor().withAlpha(60)), } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "garden.visitorNeedsDisplay", "garden.visitors.needs.display") + event.move(3, "garden.visitorNeedsPos", "garden.visitors.needs.pos") + event.move(3, "garden.visitorNeedsOnlyWhenClose", "garden.visitors.needs.onlyWhenClose") + event.move(3, "garden.visitorNeedsInBazaarAlley", "garden.visitors.needs.inBazaarAlley") + event.move(3,"garden.visitorNeedsShowPrice", "garden.visitors.needs.showPrice") + event.move(3,"garden.visitorItemPreview", "garden.visitors.needs.itemPreview") + event.move(3, "garden.visitorShowPrice", "garden.visitors.inventory.showPrice") + event.move(3, "garden.visitorExactAmountAndTime", "garden.visitors.inventory.exactAmountAndTime") + event.move(3, "garden.visitorCopperPrice", "garden.visitors.inventory.copperPrice") + event.move(3, "garden.visitorCopperTime", "garden.visitors.inventory.copperTime") + event.move(3, "garden.visitorExperiencePrice", "garden.visitors.inventory.experiencePrice") + event.move(3,"garden.visitorRewardWarning.notifyInChat","garden.visitors.rewardWarning.notifyInChat") + event.move(3,"garden.visitorRewardWarning.showOverName","garden.visitors.rewardWarning.showOverName") + event.move(3,"garden.visitorRewardWarning.preventRefusing","garden.visitors.rewardWarning.preventRefusing") + event.move(3,"garden.visitorRewardWarning.bypassKey","garden.visitors.rewardWarning.bypassKey") + event.move(3,"garden.visitorRewardWarning.drops","garden.visitors.rewardWarning.drops") + event.move(3, "garden.visitorNotificationChat", "garden.visitors.notificationChat") + event.move(3, "garden.visitorNotificationTitle", "garden.visitors.notificationTitle") + event.move(3, "garden.visitorHighlightStatus", "garden.visitors.highlightStatus") + event.move(3, "garden.visitorColoredName", "garden.visitors.coloredName") + event.move(3,"garden.visitorHypixelArrivedMessage","garden.visitors.hypixelArrivedMessage") + event.move(3, "garden.visitorHideChat", "garden.visitors.hideChat") + } + } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt index 2bdbdb091..dedd034fa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.visitor import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.CropClickEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent @@ -20,7 +21,7 @@ import kotlin.math.roundToLong import kotlin.time.Duration.Companion.seconds class GardenVisitorTimer { - private val config get() = SkyHanniMod.feature.garden + private val config get() = SkyHanniMod.feature.garden.visitors.timer private val patternNextVisitor = " Next Visitor: §r§b(?<time>.*)".toPattern() private val patternVisitors = "§b§lVisitors: §r§f\\((?<amount>\\d)\\)".toPattern() private var render = "" @@ -147,7 +148,7 @@ class GardenVisitorTimer { fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!isEnabled()) return - config.visitorTimerPos.renderString(render, posLabel = "Garden Visitor Timer") + config.pos.renderString(render, posLabel = "Garden Visitor Timer") } @SubscribeEvent @@ -172,7 +173,15 @@ class GardenVisitorTimer { } } - private fun isSixthVisitorEnabled() = config.visitorTimerSixthVisitorEnabled - private fun isSixthVisitorWarningEnabled() = config.visitorTimerSixthVisitorWarning - private fun isEnabled() = GardenAPI.inGarden() && config.visitorTimerEnabled + private fun isSixthVisitorEnabled() = config.sixthVisitorEnabled + private fun isSixthVisitorWarningEnabled() = config.sixthVisitorWarning + private fun isEnabled() = GardenAPI.inGarden() && config.enabled + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "garden.visitorTimerEnabled", "garden.visitors.timer.enabled") + event.move(3, "garden.visitorTimerSixthVisitorEnabled", "garden.visitors.timer.sixthVisitorEnabled") + event.move(3, "garden.visitorTimerSixthVisitorWarning", "garden.visitors.timer.sixthVisitorWarning") + event.move(3, "garden.visitorTimerPos", "garden.visitors.timer.pos") + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt index 79b1ddb7b..0161d0a67 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.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.data.ItemRenderBackground.Companion.background import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.borderLine import at.hannibal2.skyhanni.events.GuiContainerEvent @@ -36,7 +37,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HideNotClickableItems { - private val config get() = SkyHanniMod.feature.inventory + private val config get() = SkyHanniMod.feature.inventory.hideNotClickable private var hideReason = "" private var reverseColor = false @@ -100,10 +101,10 @@ class HideNotClickableItems { if (slot.stack == null) continue if (hide(chestName, slot.stack)) { - val opacity = config.hideNotClickableOpacity + val opacity = config.opacity val color = LorenzColor.DARK_GRAY.addOpacity(opacity) slot.stack.background = color.rgb - } else if (reverseColor && config.hideNotClickableItemsGreenLine) { + } else if (reverseColor && config.itemsGreenLine) { val color = LorenzColor.GREEN.addOpacity(200) slot.stack.borderLine = color.rgb } @@ -134,7 +135,7 @@ class HideNotClickableItems { LorenzUtils.warning("No hide reason for not clickable item!") } else { event.toolTip.add("§c$hideReason") - if (config.notClickableItemsBypass) { + if (config.itemsBypass) { event.toolTip.add(" §7(Disable with holding the control key)") } } @@ -144,7 +145,7 @@ class HideNotClickableItems { @SubscribeEvent fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { if (isDisabled()) return - if (!config.hideNotClickableItemsBlockClicks) return + if (!config.itemsBlockClicks) return if (bypasssActive()) return if (event.gui !is GuiChest) return val chestName = InventoryUtils.openInventoryName() @@ -166,12 +167,12 @@ class HideNotClickableItems { } } - private fun bypasssActive() = config.notClickableItemsBypass && KeyboardManager.isControlKeyDown() + private fun bypasssActive() = config.itemsBypass && KeyboardManager.isControlKeyDown() private fun isDisabled(): Boolean { if (bypassUntil > System.currentTimeMillis()) return true - return !config.hideNotClickableItems + return !config.items } private fun hide(chestName: String, stack: ItemStack): Boolean { @@ -504,4 +505,14 @@ class HideNotClickableItems { if (result) hideReason = "This item cannot be auctioned!" return result } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "inventory.hideNotClickableItems", "inventory.hideNotClickable.items") + event.move(3, "inventory.hideNotClickableItemsBlockClicks", "inventory.hideNotClickable.itemsBlockClicks") + event.move(3, "inventory.hideNotClickableOpacity", "inventory.hideNotClickable.opacity") + event.move(3, "inventory.notClickableItemsBypass", "inventory.hideNotClickable.itemsBypass") + event.move(3, "inventory.hideNotClickableItemsGreenLine", "inventory.hideNotClickable.itemsGreenLine") + + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt index df8157638..0aefa9740 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.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.RenderItemTipEvent import at.hannibal2.skyhanni.utils.InventoryUtils @@ -16,12 +17,14 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class RngMeterInventory { + private val config get() = SkyHanniMod.feature.inventory.rngMeter + @SubscribeEvent fun onRenderItemTip(event: RenderItemTipEvent) { val chestName = InventoryUtils.openInventoryName() val stack = event.stack - if (SkyHanniMod.feature.inventory.rngMeterFloorName && chestName == "Catacombs RNG Meter") { + if (config.floorName && chestName == "Catacombs RNG Meter") { val name = stack.name ?: return if (name.removeColor() == "RNG Meter") { event.stackTip = stack.getLore()[0].between("(", ")") @@ -34,7 +37,7 @@ class RngMeterInventory { if (!LorenzUtils.inSkyBlock) return val chestName = InventoryUtils.openInventoryName() - if (SkyHanniMod.feature.inventory.rngMeterNoDrop && chestName == "Catacombs RNG Meter") { + if (config.noDrop && chestName == "Catacombs RNG Meter") { for (slot in InventoryUtils.getItemsInOpenChest()) { val stack = slot.stack if (stack.getLore().any { it.contains("You don't have an RNG drop") }) { @@ -43,7 +46,7 @@ class RngMeterInventory { } } - if (SkyHanniMod.feature.inventory.rngMeterSelectedDrop && chestName.endsWith(" RNG Meter")) { + if (config.selectedDrop && chestName.endsWith(" RNG Meter")) { for (slot in InventoryUtils.getItemsInOpenChest()) { val stack = slot.stack if (stack.getLore().any { it.contains("§a§lSELECTED") }) { @@ -52,4 +55,11 @@ class RngMeterInventory { } } } + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"inventory.rngMeterFloorName", "inventory.rngMeter.floorName") + event.move(3,"inventory.rngMeterNoDrop", "inventory.rngMeter.noDrop") + event.move(3,"inventory.rngMeterSelectedDrop", "inventory.rngMeter.selectedDrop") + + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt index afff3b114..b9090c069 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.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.RenderInventoryItemTipEvent import at.hannibal2.skyhanni.utils.InventoryUtils @@ -14,6 +15,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class StatsTuning { + private val config get() = SkyHanniMod.feature.inventory.statsTuning private val patternStatPoints = "§7Stat has: §e(?<amount>\\d+) points?".toPattern() @SubscribeEvent @@ -22,7 +24,7 @@ class StatsTuning { val stack = event.stack - if (SkyHanniMod.feature.inventory.statsTuningTemplateStats && inventoryName == "Stats Tuning") { + if (config.templateStats && inventoryName == "Stats Tuning") { val name = stack.name ?: return if (name == "§aLoad") { var grab = false @@ -50,7 +52,7 @@ class StatsTuning { } } } - if (SkyHanniMod.feature.inventory.statsTuningSelectedStats && inventoryName == "Accessory Bag Thaumaturgy") { + if (config.selectedStats && inventoryName == "Accessory Bag Thaumaturgy") { val name = stack.name ?: return if (name == "§aStats Tuning") { var grab = false @@ -78,7 +80,7 @@ class StatsTuning { } } } - if (SkyHanniMod.feature.inventory.statsTuningPoints && inventoryName == "Stats Tuning") { + if (config.points && inventoryName == "Stats Tuning") { for (line in stack.getLore()) { patternStatPoints.matchMatcher(line) { val points = group("amount") @@ -94,7 +96,7 @@ class StatsTuning { if (!LorenzUtils.inSkyBlock) return val chestName = InventoryUtils.openInventoryName() - if (SkyHanniMod.feature.inventory.statsTuningSelectedTemplate && chestName == "Stats Tuning") { + if (config.selectedTemplate && chestName == "Stats Tuning") { for (slot in InventoryUtils.getItemsInOpenChest()) { val stack = slot.stack val lore = stack.getLore() @@ -105,4 +107,11 @@ class StatsTuning { } } } + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"inventory.statsTuningSelectedStats", "inventory.statsTuning.selectedStats") + event.move(3,"inventory.statsTuningSelectedTemplate", "inventory.statsTuning.selectedTemplate") + event.move(3,"inventory.statsTuningTemplateStats", "inventory.statsTuning.templateStats") + event.move(3,"inventory.statsTuningPoints", "inventory.statsTuning.points") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt index 28696620f..6f428fa64 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/FireVeilWandParticles.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.itemabilities import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.ClickType import at.hannibal2.skyhanni.events.BlockClickEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent @@ -20,7 +21,7 @@ class FireVeilWandParticles { @SubscribeEvent fun onChatPacket(event: ReceiveParticleEvent) { if (!LorenzUtils.inSkyBlock) return - if (SkyHanniMod.feature.itemAbilities.fireVeilWandDisplay == 0) return + if (SkyHanniMod.feature.itemAbilities.fireVeilWands.display == 0) return if (System.currentTimeMillis() > lastClick + 5_500) return if (event.type == EnumParticleTypes.FLAME && event.count == 1 && event.speed == 0f && event.offset.isZero()) { @@ -44,11 +45,17 @@ class FireVeilWandParticles { @SubscribeEvent fun onRenderWorld(event: LorenzRenderWorldEvent) { if (!LorenzUtils.inSkyBlock) return - if (SkyHanniMod.feature.itemAbilities.fireVeilWandDisplay != 1) return + if (SkyHanniMod.feature.itemAbilities.fireVeilWands.display != 1) return if (System.currentTimeMillis() > lastClick + 5_500) return - val color = SkyHanniMod.feature.itemAbilities.fireVeilWandDisplayColor.toChromaColor() + val color = SkyHanniMod.feature.itemAbilities.fireVeilWands.displayColor.toChromaColor() RenderUtils.drawCircle(Minecraft.getMinecraft().thePlayer, event.partialTicks, 3.5, color) } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"itemAbilities.fireVeilWandDisplayColor", "itemAbilities.fireVeilWands.displayColor") + event.move(3,"itemAbilities.fireVeilWandDisplay", "itemAbilities.fireVeilWands.display") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index 02935dac5..c20a478da 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.minion 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 @@ -96,14 +97,14 @@ class MinionFeatures { fun onRenderLastClickedMinion(event: LorenzRenderWorldEvent) { if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return - if (!config.lastClickedMinionDisplay) return + if (!config.lastClickedMinion.display) return - val special = config.lastOpenedMinionColor + val special = config.lastClickedMinion.color val color = Color(SpecialColour.specialToChromaRGB(special), true) val loc = lastMinion if (loc != null) { - val time = config.lastOpenedMinionTime * 1_000 + val time = config.lastClickedMinion.time * 1_000 if (lastMinionOpened + time > System.currentTimeMillis()) { event.drawWaypointFilled( loc.add(-0.5, 0.0, -0.5), @@ -275,7 +276,7 @@ class MinionFeatures { if (!LocationUtils.canSee(playerEyeLocation, location)) continue val lastEmptied = minion.value.lastClicked - if (playerLocation.distance(location) >= config.distance) continue + if (playerLocation.distance(location) >= config.emptiedTime.distance) continue if (config.nameDisplay) { val displayName = minion.value.displayName @@ -285,7 +286,7 @@ class MinionFeatures { event.drawString(location.add(0.0, 0.65, 0.0), name, true) } - if (config.emptiedTimeDisplay && lastEmptied != 0L) { + if (config.emptiedTime.display && lastEmptied != 0L) { val duration = System.currentTimeMillis() - lastEmptied val format = TimeUtils.formatDuration(duration, longName = true) + " ago" val text = "§eHopper Emptied: $format" @@ -338,4 +339,13 @@ class MinionFeatures { LorenzUtils.chat("§e[SkyHanni] Manually reset all private island minion location data!") } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "minions.lastClickedMinionDisplay", "minions.lastClickedMinion.display") + event.move(3, "minions.lastOpenedMinionColor", "minions.lastClickedMinion.color") + event.move(3, "minions.lastOpenedMinionTime", "minions.lastClickedMinion.time") + event.move(3, "minions.emptiedTimeDisplay", "minions.emptiedTime.display") + event.move(3, "minions.distance", "minions.emptiedTime.distance") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt index aac4aff7a..f3014101c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.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.ProfileStorageData import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent @@ -37,7 +38,7 @@ class CurrentPetDisplay { blocked = true } - if (blocked && SkyHanniMod.feature.misc.petDisplay) { + if (blocked && SkyHanniMod.feature.misc.pets.display) { event.blockedReason = "pets" } } @@ -65,9 +66,14 @@ class CurrentPetDisplay { if (!LorenzUtils.inSkyBlock) return if (RiftAPI.inRift()) return - if (!SkyHanniMod.feature.misc.petDisplay) return + if (!SkyHanniMod.feature.misc.pets.display) return val config = ProfileStorageData.profileSpecific ?: return SkyHanniMod.feature.misc.petDisplayPos.renderString(config.currentPet, posLabel = "Current Pet") } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"misc.petDisplay", "misc.pets.display") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt index c94cecee9..3e8626908 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.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.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -28,7 +29,7 @@ import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds class NonGodPotEffectDisplay { - private val config get() = SkyHanniMod.feature.misc + private val config get() = SkyHanniMod.feature.misc.potionEffect private var checkFooter = false private val effectDuration = mutableMapOf<NonGodPotEffect, Timer>() private var display = emptyList<String>() @@ -223,6 +224,13 @@ class NonGodPotEffectDisplay { ) } + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "misc.nonGodPotEffectDisplay", "misc.potionEffect.nonGodPotEffectDisplay") + event.move(3, "misc.nonGodPotEffectShowMixins", "misc.potionEffect.nonGodPotEffectShowMixins") + event.move(3, "misc.nonGodPotEffectPos", "misc.potionEffect.nonGodPotEffectPos") + } + private fun isEnabled() = LorenzUtils.inSkyBlock && config.nonGodPotEffectDisplay && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt index 0e88420c6..00f9ddb14 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.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.ReceiveParticleEvent import at.hannibal2.skyhanni.features.dungeon.DungeonAPI import at.hannibal2.skyhanni.utils.EntityUtils @@ -17,18 +18,18 @@ class ParticleHider { @SubscribeEvent fun onHypExplosions(event: ReceiveParticleEvent) { val distanceToPlayer = event.distanceToPlayer - if (SkyHanniMod.feature.misc.hideFarParticles && distanceToPlayer > 40 && !inM7Boss()) { + if (SkyHanniMod.feature.misc.particleHiders.hideFarParticles && distanceToPlayer > 40 && !inM7Boss()) { event.isCanceled = true return } val type = event.type - if (SkyHanniMod.feature.misc.hideCloseRedstoneparticles && type == EnumParticleTypes.REDSTONE && distanceToPlayer < 2) { + if (SkyHanniMod.feature.misc.particleHiders.hideCloseRedstoneParticles && type == EnumParticleTypes.REDSTONE && distanceToPlayer < 2) { event.isCanceled = true return } - if (SkyHanniMod.feature.misc.hideFireballParticles && (type == EnumParticleTypes.SMOKE_NORMAL || type == EnumParticleTypes.SMOKE_LARGE)) { + if (SkyHanniMod.feature.misc.particleHiders.hideFireballParticles && (type == EnumParticleTypes.SMOKE_NORMAL || type == EnumParticleTypes.SMOKE_LARGE)) { for (entity in EntityUtils.getEntities<EntitySmallFireball>()) { val distance = entity.getLorenzVec().distance(event.location) if (distance < 5) { @@ -38,4 +39,17 @@ class ParticleHider { } } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"misc.hideBlazeParticles", "misc.particleHiders.hideBlazeParticles") + event.move(3, "misc.hideEndermanParticles", "misc.particleHiders.hideEndermanParticles") + event.move(3, "misc.hideFarParticles", "misc.particleHiders.hideFarParticles") + event.move(3, "misc.hideFireballParticles", "misc.particleHiders.hideFireballParticles") + event.move(3, "misc.hideCloseRedstoneparticles", "misc.particleHiders.hideCloseRedstoneParticles") + event.move(3, "misc.hideFireBlockParticles", "misc.particleHiders.hideFireBlockParticles") + event.move(3,"misc.hideSmokeParticles", "misc.particleHiders.hideSmokeParticles") + + } + }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt index e39973d15..010b2530d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.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.utils.ItemUtils.getItemRarityOrNull import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.KeyboardManager @@ -18,7 +19,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class PetExpTooltip { - private val config get() = SkyHanniMod.feature.misc.petExperienceToolTip + private val config get() = SkyHanniMod.feature.misc.pets.petExperienceToolTip private val level100Common = 5_624_785 private val level100Legendary = 25_353_230 private val level200 = 210_255_385 @@ -95,4 +96,10 @@ class PetExpTooltip { return Pair(maxLevel, maxXp) } + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "misc.petExperienceToolTip.petDisplay", "misc.pets.petExperienceToolTip.petDisplay") + event.move(3, "misc.petExperienceToolTip.showAlways", "misc.pets.petExperienceToolTip.showAlways") + event.move(3, "misc.petExperienceToolTip.showGoldenDragonEgg", "misc.pets.petExperienceToolTip.showGoldenDragonEgg") + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt index a18faef7c..f3bb75c46 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.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.LorenzTickEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.test.command.ErrorManager @@ -62,7 +63,7 @@ object QuickModMenuSwitch { if (latestGuiPath != openGui) { latestGuiPath = openGui - if (SkyHanniMod.feature.dev.modMenuLog) { + if (SkyHanniMod.feature.dev.debug.modMenuLog) { LorenzUtils.debug("Open GUI: $latestGuiPath") } } @@ -190,4 +191,9 @@ object QuickModMenuSwitch { } fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(3, "dev.modMenuLog", "dev.debug.modMenuLog") + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt index e13686fba..89245c220 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ThunderSparksHighlight.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.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent @@ -21,6 +22,7 @@ import java.awt.Color class ThunderSparksHighlight { + private val config get() = SkyHanniMod.feature.fishing.thunderSpark private val texture = "ewogICJ0aW1lc3RhbXAiIDogMTY0MzUwNDM3MjI1NiwKICAicHJvZmlsZUlkIiA6ICI2MzMyMDgwZTY3YTI0Y2MxYjE3ZGJhNzZmM2MwMGYxZCIsCiAgInByb2ZpbGVOYW1lIiA6ICJUZWFtSHlkcmEiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2IzMzI4ZDNlOWQ3MTA0MjAzMjI1NTViMTcyMzkzMDdmMTIyNzBhZGY4MWJmNjNhZmM1MGZhYTA0YjVjMDZlMSIsCiAgICAgICJtZXRhZGF0YSIgOiB7CiAgICAgICAgIm1vZGVsIiA6ICJzbGltIgogICAgICB9CiAgICB9CiAgfQp9" private val sparks = mutableListOf<EntityArmorStand>() @@ -39,7 +41,7 @@ class ThunderSparksHighlight { fun onRenderWorld(event: LorenzRenderWorldEvent) { if (!isEnabled()) return - val special = SkyHanniMod.feature.fishing.thunderSparkColor + val special = config.color val color = Color(SpecialColour.specialToChromaRGB(special), true) val playerLocation = LocationUtils.playerLocation() @@ -64,6 +66,12 @@ class ThunderSparksHighlight { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyBlock && SkyHanniMod.feature.fishing.thunderSparkHighlight + return LorenzUtils.inSkyBlock && config.highlight + } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "fishing.thunderSparkHighlight", "fishing.thunderSpark.highlight") + event.move(3, "fishing.thunderSparkColor", "fishing.thunderSpark.color") } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt index 04107c7e2..d4f994a24 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt @@ -127,7 +127,7 @@ object AdvancedPlayerList { } fun ignoreCustomTabList(): Boolean { - val denyKeyPressed = SkyHanniMod.feature.dev.debugEnabled && KeyboardManager.isControlKeyDown() + val denyKeyPressed = SkyHanniMod.feature.dev.debug.enabled && KeyboardManager.isControlKeyDown() return denyKeyPressed || !SkyHanniDebugsAndTests.globalRender } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt index f75b49bca..6c9613f5a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc.items import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent @@ -72,7 +73,7 @@ import java.util.Locale import kotlin.math.roundToLong object EstimatedItemValue { - private val config get() = SkyHanniMod.feature.misc + private val config get() = SkyHanniMod.feature.misc.estimatedItemValues private var display = emptyList<List<Any>>() private val cache = mutableMapOf<ItemStack, List<List<Any>>>() private var lastToolTipTime = 0L @@ -96,8 +97,8 @@ object EstimatedItemValue { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { if (!LorenzUtils.inSkyBlock) return - if (!config.estimatedIemValueEnabled) return - if (!config.estimatedItemValueHotkey.isKeyHeld() && !config.estimatedIemValueAlwaysEnabled) return + if (!config.enabled) return + if (!config.hotkey.isKeyHeld() && !config.alwaysEnabled) return if (System.currentTimeMillis() > lastToolTipTime + 200) return config.itemPriceDataPos.renderStringsAndItems(display, posLabel = "Estimated Item Value") @@ -111,7 +112,7 @@ object EstimatedItemValue { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - config.estimatedIemValueEnchantmentsCap.onToggle { + config.enchantmentsCap.onToggle { cache.clear() } } @@ -119,7 +120,7 @@ object EstimatedItemValue { @SubscribeEvent fun onRenderItemTooltip(event: RenderItemTooltipEvent) { if (!LorenzUtils.inSkyBlock) return - if (!config.estimatedIemValueEnabled) return + if (!config.enabled) return val item = event.stack val oldData = cache[item] @@ -170,7 +171,7 @@ object EstimatedItemValue { if (basePrice == totalPrice) return listOf() - val numberFormat = if (config.estimatedIemValueExactPrice) { + val numberFormat = if (config.exactPrice) { totalPrice.roundToLong().addSeparators() } else { NumberUtil.format(totalPrice) @@ -682,7 +683,7 @@ object EstimatedItemValue { map[" $name §7(§6$format§7)"] = price } - val enchantmentsCap: Int = config.estimatedIemValueEnchantmentsCap.get().toInt() + val enchantmentsCap: Int = config.enchantmentsCap.get().toInt() if (map.isNotEmpty()) { list.add("§7Enchantments: §6" + NumberUtil.format(totalPrice)) var i = 0 @@ -787,4 +788,14 @@ object EstimatedItemValue { list += priceMap.sortedDesc().keys return totalPrice } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "misc.estimatedIemValueEnabled", "misc.estimatedItemValues.enabled") + event.move(3, "misc.estimatedItemValueHotkey", "misc.estimatedItemValues.hotkey") + event.move(3, "misc.estimatedIemValueAlwaysEnabled", "misc.estimatedItemValues.alwaysEnabled") + event.move(3, "misc.estimatedIemValueEnchantmentsCap", "misc.estimatedItemValues.enchantmentsCap") + event.move(3, "misc.estimatedIemValueExactPrice", "misc.estimatedItemValues.exactPrice") + event.move(3,"misc.itemPriceDataPos", "misc.estimatedItemValues.itemPriceDataPos") + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt index 3227edf69..2b5dd5075 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.items import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.utils.InventoryUtils @@ -12,13 +13,13 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class EstimatedWardrobePrice { - private val config get() = SkyHanniMod.feature.misc + private val config get() = SkyHanniMod.feature.misc.estimatedItemValues var data = mutableMapOf<Int, MutableList<ItemStack>>() @SubscribeEvent fun onTooltip(event: LorenzToolTipEvent) { if (!LorenzUtils.inSkyBlock) return - if (!config.estimatedIemValueArmor) return + if (!config.armor) return if (!InventoryUtils.openInventoryName().contains("Wardrobe")) return val slot = event.slot.slotNumber @@ -47,7 +48,7 @@ class EstimatedWardrobePrice { @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!LorenzUtils.inSkyBlock) return - if (!config.estimatedIemValueArmor) return + if (!config.armor) return if (!event.inventoryName.startsWith("Wardrobe")) return val map = mutableMapOf<Int, MutableList<ItemStack>>() @@ -62,4 +63,9 @@ class EstimatedWardrobePrice { } data = map } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"misc.estimatedIemValueArmor", "misc.estimatedItemValues.armor") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt index f9ab78ac1..bc01a8c0d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.slayer.blaze import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent @@ -52,6 +53,11 @@ class BlazeSlayerClearView { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyBlock && SkyHanniMod.feature.slayer.blazeClearView && nearBlaze + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.slayer.blazes.clearView && nearBlaze + } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "slayer.blazeClearView", "slayer.blazes.clearView") } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt index 4c7567d8b..2d8707475 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.slayer.blaze import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.ClickType import at.hannibal2.skyhanni.events.BlockClickEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -36,7 +37,7 @@ class BlazeSlayerDaggerHelper { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return - if (!SkyHanniMod.feature.slayer.blazeHideDaggerWarning) return + if (!SkyHanniMod.feature.slayer.blazes.hellion.hideDaggerWarning) return val message = event.message if (message.matchRegex("§cStrike using the §r(.+) §r§cattunement on your dagger!") || @@ -67,7 +68,7 @@ class BlazeSlayerDaggerHelper { checkActiveDagger() lastNearest = findNearest() - val first = Dagger.entries[SkyHanniMod.feature.slayer.blazeFirstDagger] + val first = Dagger.entries[SkyHanniMod.feature.slayer.blazes.hellion.firstDagger] val second = first.other() textTopLeft = format(holding, true, first) @@ -77,7 +78,7 @@ class BlazeSlayerDaggerHelper { } private fun findNearest(): HellionShield? { - if (!SkyHanniMod.feature.slayer.blazeMarkRightHellionShield) return null + if (!SkyHanniMod.feature.slayer.blazes.hellion.markRightHellionShield) return null if (lastNearestCheck + 100 > System.currentTimeMillis()) return lastNearest lastNearestCheck = System.currentTimeMillis() @@ -193,7 +194,7 @@ class BlazeSlayerDaggerHelper { } private fun isEnabled(): Boolean { - return LorenzUtils.inSkyBlock && SkyHanniMod.feature.slayer.blazeDaggers + return LorenzUtils.inSkyBlock && SkyHanniMod.feature.slayer.blazes.hellion.daggers } @SubscribeEvent @@ -311,6 +312,15 @@ class BlazeSlayerDaggerHelper { ) GlStateManager.popMatrix() } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "slayer.blazeDaggers", "slayer.blazes.hellion.daggers") + event.move(3, "slayer.blazeMarkRightHellionShield", "slayer.blazes.hellion.markRightHellionShield") + event.move(3,"slayer.blazeFirstDagger", "slayer.blazes.hellion.firstDagger") + event.move(3,"slayer.blazeHideDaggerWarning", "slayer.blazes.hellion.hideDaggerWarning") + } + } private fun HellionShield.other(): HellionShield { diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt index d897f0b99..d742c3da1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.slayer.blaze import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.BossHealthChangeEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.damageindicator.BossType @@ -12,7 +13,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class BlazeSlayerFirePitsWarning { - private val config get() = SkyHanniMod.feature.slayer + private val config get() = SkyHanniMod.feature.slayer.blazes companion object { private var lastFirePitsWarning = 0L @@ -64,4 +65,9 @@ class BlazeSlayerFirePitsWarning { BossType.SLAYER_BLAZE_TYPHOEUS_3, BossType.SLAYER_BLAZE_TYPHOEUS_4, ) + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "slayer.firePitsWarning", "slayer.blazes.firePitsWarning") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt index bddbc4e91..2a1f2aa74 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/HellionShieldHelper.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.slayer.blaze import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.RenderMobColoredEvent import at.hannibal2.skyhanni.events.ResetEntityHurtEvent import at.hannibal2.skyhanni.events.withAlpha @@ -17,7 +18,7 @@ class HellionShieldHelper { @SubscribeEvent fun onRenderMobColored(event: RenderMobColoredEvent) { if (!LorenzUtils.inSkyBlock) return - if (!SkyHanniMod.feature.slayer.blazeColoredMobs) return + if (!SkyHanniMod.feature.slayer.blazes.hellion.coloredMobs) return val shield = hellionShieldMobs.getOrDefault(event.entity, null) ?: return event.color = shield.color.toColor().withAlpha(80) @@ -26,7 +27,7 @@ class HellionShieldHelper { @SubscribeEvent fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { if (!LorenzUtils.inSkyBlock) return - if (!SkyHanniMod.feature.slayer.blazeColoredMobs) return + if (!SkyHanniMod.feature.slayer.blazes.hellion.coloredMobs) return hellionShieldMobs.getOrDefault(event.entity, null) ?: return event.shouldReset = true @@ -39,4 +40,9 @@ fun EntityLiving.setHellionShield(shield: HellionShield?) { } else { HellionShieldHelper.hellionShieldMobs.remove(this) } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "slayer.blazeColoredMobs", "slayer.blazes.hellion.coloredMobs") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt index 36033f41e..c6d04a76c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.slayer.enderman import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent @@ -37,7 +38,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds class EndermanSlayerFeatures { - private val config get() = SkyHanniMod.feature.slayer + private val config get() = SkyHanniMod.feature.slayer.endermen private val beaconConfig get() = config.endermanBeaconConfig private val endermenWithBeacons = mutableListOf<EntityEnderman>() private var flyingBeacons = listOf<EntityArmorStand>() @@ -72,7 +73,7 @@ class EndermanSlayerFeatures { } } - if (config.endermanHighlightNukekebi && entity.inventory.any { it?.getSkullTexture() == nukekubiSkulTexture } && entity !in nukekubiSkulls) { + if (config.highlightNukekebi && entity.inventory.any { it?.getSkullTexture() == nukekubiSkulTexture } && entity !in nukekubiSkulls) { nukekubiSkulls.add(entity) logger.log("Added Nukekubi skulls at ${entity.getLorenzVec()}") } @@ -93,7 +94,7 @@ class EndermanSlayerFeatures { event.color = beaconConfig.beaconColor.toChromaColor().withAlpha(1) } - if (config.endermanHighlightNukekebi && event.entity in nukekubiSkulls) { + if (config.highlightNukekebi && event.entity in nukekubiSkulls) { event.color = LorenzColor.GOLD.toColor().withAlpha(1) } } @@ -116,7 +117,7 @@ class EndermanSlayerFeatures { event.draw3DLine( event.exactPlayerEyeLocation(), location.add(0.5, 1.0, 0.5), - beaconConfig.lneColor.toChromaColor(), + beaconConfig.lineColor.toChromaColor(), beaconConfig.lineWidth, true ) @@ -142,14 +143,14 @@ class EndermanSlayerFeatures { event.draw3DLine( event.exactPlayerEyeLocation(), beaconLocation.add(0.5, 1.0, 0.5), - beaconConfig.lneColor.toChromaColor(), + beaconConfig.lineColor.toChromaColor(), beaconConfig.lineWidth, true ) } } - config.endermanHighlightNukekebi + config.highlightNukekebi for (skull in nukekubiSkulls) { if (!skull.isDead) { event.drawDynamicText( @@ -215,4 +216,15 @@ class EndermanSlayerFeatures { sittingBeacon = emptyMap() logger.log("Reset everything (world change)") } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3, "slayer.endermanBeaconConfig.highlightBeacon", "slayer.endermen.endermanBeaconConfig.highlightBeacon") + event.move(3, "slayer.endermanBeaconConfig.beaconColor", "slayer.endermen.endermanBeaconConfig.beaconColor") + event.move(3, "slayer.endermanBeaconConfig.showWarning", "slayer.endermen.endermanBeaconConfig.showWarning") + event.move(3, "slayer.endermanBeaconConfig.showLine", "slayer.endermen.endermanBeaconConfig.showLine") + event.move(3, "slayer.endermanBeaconConfig.lneColor", "slayer.endermen.endermanBeaconConfig.lineColor") + event.move(3, "slayer.endermanBeaconConfig.lineWidth", "slayer.endermen.endermanBeaconConfig.lineWidth") + event.move(3, "slayer.endermanHighlightNukekebi", "slayer.endermen.highlightNukekebi") + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt index 58ef50f08..887f1177c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerHideParticles.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.slayer.enderman import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent @@ -45,5 +46,10 @@ class EndermanSlayerHideParticles { private fun LorenzVec.distanceToNearestEnderman() = endermanLocations.minOfOrNull { it.distanceSq(this) } - fun isEnabled() = IslandType.THE_END.isInIsland() && SkyHanniMod.feature.slayer.endermanHideParticles + fun isEnabled() = IslandType.THE_END.isInIsland() && SkyHanniMod.feature.slayer.endermen.hideParticles + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent){ + event.move(3,"slayer.endermanHideParticles", "slayer.endermen.hideParticles") + } } |