From bf5c276178bf64bbaad4cb91e5315f2c20a12da5 Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Sat, 10 Apr 2021 15:14:12 +0200 Subject: [PATCH] Add a companion object to Element.kt and remove the rendering package --- .../kotlin/fr/username404/snowygui/gui/Element.kt | 7 +++++++ .../fr/username404/snowygui/rendering/Util.kt | 14 -------------- 2 files changed, 7 insertions(+), 14 deletions(-) delete mode 100644 common/src/main/kotlin/fr/username404/snowygui/rendering/Util.kt diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/Element.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/Element.kt index f5d09e0..f656c41 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/Element.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/Element.kt @@ -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 } \ No newline at end of file diff --git a/common/src/main/kotlin/fr/username404/snowygui/rendering/Util.kt b/common/src/main/kotlin/fr/username404/snowygui/rendering/Util.kt deleted file mode 100644 index ef4b71a..0000000 --- a/common/src/main/kotlin/fr/username404/snowygui/rendering/Util.kt +++ /dev/null @@ -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) - } -} \ No newline at end of file