Add a companion object to Element.kt and remove the rendering package
This commit is contained in:
parent
c50ce0696f
commit
bf5c276178
|
@ -1,12 +1,19 @@
|
|||
package fr.username404.snowygui.gui
|
||||
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder
|
||||
import com.mojang.blaze3d.vertex.PoseStack
|
||||
import com.mojang.blaze3d.vertex.Tesselator
|
||||
|
||||
fun interface Renderable { fun render(poseStack: PoseStack?) }
|
||||
abstract class Element(
|
||||
var x: Int, var y: Int,
|
||||
val width: Int, val height: Int
|
||||
): Renderable {
|
||||
companion object {
|
||||
@JvmStatic protected val tessellator: Tesselator = Tesselator.getInstance()
|
||||
@JvmStatic protected val buffer: BufferBuilder = tessellator.builder
|
||||
const val BaseColor: Int = -0x1
|
||||
}
|
||||
fun display(stack: PoseStack? = null) { if (!hidden) render(stack) }
|
||||
var hidden: Boolean = false
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package fr.username404.snowygui.rendering
|
||||
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder
|
||||
import com.mojang.blaze3d.vertex.PoseStack
|
||||
import com.mojang.blaze3d.vertex.Tesselator
|
||||
import net.minecraft.client.Minecraft
|
||||
|
||||
internal object Util {
|
||||
private val tessellator: Tesselator = Tesselator.getInstance()
|
||||
private val buffer: BufferBuilder = tessellator.builder
|
||||
fun UIString(poseStack: PoseStack, string: String, i: Float, j: Float) {
|
||||
Minecraft.getInstance().font.draw(poseStack, string, i, j, 10)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue