Add a clock

This commit is contained in:
Username404-59 2021-05-05 21:52:51 +02:00
parent 3c647aa44b
commit 6539e25854
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 25 additions and 4 deletions

View File

@ -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
)
}
}
}
}
}