aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-02-05 22:20:06 +0100
committerGitHub <noreply@github.com>2024-02-05 22:20:06 +0100
commit8fd64fdf87da0b8e0f789847336890ceefdea975 (patch)
tree103c578eebfda1bf0736a63ece860fc6eed57895 /src/main/java/at/hannibal2/skyhanni
parentd392c8085486b7d6b3c6a0e0707dd0ffc72224fa (diff)
downloadskyhanni-8fd64fdf87da0b8e0f789847336890ceefdea975.tar.gz
skyhanni-8fd64fdf87da0b8e0f789847336890ceefdea975.tar.bz2
skyhanni-8fd64fdf87da0b8e0f789847336890ceefdea975.zip
Backend: Render Rendables rework (#846)
Added support for dynamic y size in Renderables. #846
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index 68e20ac8b..c85937309 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -7,8 +7,8 @@ import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsY
import at.hannibal2.skyhanni.events.GuiRenderItemEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.test.command.ErrorManager
-import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.renderables.Renderable
+import at.hannibal2.skyhanni.utils.renderables.RenderableUtils.renderXAligned
import io.github.moulberry.moulconfig.internal.TextRenderUtils
import io.github.moulberry.notenoughupdates.util.Utils
import net.minecraft.client.Minecraft
@@ -416,15 +416,24 @@ object RenderUtils {
fun Position.renderRenderables(
renderables: List<Renderable>,
extraSpace: Int = 0,
- itemScale: Double = 1.0,
posLabel: String,
) {
if (renderables.isEmpty()) return
- val list = mutableListOf<List<Any>>()
+ var longestY = 0
+ val longestX = renderables.maxOf { it.width }
for (line in renderables) {
- list.addAsSingletonList(line)
+ GlStateManager.pushMatrix()
+ val (x, y) = transform()
+ GlStateManager.translate(0f, longestY.toFloat(), 0F)
+ Renderable.withMousePosition(x, y) {
+ line.renderXAligned(0, longestY, longestX)
+ }
+
+ longestY += line.height + extraSpace + 2
+
+ GlStateManager.popMatrix()
}
- renderStringsAndItems(list, extraSpace, itemScale, posLabel)
+ GuiEditManager.add(this, posLabel, longestX, longestY)
}
/**