diff --git a/common/src/main/kotlin/fr/username404/snowygui/misc/addComponents.kt b/common/src/main/kotlin/fr/username404/snowygui/misc/addComponents.kt index ba3ba8b..3c16601 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/misc/addComponents.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/misc/addComponents.kt @@ -1,14 +1,22 @@ package fr.username404.snowygui.misc +import com.mojang.blaze3d.vertex.PoseStack import fr.username404.snowygui.ClickGui +import fr.username404.snowygui.Snowy.Companion.onEvent import fr.username404.snowygui.config.Configuration +import fr.username404.snowygui.gui.FontUtil import fr.username404.snowygui.newBox import io.github.config4k.getValue +import kotlinx.datetime.Clock +import kotlinx.datetime.TimeZone +import kotlinx.datetime.toLocalDateTime import net.minecraft.client.Minecraft object Storage { + val currentTimezone = TimeZone.currentSystemDefault() private var oldGamma = -1.0 private const val redColor = 0x660000 + var clock: Boolean = false; private set var hurtCamera: Boolean = true; private set private val riskyCheats: Boolean by Configuration.obtained @@ -22,18 +30,31 @@ object Storage { 1400.0 } else oldGamma } - } + }, "Clock" to { clock = !clock }, ), ) if (riskyCheats) { addComps( newBox("snowy.clickbox.risky.camera", color = redColor).addButtons( - "NoHurtCamera" to { hurtCamera = !hurtCamera } + "NoHurtCamera" to { hurtCamera = !hurtCamera }, ), newBox("snowy.clickbox.risky.movement", color = redColor).addButtons( - "NoGravity" to { Minecraft.getInstance().player?.let { it.isNoGravity = !it.isNoGravity } } - ) + "NoGravity" to { Minecraft.getInstance().player?.let { it.isNoGravity = !it.isNoGravity } }, + ), ) } } + init { + onEvent("HudRender") { + if (clock) { + with(Clock.System.now().toLocalDateTime(currentTimezone)) { + FontUtil.drawScaled(it.first() as PoseStack, + "$hour:$minute:${second.let { if (it > 10) it else "0$it" }}", + 5.0, 5.0, + 0.85F, color = 0xe69500 + ) + } + } + } + } } \ No newline at end of file