diff options
author | J10a1n15 <45315647+j10a1n15@users.noreply.github.com> | 2024-04-15 18:37:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-15 18:37:22 +0200 |
commit | 15e454fbf1b88611025317d318c9224cdf9db9f4 (patch) | |
tree | cb9100efcc3c88d8a7e9be74c76a568753df3b98 /src/main/java | |
parent | 66b98b62ec0ef0aa56d47af48131d661d43de579 (diff) | |
download | skyhanni-15e454fbf1b88611025317d318c9224cdf9db9f4.tar.gz skyhanni-15e454fbf1b88611025317d318c9224cdf9db9f4.tar.bz2 skyhanni-15e454fbf1b88611025317d318c9224cdf9db9f4.zip |
Fix: Fixed Totem of Corruption Overlay not getting cleared on disable (#1449)
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/fishing/TotemOfCorruptionConfig.java | 3 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt | 19 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/TotemOfCorruptionConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/TotemOfCorruptionConfig.java index a9f125356..923e2a5e5 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/TotemOfCorruptionConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/TotemOfCorruptionConfig.java @@ -9,6 +9,7 @@ import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDropdown; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider; import io.github.notenoughupdates.moulconfig.annotations.ConfigLink; import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; +import io.github.notenoughupdates.moulconfig.observer.Property; public class TotemOfCorruptionConfig { @@ -18,7 +19,7 @@ public class TotemOfCorruptionConfig { "\n§cThis needs to be enabled for the other options to work.") @ConfigEditorBoolean @FeatureToggle - public boolean showOverlay = true; + public Property<Boolean> showOverlay = Property.of(true); @Expose @ConfigOption(name = "Distance Threshold", desc = "The minimum distance to the Totem of Corruption for the overlay." + diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt index b6da38ccd..b0ff26ef0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/TotemOfCorruption.kt @@ -2,11 +2,14 @@ package at.hannibal2.skyhanni.features.fishing import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.features.fishing.TotemOfCorruptionConfig.OutlineType +import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent +import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor +import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzUtils @@ -99,6 +102,20 @@ class TotemOfCorruption { } } + @SubscribeEvent + fun onConfigLoad(event: ConfigLoadEvent) { + config.showOverlay.onToggle { + display = emptyList() + totems = emptyList() + } + } + + @SubscribeEvent + fun onWorldChange(event: LorenzWorldChangeEvent) { + display = emptyList() + totems = emptyList() + } + private fun getTimeRemaining(totem: EntityArmorStand): Duration? = EntityUtils.getEntitiesNearby<EntityArmorStand>(totem.getLorenzVec(), 2.0) .firstNotNullOfOrNull { entity -> @@ -143,7 +160,7 @@ class TotemOfCorruption { Totem(totem.getLorenzVec(), timeRemaining, owner) } - private fun isOverlayEnabled() = LorenzUtils.inSkyBlock && config.showOverlay + private fun isOverlayEnabled() = LorenzUtils.inSkyBlock && config.showOverlay.get() private fun isHideParticlesEnabled() = LorenzUtils.inSkyBlock && config.hideParticles private fun isEffectiveAreaEnabled() = LorenzUtils.inSkyBlock && config.outlineType != OutlineType.NONE } |