Add a companion object to Element.kt and remove the rendering package

This commit is contained in:
Username404-59 2021-04-10 15:14:12 +02:00
parent c50ce0696f
commit bf5c276178
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 7 additions and 14 deletions

View File

@ -1,12 +1,19 @@
package fr.username404.snowygui.gui package fr.username404.snowygui.gui
import com.mojang.blaze3d.vertex.BufferBuilder
import com.mojang.blaze3d.vertex.PoseStack import com.mojang.blaze3d.vertex.PoseStack
import com.mojang.blaze3d.vertex.Tesselator
fun interface Renderable { fun render(poseStack: PoseStack?) } fun interface Renderable { fun render(poseStack: PoseStack?) }
abstract class Element( abstract class Element(
var x: Int, var y: Int, var x: Int, var y: Int,
val width: Int, val height: Int val width: Int, val height: Int
): Renderable { ): 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) } fun display(stack: PoseStack? = null) { if (!hidden) render(stack) }
var hidden: Boolean = false var hidden: Boolean = false
} }

View File

@ -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)
}
}