aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at')
-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)
}
/**