diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-11-04 20:58:48 +0100 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-11-04 20:59:02 +0100 |
| commit | 9428555deba85279a1bb843482c5fd7634fb8d63 (patch) | |
| tree | 7174250a7e2c02ef32fa3f30c28d1067d3229963 | |
| parent | d403eb70e95d66c43e8b5266b3e0e8d495d6fd93 (diff) | |
| download | Firmament-9428555deba85279a1bb843482c5fd7634fb8d63.tar.gz Firmament-9428555deba85279a1bb843482c5fd7634fb8d63.tar.bz2 Firmament-9428555deba85279a1bb843482c5fd7634fb8d63.zip | |
feat: hide huds in f1
fixes https://github.com/nea89o/Firmament/issues/317
| -rw-r--r-- | src/main/kotlin/events/HudRenderEvent.kt | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/kotlin/events/HudRenderEvent.kt b/src/main/kotlin/events/HudRenderEvent.kt index a773a93..5919dae 100644 --- a/src/main/kotlin/events/HudRenderEvent.kt +++ b/src/main/kotlin/events/HudRenderEvent.kt @@ -1,5 +1,3 @@ - - package moe.nea.firmament.events import net.minecraft.client.gui.DrawContext @@ -10,8 +8,14 @@ import moe.nea.firmament.util.MC /** * Called when hud elements should be rendered, before the screen, but after the world. */ -data class HudRenderEvent(val context: DrawContext, val tickDelta: RenderTickCounter) : FirmamentEvent() { +data class HudRenderEvent(val context: DrawContext, val tickDelta: RenderTickCounter) : FirmamentEvent.Cancellable() { val isRenderingHud = !MC.options.hudHidden val isRenderingCursor = MC.interactionManager?.currentGameMode != GameMode.SPECTATOR && isRenderingHud - companion object : FirmamentEventBus<HudRenderEvent>() + + init { + if (!isRenderingHud) + cancel() + } + + companion object : FirmamentEventBus<HudRenderEvent>() } |
