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 --- .../skyhanni/features/nether/ashfang/AshfangBlazes.kt | 15 ++++++++++++--- .../features/nether/ashfang/AshfangFreezeCooldown.kt | 14 +++++++++++--- .../features/nether/ashfang/AshfangHideDamageIndicator.kt | 11 ++++++++--- .../features/nether/ashfang/AshfangHideParticles.kt | 9 ++++++++- .../features/nether/ashfang/AshfangNextResetCooldown.kt | 13 ++++++++++--- 5 files changed, 49 insertions(+), 13 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/nether') 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