From 8a24244b8e19830b074b8bc739abd1cc8c70fe98 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 16 Sep 2023 20:15:49 +0200 Subject: migrate remaining ashfang config into crimson isle --- .../at/hannibal2/skyhanni/config/Features.java | 4 -- .../skyhanni/config/features/AshfangConfig.java | 52 ---------------------- .../config/features/CrimsonIsleConfig.java | 51 +++++++++++++++++++++ .../features/nether/ashfang/AshfangBlazes.kt | 15 +++++-- .../nether/ashfang/AshfangFreezeCooldown.kt | 14 ++++-- .../nether/ashfang/AshfangHideDamageIndicator.kt | 11 +++-- .../nether/ashfang/AshfangHideParticles.kt | 9 +++- .../nether/ashfang/AshfangNextResetCooldown.kt | 13 ++++-- 8 files changed, 100 insertions(+), 69 deletions(-) delete mode 100644 src/main/java/at/hannibal2/skyhanni/config/features/AshfangConfig.java (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index cd6c14488..34e8d76a1 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -67,10 +67,6 @@ public class Features extends Config { @Category(name = "Summonings", desc = "Mobs you revive.") public SummoningsConfig summonings = new SummoningsConfig(); - @Expose - @Category(name = "Ashfang", desc = "Ashfang fight in Crimson Isle.") - public AshfangConfig ashfang = new AshfangConfig(); - @Expose @Category(name = "Crimson Isle", desc = "Things to do on the Crimson Isle/Nether island.") public CrimsonIsleConfig crimsonIsle = new CrimsonIsleConfig(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/AshfangConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/AshfangConfig.java deleted file mode 100644 index 99edc22e2..000000000 --- a/src/main/java/at/hannibal2/skyhanni/config/features/AshfangConfig.java +++ /dev/null @@ -1,52 +0,0 @@ -package at.hannibal2.skyhanni.config.features; - -import at.hannibal2.skyhanni.config.FeatureToggle; -import at.hannibal2.skyhanni.config.core.config.Position; -import com.google.gson.annotations.Expose; -import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; -import io.github.moulberry.moulconfig.annotations.ConfigOption; - -public class AshfangConfig { - - @Expose - @ConfigOption(name = "Freeze", desc = "Show the cooldown for how long Ashfang blocks your abilities.") - @ConfigEditorBoolean - @FeatureToggle - public boolean freezeCooldown = false; - - @Expose - public Position freezeCooldownPos = new Position(10, 10, false, true); - - @Expose - @ConfigOption(name = "Reset Time", desc = "Show the cooldown until Ashfang pulls his underlings back.") - @ConfigEditorBoolean - @FeatureToggle - public boolean nextResetCooldown = false; - - @Expose - public Position nextResetCooldownPos = new Position(10, 10, false, true); - - @Expose - @ConfigOption(name = "Highlight Blazes", desc = "Highlight the different blazes in their respective colors.") - @ConfigEditorBoolean - @FeatureToggle - public boolean highlightBlazes = false; - - @Expose - @ConfigOption(name = "Hide Particles", desc = "Hide particles around the Ashfang boss.") - @ConfigEditorBoolean - @FeatureToggle - public boolean hideParticles = false; - - @Expose - @ConfigOption(name = "Hide Names", desc = "Hide the names of full health blazes around Ashfang (only useful when highlight blazes is enabled)") - @ConfigEditorBoolean - @FeatureToggle - public boolean hideNames = false; - - @Expose - @ConfigOption(name = "Hide Damage", desc = "Hide damage splashes around Ashfang.") - @ConfigEditorBoolean - @FeatureToggle - public boolean hideDamageSplash = false; -} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/CrimsonIsleConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/CrimsonIsleConfig.java index 70167e5a6..3826f87b0 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/CrimsonIsleConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/CrimsonIsleConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.Accordion; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -53,5 +54,55 @@ public class CrimsonIsleConfig { @ConfigEditorColour public String color = "0:245:85:255:85"; } + + @ConfigOption(name = "Hide Stuff", desc = "") + @Accordion + @Expose + public HideAshfangConfig hide = new HideAshfangConfig(); + + public static class HideAshfangConfig { + + @Expose + @ConfigOption(name = "Hide Particles", desc = "Hide particles around the Ashfang boss.") + @ConfigEditorBoolean + @FeatureToggle + public boolean particles = false; + + @Expose + @ConfigOption(name = "Hide Full Names", desc = "Hide the names of full health blazes around Ashfang (only useful when highlight blazes is enabled)") + @ConfigEditorBoolean + @FeatureToggle + public boolean fullNames = false; + + @Expose + @ConfigOption(name = "Hide Damage Splash", desc = "Hide damage splashes around Ashfang.") + @ConfigEditorBoolean + @FeatureToggle + public boolean damageSplash = false; + } + + @Expose + @ConfigOption(name = "Highlight Blazes", desc = "Highlight the different blazes in their respective colors.") + @ConfigEditorBoolean + @FeatureToggle + public boolean highlightBlazes = false; + + @Expose + @ConfigOption(name = "Freeze Cooldown", desc = "Show the cooldown for how long Ashfang blocks your abilities.") + @ConfigEditorBoolean + @FeatureToggle + public boolean freezeCooldown = false; + + @Expose + public Position freezeCooldownPos = new Position(10, 10, false, true); + + @Expose + @ConfigOption(name = "Reset Time", desc = "Show the cooldown until Ashfang pulls his underlings back.") + @ConfigEditorBoolean + @FeatureToggle + public boolean nextResetCooldown = false; + + @Expose + public Position nextResetCooldownPos = new Position(10, 10, false, true); } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt index e6d57a184..1375dad47 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangBlazes.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether.ashfang import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.features.damageindicator.BossType import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager @@ -16,6 +17,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AshfangBlazes { + private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang private val blazeColor = mutableMapOf() private val blazeArmorStand = mutableMapOf() @@ -73,7 +75,7 @@ class AshfangBlazes { @SubscribeEvent fun onRenderMobColored(event: RenderMobColoredEvent) { if (!isEnabled()) return - if (!SkyHanniMod.feature.ashfang.highlightBlazes) return + if (!config.highlightBlazes) return val entity = event.entity event.color = blazeColor[entity]?.toColor()?.withAlpha(40) ?: 0 } @@ -81,7 +83,7 @@ class AshfangBlazes { @SubscribeEvent fun onResetEntityHurtTime(event: ResetEntityHurtEvent) { if (!isEnabled()) return - if (!SkyHanniMod.feature.ashfang.highlightBlazes) return + if (!config.highlightBlazes) return val entity = event.entity if (entity in blazeColor) { event.shouldReset = true @@ -91,7 +93,7 @@ class AshfangBlazes { @SubscribeEvent(priority = EventPriority.HIGH) fun onRenderLiving(event: RenderLivingEvent.Specials.Pre) { if (!isEnabled()) return - if (!SkyHanniMod.feature.ashfang.hideNames) return + if (!config.hide.fullNames) return val entity = event.entity if (entity !is EntityArmorStand) return @@ -108,6 +110,13 @@ class AshfangBlazes { blazeArmorStand.clear() } + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "ashfang.nextResetCooldown", "crimsonIsle.ashfang.nextResetCooldown") + event.move(2, "ashfang.highlightBlazes", "crimsonIsle.ashfang.highlightBlazes") + event.move(2, "ashfang.hideNames", "crimsonIsle.ashfang.hide.fullNames") + } + private fun isEnabled(): Boolean { return LorenzUtils.inSkyBlock && DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt index bb766f36c..70514f8a2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether.ashfang import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.damageindicator.BossType @@ -12,8 +13,9 @@ import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AshfangFreezeCooldown { + private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang - var lastHit = 0L + private var lastHit = 0L @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { @@ -34,15 +36,21 @@ class AshfangFreezeCooldown { val remainingLong = maxDuration - duration if (remainingLong > 0) { val format = TimeUtils.formatDuration(remainingLong, showMilliSeconds = true) - SkyHanniMod.feature.ashfang.freezeCooldownPos.renderString( + config.freezeCooldownPos.renderString( "§cAshfang Freeze: §a$format", posLabel = "Ashfang Freeze Cooldown" ) } } + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "ashfang.freezeCooldown", "crimsonIsle.ashfang.freezeCooldown") + event.move(2, "ashfang.freezeCooldownPos", "crimsonIsle.ashfang.freezeCooldownPos") + } + private fun isEnabled(): Boolean { - return LorenzUtils.inSkyBlock && SkyHanniMod.feature.ashfang.freezeCooldown && + return LorenzUtils.inSkyBlock && config.freezeCooldown && DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) } } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt index 0eb6ac920..d40f3131e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideDamageIndicator.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether.ashfang import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.features.damageindicator.BossType import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.utils.LorenzUtils @@ -20,8 +21,12 @@ class AshfangHideDamageIndicator { } } - private fun isEnabled(): Boolean { - return LorenzUtils.inSkyBlock && SkyHanniMod.feature.ashfang.hideDamageSplash && - DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "ashfang.hideDamageSplash", "crimsonIsle.ashfang.hide.damageSplash") } + + private fun isEnabled() = + LorenzUtils.inSkyBlock && SkyHanniMod.feature.crimsonIsle.ashfang.hide.damageSplash && + DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt index 82d5113c4..f51ce004e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether.ashfang 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 @@ -48,5 +49,11 @@ class AshfangHideParticles { } } - private fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.ashfang.hideParticles && nearAshfang + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "ashfang.hideParticles", "crimsonIsle.ashfang.hide.particles") + } + + private fun isEnabled() = + LorenzUtils.inSkyBlock && SkyHanniMod.feature.crimsonIsle.ashfang.hide.particles && nearAshfang } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt index 47eb05f18..0f51a37fb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangNextResetCooldown.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether.ashfang import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent @@ -15,7 +16,7 @@ import net.minecraft.entity.item.EntityArmorStand import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AshfangNextResetCooldown { - + private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang private var spawnTime = 1L @SubscribeEvent @@ -37,7 +38,7 @@ class AshfangNextResetCooldown { val remainingTime = spawnTime + 46_100 - System.currentTimeMillis() if (remainingTime > 0) { val format = TimeUtils.formatDuration(remainingTime, TimeUnit.SECOND, showMilliSeconds = true) - SkyHanniMod.feature.ashfang.nextResetCooldownPos.renderString( + config.nextResetCooldownPos.renderString( "§cAshfang next reset in: §a$format", posLabel = "Ashfang Reset Cooldown" ) @@ -51,8 +52,14 @@ class AshfangNextResetCooldown { spawnTime = -1 } + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "ashfang.nextResetCooldown", "crimsonIsle.ashfang.nextResetCooldown") + event.move(2, "ashfang.nextResetCooldownPos", "crimsonIsle.ashfang.nextResetCooldownPos") + } + private fun isEnabled(): Boolean { - return LorenzUtils.inSkyBlock && SkyHanniMod.feature.ashfang.nextResetCooldown && + return LorenzUtils.inSkyBlock && config.nextResetCooldown && DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG) } } \ No newline at end of file -- cgit