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/misc | |
| 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/misc')
9 files changed, 87 insertions, 21 deletions
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 |
