From 5913f56fb07534458900ae418a9be11fc719acee Mon Sep 17 00:00:00 2001 From: YuRaNnNzZZ Date: Wed, 23 Oct 2024 11:47:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B0=D0=B2=D1=82=D0=BE=D1=81=D0=BA=D0=B5?= =?UTF-8?q?=D0=B9=D0=BB=D0=B8=D0=BD=D0=B3=20=D1=82=D0=B5=D0=BA=D1=81=D1=82?= =?UTF-8?q?=D0=B0=20=D0=BD=D0=B0=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=87?= =?UTF-8?q?=D0=BA=D0=B0=D1=85=20(=D0=BF=D0=BE=D0=BA=D0=B0=20=D0=BD=D0=B5?= =?UTF-8?q?=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BA=D0=BB=D1=8E=D1=87=D0=B0=D0=B5?= =?UTF-8?q?=D0=BC=D1=8B=D0=B9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AMD User — Сегодня, в 11:36 Изображение наверное ветер --- .../mc/otm/client/render/blockentity/HoloSignRenderer.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/HoloSignRenderer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/HoloSignRenderer.kt index 6242b1eee..ed719fb84 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/HoloSignRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/HoloSignRenderer.kt @@ -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