aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/overlays/YawDisplayHud.kt
blob: abed145b394b8af9d9a95ee8d0db2e81c3bd1b9a (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.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 (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))
    }
}