aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/dulkirfabric/hud/SpeedOverlay.kt
blob: 53aca5061b66782a0ae2937630777c4f316ce868 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.dulkirfabric.hud

import com.dulkirfabric.DulkirModFabric.mc
import com.dulkirfabric.config.DulkirConfig
import com.dulkirfabric.events.HudRenderEvent
import com.dulkirfabric.util.TablistUtils
import meteordevelopment.orbit.EventHandler
import moe.nea.jarvis.api.Point
import net.minecraft.text.Text

object SpeedOverlay {
    private val speedHud = DulkirConfig.hudElement("SpeedHud", Text.literal("Speed"), 24 + 4, 11,
        Point(0.3669986675110943, 0.9857798862704453), 1.6367052f)

    @EventHandler
    fun onHudRender(event: HudRenderEvent) {
        val context = event.context
        val matrices = context.matrices
        matrices.push()
        speedHud.applyTransformations(matrices)
        context.drawText(mc.textRenderer, Text.literal(TablistUtils.persistentInfo.speed),0, 1, -1, true)
        matrices.pop()
    }
}