aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/overlays/YawDisplayHud.kt
blob: 458ebea39c707f757bb277cfb97ffdd335d2da6d (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
30
package dulkirmod.overlays

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(false) {
    override fun getLines(lines: MutableList<String>?, example: Boolean) {
        if (!Utils.isInSkyblock()) return
        if (!DulkirConfig.showYawEverywhere && 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))
    }
}