aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/events/HudRenderEvent.kt
blob: a3973787542dcd48dc4492c67f59a4d179643c92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package moe.nea.firmament.events

import net.minecraft.client.gui.GuiGraphics
import net.minecraft.client.DeltaTracker
import net.minecraft.world.level.GameType
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: GuiGraphics, val tickDelta: DeltaTracker) : FirmamentEvent.Cancellable() {
	val isRenderingHud = !MC.options.hideGui
	val isRenderingCursor = MC.interactionManager?.playerMode != GameType.SPECTATOR && isRenderingHud

	init {
		if (!isRenderingHud)
			cancel()
	}

	companion object : FirmamentEventBus<HudRenderEvent>()
}