summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.kotlin/errors/errors-1729354010601.log4
-rw-r--r--build.gradle.kts2
-rw-r--r--sharedVariables/src/Versions.kt2
-rw-r--r--src/main/kotlin/gui/MessageUi.kt9
-rw-r--r--src/main/kotlin/util/render/ScreenRenderUtils.kt65
5 files changed, 77 insertions, 5 deletions
diff --git a/.kotlin/errors/errors-1729354010601.log b/.kotlin/errors/errors-1729354010601.log
deleted file mode 100644
index 7cd151b..0000000
--- a/.kotlin/errors/errors-1729354010601.log
+++ /dev/null
@@ -1,4 +0,0 @@
-kotlin version: 2.0.20
-error message: The daemon has terminated unexpectedly on startup attempt #1 with error code: 0. The daemon process output:
- 1. Kotlin compile daemon is ready
-
diff --git a/build.gradle.kts b/build.gradle.kts
index 43ceec2..5d1ad4d 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -42,6 +42,7 @@ loom.run {
this.runs {
this.removeIf { it.name != "client" }
this.named("client") {
+ ideConfigGenerated(true)
parseEnvFile(file(".env")).forEach { (t, u) ->
this.environmentVariable(t, u)
}
@@ -80,6 +81,7 @@ dependencies {
}
shadowImpl("com.github.therealbush:eventbus:1.0.2")
include(version.universalCraft)
+ shadowImpl("io.github.juuxel:libninepatch:1.2.0")
if (version.minecraftVersion.versionNumber < 11300) {
shadowImpl("com.mojang:brigadier:1.0.18")
}
diff --git a/sharedVariables/src/Versions.kt b/sharedVariables/src/Versions.kt
index 4de930e..895ceba 100644
--- a/sharedVariables/src/Versions.kt
+++ b/sharedVariables/src/Versions.kt
@@ -53,7 +53,7 @@ enum class Versions(
;
val platformName = if (forgeDep == null) "fabric" else "forge"
- val universalCraft = "gg.essential:universalcraft-${minecraftVersion.versionName}-$platformName:363"
+ val universalCraft = "gg.essential:universalcraft-${minecraftVersion.versionName}-$platformName:369"
val needsPack200 = forgeDep != null && minecraftVersion <= MinecraftVersion.MC11202
val parent: Versions? by lazy {
if (parentName == null) null
diff --git a/src/main/kotlin/gui/MessageUi.kt b/src/main/kotlin/gui/MessageUi.kt
index f3feeb7..5f337f3 100644
--- a/src/main/kotlin/gui/MessageUi.kt
+++ b/src/main/kotlin/gui/MessageUi.kt
@@ -2,6 +2,7 @@ package moe.nea.ultranotifier.gui
import gg.essential.universal.UMatrixStack
import gg.essential.universal.UScreen
+import juuxel.libninepatch.NinePatch
import moe.nea.ultranotifier.util.render.ScreenRenderUtils
import moe.nea.ultranotifier.util.ultraIdentifier
import java.awt.Color
@@ -15,5 +16,13 @@ class MessageUi : UScreen() {
matrixStack,
200.0, 0.0, 300.0, 100.0
)
+ ScreenRenderUtils.renderNineSlice(
+ NinePatch.builder(ultraIdentifier("textures/gui/square_panel.png"))
+ .cornerSize(10)
+ .mode(NinePatch.Mode.STRETCHING)
+ .cornerUv(0.1F, 0.1F).build(),
+ matrixStack,
+ 225.0, 25.0, 275.0, 75.0
+ )
}
}
diff --git a/src/main/kotlin/util/render/ScreenRenderUtils.kt b/src/main/kotlin/util/render/ScreenRenderUtils.kt
index 6a659bf..224ccb4 100644
--- a/src/main/kotlin/util/render/ScreenRenderUtils.kt
+++ b/src/main/kotlin/util/render/ScreenRenderUtils.kt
@@ -2,6 +2,8 @@ package moe.nea.ultranotifier.util.render
import gg.essential.universal.UGraphics
import gg.essential.universal.UMatrixStack
+import juuxel.libninepatch.NinePatch
+import juuxel.libninepatch.TextureRenderer
import net.minecraft.util.Identifier
import java.awt.Color
@@ -36,4 +38,67 @@ object ScreenRenderUtils {
graphics.pos(matrixStack, right, top, 0.0).tex(1.0, 0.0).endVertex()
graphics.drawDirect()
}
+
+ fun renderNineSlice(
+ ninePatch: NinePatch<Identifier>,
+ matrixStack: UMatrixStack,
+ left: Double, top: Double,
+ right: Double, bottom: Double,
+ ) {
+ class Saver : TextureRenderer<Identifier> {
+ override fun draw(
+ texture: Identifier?,
+ x: Int,
+ y: Int,
+ width: Int,
+ height: Int,
+ u1: Float,
+ v1: Float,
+ u2: Float,
+ v2: Float
+ ) {
+ this.texture = texture
+ }
+
+ var texture: Identifier? = null
+ }
+
+ val saver = Saver()
+ ninePatch.draw(saver, 1, 1)
+ UGraphics.bindTexture(0, saver.texture!!)
+ val graphics = UGraphics.getFromTessellator()
+ graphics.beginWithDefaultShader(UGraphics.DrawMode.QUADS, UGraphics.CommonVertexFormats.POSITION_TEXTURE)
+ ninePatch.draw(object : TextureRenderer<Identifier> {
+ override fun draw(
+ texture: Identifier,
+ x: Int,
+ y: Int,
+ width: Int,
+ height: Int,
+ u1: Float,
+ v1: Float,
+ u2: Float,
+ v2: Float
+ ) {
+ val x1 = left + x.toDouble()
+ val y1 = top + y.toDouble()
+ val x2 = x1+ width
+ val y2 = y1 + height
+ graphics.pos(matrixStack, x1, y1, 0.0)
+ .tex(u1.toDouble(), v1.toDouble())
+ .endVertex()
+ graphics.pos(matrixStack, x1, y2, 0.0)
+ .tex(u1.toDouble(), v2.toDouble())
+ .endVertex()
+ graphics.pos(matrixStack, x2, y2, 0.0)
+ .tex(u2.toDouble(), v2.toDouble())
+ .endVertex()
+ graphics.pos(matrixStack, x2, y1, 0.0)
+ .tex(u2.toDouble(), v1.toDouble())
+ .endVertex()
+ }
+ }, (right - left).toInt(), (bottom - top).toInt())
+ graphics.drawDirect()
+ }
+
}