Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: In Water Display #1892

Merged
merged 7 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,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
Expand Down Expand Up @@ -920,6 +921,7 @@ class SkyHanniMod {
loadModule(HighlightPlaceableNpcs())
loadModule(PresentWaypoints())
loadModule(MiningEventTracker())
loadModule(InWaterDisplay())
loadModule(MiningNotifications)
loadModule(JyrreTimer())
loadModule(TotemOfCorruption())
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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);
}
Original file line number Diff line number Diff line change
@@ -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

class InWaterDisplay {

private val config get() = SkyHanniMod.feature.misc.stranded

@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
if (!isEnabled()) return

val text = "In Water: " + if (Minecraft.getMinecraft().thePlayer.isInWater) "§aTrue" else "§cFalse"
config.inWaterPosition.renderStrings(listOf(text), posLabel = "In Water Display")
}

private fun isEnabled() = config.inWaterDisplay && LorenzUtils.inSkyBlock
}
Loading