автоскейлинг текста на табличках (пока не переключаемый)
AMD User — Сегодня, в 11:36 Изображение наверное ветер
This commit is contained in:
parent
74f75ebfc6
commit
5913f56fb0
@ -35,6 +35,11 @@ class HoloSignRenderer(private val context: BlockEntityRendererProvider.Context)
|
||||
val totalHeight = lines.size * font.lineHeight + (lines.size - 1) * 2f
|
||||
var y = -totalHeight / 2f
|
||||
|
||||
val totalWidth = lines.maxOf { font.width(it) }.toFloat()
|
||||
val highest = totalWidth.coerceAtLeast(totalHeight)
|
||||
val mul = if (highest > 64f) 1f / (highest / 64f) else 64f / highest
|
||||
poseStack.scale(mul, mul, mul)
|
||||
|
||||
for (line in lines) {
|
||||
font.draw(poseStack = poseStack, buffer = bufferSource, text = line, gravity = RenderGravity.TOP_CENTER, y = y, color = RGBAColor(tile.textRed, tile.textGreen, tile.textBlue, tile.textAlpha))
|
||||
y += font.lineHeight + 2f
|
||||
|
Loading…
Reference in New Issue
Block a user