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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
package moe.nea.firmament.gui.config
import moe.nea.jarvis.api.JarvisHud
import org.joml.Matrix3x2f
import org.joml.Vector2i
import org.joml.Vector2ic
import kotlinx.serialization.Serializable
import net.minecraft.text.Text
import net.minecraft.util.Identifier
import moe.nea.firmament.jarvis.JarvisIntegration
@Serializable
data class HudPosition(
var x: Int,
var y: Int,
var scale: Float,
)
data class HudMeta(
val position: HudPosition,
private val id: Identifier,
private val label: Text,
private val width: Int,
private val height: Int,
) : JarvisHud, JarvisHud.Scalable {
override fun getLabel(): Text = label
override fun getUnscaledWidth(): Int {
return width
}
override fun getUnscaledHeight(): Int {
return height
}
override fun getHudId(): Identifier {
return id
}
override fun getPosition(): Vector2ic {
return Vector2i(position.x, position.y)
}
override fun setPosition(p0: Vector2ic) {
position.x = p0.x()
position.y = p0.y()
}
override fun isEnabled(): Boolean {
return true // TODO: this should be actually truthful, if possible
}
override fun isVisible(): Boolean {
return true // TODO: this should be actually truthful, if possible
}
override fun getScale(): Float = position.scale
override fun setScale(newScale: Float) {
position.scale = newScale
}
fun applyTransformations(matrix4f: Matrix3x2f) {
applyTransformations(JarvisIntegration.jarvis, matrix4f)
}
}
|