From 60cb0823bcc72f901c1e8fdc3a35b2cb59809989 Mon Sep 17 00:00:00 2001 From: Stella Date: Thu, 30 May 2024 16:40:33 -0700 Subject: Feature: In Water Display (#1892) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 ++ .../config/features/stranded/StrandedConfig.java | 12 +++++++++++ .../skyhanni/features/misc/InWaterDisplay.kt | 23 ++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/InWaterDisplay.kt (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 311c65807..e0f4d1240 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -348,6 +348,7 @@ import at.hannibal2.skyhanni.features.misc.FixNEUHeavyPearls import at.hannibal2.skyhanni.features.misc.HideArmor import at.hannibal2.skyhanni.features.misc.HideFarEntities import at.hannibal2.skyhanni.features.misc.InGameDateDisplay +import at.hannibal2.skyhanni.features.misc.InWaterDisplay import at.hannibal2.skyhanni.features.misc.JoinCrystalHollows import at.hannibal2.skyhanni.features.misc.LesserOrbHider import at.hannibal2.skyhanni.features.misc.LockMouseLook @@ -937,6 +938,7 @@ class SkyHanniMod { loadModule(HighlightPlaceableNpcs()) loadModule(PresentWaypoints()) loadModule(MiningEventTracker()) + loadModule(InWaterDisplay) loadModule(MiningNotifications) loadModule(JyrreTimer()) loadModule(TotemOfCorruption()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/stranded/StrandedConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/stranded/StrandedConfig.java index 595a0f173..f5e37c0c6 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/stranded/StrandedConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/stranded/StrandedConfig.java @@ -1,8 +1,10 @@ package at.hannibal2.skyhanni.config.features.stranded; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; +import io.github.notenoughupdates.moulconfig.annotations.ConfigLink; import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; public class StrandedConfig { @@ -11,4 +13,14 @@ public class StrandedConfig { @ConfigEditorBoolean @FeatureToggle public boolean highlightPlaceableNpcs = false; + + @Expose + @ConfigOption(name = "In Water Display", desc = "Displays if the Player is in water.") + @ConfigEditorBoolean + @FeatureToggle + public boolean inWaterDisplay = false; + + @Expose + @ConfigLink(owner = StrandedConfig.class, field = "inWaterDisplay") + public Position inWaterPosition = new Position(20, 20); } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/InWaterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/InWaterDisplay.kt new file mode 100644 index 000000000..f5e15b04a --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/InWaterDisplay.kt @@ -0,0 +1,23 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings +import net.minecraft.client.Minecraft +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +object InWaterDisplay { + + private val config get() = SkyHanniMod.feature.misc.stranded + + @SubscribeEvent + fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { + if (!isEnabled()) return + + val text = "§7In Water: " + if (Minecraft.getMinecraft().thePlayer.isInWater) "§aTrue" else "§cFalse" + config.inWaterPosition.renderStrings(listOf(text), posLabel = "In Water Display") + } + + private fun isEnabled() = LorenzUtils.inSkyBlock && config.inWaterDisplay +} -- cgit