From 385e0d13f16e8f0d2da0fba558254dd3044591fd Mon Sep 17 00:00:00 2001 From: lyizai <3945107889@qq.com> Date: Wed, 19 Aug 2026 10:45:29 +0800 Subject: [PATCH] =?UTF-8?q?v1.1.9:=20UI=20=E8=BF=90=E8=A1=8C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=8C=BA=E5=9F=9F=E6=94=B9=E7=94=A8=E5=B0=8F=E5=AD=97?= =?UTF-8?q?=E5=8F=B7=E5=B9=B6=E8=87=AA=E5=8A=A8=E6=8D=A2=E8=A1=8C=EF=BC=8C?= =?UTF-8?q?=E6=9C=80=E6=96=B0=E6=97=A5=E5=BF=97=E7=BD=AE=E9=A1=B6=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../autostore/client/gui/AutoStoreGui.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/main/java/autostore/client/gui/AutoStoreGui.java b/src/main/java/autostore/client/gui/AutoStoreGui.java index c6de140..f1ae133 100644 --- a/src/main/java/autostore/client/gui/AutoStoreGui.java +++ b/src/main/java/autostore/client/gui/AutoStoreGui.java @@ -28,6 +28,7 @@ import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.CheckboxWidget; import net.minecraft.client.gui.screen.Screen; import net.minecraft.text.StringVisitable; +import net.minecraft.text.OrderedText; @Environment(value=EnvType.CLIENT) /** @@ -470,13 +471,26 @@ extends Screen { context.drawTextWithShadow(this.textRenderer, "\u72b6\u6001\u4fe1\u606f", statusX, infoTop, -5592406); context.fill(statusX - 12, infoTop - 1, statusX - 11, infoTop + 58, -12761518); - // 运行日志:最多 4 条,最新日志在最下方 + // 运行日志:使用较小字体并自动换行,最新日志在最上方,逐行向下显示直到填满可视高度 List logs = this.controller.logs(); - int shown = Math.min(4, logs.size()); - for (int i = 0; i < shown; ++i) { - String trimmed = this.textRenderer.trimToWidth(logs.get(logs.size() - shown + i), logWidth - 4); - context.drawTextWithShadow(this.textRenderer, trimmed, this.mapX + 2, infoTop + 12 + i * 12, -6577233); + float logScale = 0.75f; // 日志字号缩放(比默认小一号) + int logAreaTop = infoTop + 12; + int logAreaBottom = infoTop + 56; // 与竖向分隔线底部对齐 + int wrapWidth = (int)((logWidth - 4) / logScale); // 缩放后的可用换行宽度(按未缩放坐标计算) + context.getMatrices().push(); + context.getMatrices().scale(logScale, logScale, 1.0f); + int lineY = logAreaTop; + outer: + for (int i = logs.size() - 1; i >= 0; --i) { + for (OrderedText line : this.textRenderer.wrapLines(Text.literal(logs.get(i)), wrapWidth)) { + if (lineY + 9 > logAreaBottom) { + break outer; + } + context.drawTextWithShadow(this.textRenderer, line, (int)((this.mapX + 2) / logScale), (int)(lineY / logScale), -6577233); + lineY += 9; + } } + context.getMatrices().pop(); // 状态信息:单行截断 + 固定 12px 行距,彻底消除换行重叠 int target = this.config.targetCount;