aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/Huds/YawDisplayHud.kt
blob: 610ee084ab39d2c0d7aa681d68db24b58e3b574b (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
25
26
27
28
29
package dulkirmod.Huds

import cc.polyfrost.oneconfig.hud.TextHud
import dulkirmod.DulkirMod.Companion.mc
import dulkirmod.config.DulkirConfig
import dulkirmod.utils.TabListUtils
import dulkirmod.utils.Utils

class YawDisplayHud : TextHud(true) {
    override fun getLines(lines: MutableList<String>?, example: Boolean) {
        if (!Utils.isInSkyblock()) return
        if (TabListUtils.area != "Garden") return
        val pitch = mc.thePlayer.rotationPitch
        var yaw = mc.thePlayer.rotationYaw % 360f

        if (yaw < -180.0f) {
            yaw += 360.0f;
        } else if (yaw > 180.0f) {
            yaw -= 360.0f;
        }
        if (DulkirConfig.yaw3Decimals) {
            lines?.add(0, String.format("Yaw: %.3f", yaw))
        } else {
            lines?.add(0, String.format("Yaw: %.2f", yaw))
        }
        if (DulkirConfig.showPitch)
            lines?.add(1, String.format("Pitch: %.2f", pitch))
    }
}