aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/dulkirfabric/util/render/HudElement.kt
blob: 824c745cb742d712e62999750be09490b23a65e9 (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
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
package com.dulkirfabric.util.render

import kotlinx.serialization.Serializable
import moe.nea.jarvis.api.JarvisHud
import moe.nea.jarvis.api.JarvisScalable
import net.minecraft.text.Text

class HudElement (var positioning: Positioning,
                  private val label: Text,
                  private val width: Int,
                  private val height: Int
    ): JarvisHud, JarvisScalable {

    @Serializable
    data class Positioning(
        var x: Double,
        var y: Double,
        var scale: Float
    )

    override fun getX(): Double {
        return positioning.x
    }

    override fun setX(newX: Double) {
        positioning.x = newX
    }

    override fun getY(): Double {
        return positioning.y
    }

    override fun setY(newY: Double) {
        positioning.y = newY
    }

    override fun getLabel(): Text {
        return label
    }

    override fun getWidth(): Int {
        return width
    }

    override fun getHeight(): Int {
        return height
    }

    override fun getScale(): Float {
        return positioning.scale
    }

    override fun setScale(newScale: Float) {
        positioning.scale = newScale
    }

}