diff --git a/README.md b/README.md index acdffbd..272d4a9 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ ## 安装 1. 安装 Fabric Loader 0.16.14+ 和 Fabric API -2. 将 `autostore-1.1.1.jar` 放入 `.minecraft/mods/` 目录 +2. 将 `autostore-1.1.2.jar` 放入 `.minecraft/mods/` 目录 3. 启动游戏,按 `Ctrl+R` 打开 GUI ## 构建 @@ -25,4 +25,4 @@ ./build_mod.sh ``` -输出文件:`autostore-1.1.1.jar` +输出文件:`autostore-1.1.2.jar` diff --git a/src/main/java/autostore/client/gui/AutoStoreGui.java b/src/main/java/autostore/client/gui/AutoStoreGui.java index 8291373..4ee0eb5 100644 --- a/src/main/java/autostore/client/gui/AutoStoreGui.java +++ b/src/main/java/autostore/client/gui/AutoStoreGui.java @@ -89,7 +89,7 @@ extends Screen { this.mapY = 40; this.mapW = Math.max(120, this.panelX - this.mapX - 8); // 底部信息区高度(日志 + 状态文本),地图填满其上方空间 - int infoHeight = 78; + int infoHeight = 88; this.mapH = Math.max(140, this.height - this.mapY - infoHeight - 8); // 屏幕较矮时压缩垂直间距,保证右侧面板内容不被截断 @@ -422,26 +422,50 @@ extends Screen { /** 绘制右侧信息面板:字段标签、运行日志与状态/进度信息 */ private void drawInfo(DrawContext context) { - int shown; + // ===== 右侧配置面板字段标签 ===== context.drawTextWithShadow(this.textRenderer, "\u90a6\u56fd", this.panelX + 4, this.stateFieldY + 4, -5592406); context.drawTextWithShadow(this.textRenderer, "\u76ee\u6807\u6570\u91cf", this.panelX + 4, this.targetFieldY + 4, -5592406); context.drawTextWithShadow(this.textRenderer, "\u6743\u9650\u8bbe\u7f6e", this.panelX + 4, this.advancedY, -5592406); - int belowY = this.mapY + this.mapH + 12; + + // ===== 底部信息面板:日志(左)+ 状态(右),均单行截断,避免换行导致的重叠 ===== + int infoTop = this.mapY + this.mapH + 10; int logWidth = Math.max(120, (int)(this.mapW * 0.52)); - int statusX = this.mapX + logWidth + 20; - int statusWidth = this.mapW - logWidth - 20; + int statusX = this.mapX + logWidth + 24; + int statusWidth = this.mapW - logWidth - 24; + + // 半透明面板背景,使信息区与地图明显分隔 + context.fill(this.mapX, infoTop - 2, this.mapX + this.mapW, infoTop + 74, 0x30000000); + // 两栏标题与竖向分隔线 + context.drawTextWithShadow(this.textRenderer, "\u8fd0\u884c\u65e5\u5fd7", this.mapX + 2, infoTop, -5592406); + 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(); - for (int i = shown = Math.min(4, logs.size()); i > 0; --i) { - String trimmed = this.textRenderer.trimToWidth(logs.get(logs.size() - i), logWidth); - context.drawTextWithShadow(this.textRenderer, trimmed, this.mapX, belowY + (shown - i) * 12, -6577233); + 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); } + + // 状态信息:单行截断 + 固定 12px 行距,彻底消除换行重叠 int target = this.config.targetCount; String targetText = target > 0 ? Integer.toString(target) : "\u6301\u7eed"; - context.drawWrappedTextWithShadow(this.textRenderer, Text.literal(("\u72b6\u6001\uff1a" + this.controller.status())), statusX, belowY, statusWidth, -1); - context.drawWrappedTextWithShadow(this.textRenderer, Text.literal(("\u8fdb\u5ea6\uff1a" + this.controller.completedClaims() + " / " + targetText + "\uff0c\u7b49\u5f85\uff1a" + this.controller.lastProgress() + "%")), statusX, belowY + 14, statusWidth, -1); - context.drawWrappedTextWithShadow(this.textRenderer, Text.literal(("\u961f\u5217\uff1a" + this.controller.queuedTargets() + "\uff0c\u6570\u636e\u9519\u8bef\uff1a" + (this.mod.dataService().lastError().isEmpty() ? "\u65e0" : this.mod.dataService().lastError()))), statusX, belowY + 30, statusWidth, -1); - context.drawWrappedTextWithShadow(this.textRenderer, Text.literal(this.refreshStatusText()), statusX, belowY + 46, statusWidth, -5592406); - context.drawWrappedTextWithShadow(this.textRenderer, Text.literal((String)"\u5f00\u59cb\u524d\u8bf7\u786e\u8ba4\u5df2\u624b\u52a8\u6267\u884c /u claimmode"), statusX, belowY + 62, statusWidth, -13210); + String error = this.mod.dataService().lastError(); + String[] statusLines = new String[]{ + "\u72b6\u6001\uff1a" + this.controller.status(), + "\u8fdb\u5ea6\uff1a" + this.controller.completedClaims() + " / " + targetText + "\uff0c\u7b49\u5f85\uff1a" + this.controller.lastProgress() + "%", + "\u961f\u5217\uff1a" + this.controller.queuedTargets() + "\uff0c\u6570\u636e\u9519\u8bef\uff1a" + (error.isEmpty() ? "\u65e0" : error), + this.refreshStatusText() + }; + for (int i = 0; i < statusLines.length; ++i) { + String trimmed = this.textRenderer.trimToWidth(statusLines[i], statusWidth); + context.drawTextWithShadow(this.textRenderer, trimmed, statusX, infoTop + 12 + i * 12, -1); + } + + // 底部整行提示 + String hint = this.textRenderer.trimToWidth("\u5f00\u59cb\u524d\u8bf7\u786e\u8ba4\u5df2\u624b\u52a8\u6267\u884c /u claimmode", this.mapW); + context.drawTextWithShadow(this.textRenderer, hint, this.mapX + 2, infoTop + 62, -13210); } /** 生成地图刷新状态文本(显示上次成功刷新距今的时间) */ diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index a225a98..472fa47 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1 +1 @@ -{"schemaVersion":1,"id":"autostore","version":"1.1.1","name":"AutoStore","description":"","authors":[],"contact":{},"license":"All-Rights-Reserved","environment":"client","entrypoints":{"fabric-datagen":["autostore.client.AutoStoreModDataGenerator"],"client":["autostore.client.AutoStoreModClient"],"main":["autostore.AutoStoreMod"]},"mixins":["autostore.mixins.json",{"config":"autostore.client.mixins.json","environment":"client"}],"depends":{"fabricloader":">=0.16.14","fabric-api":"*","minecraft":"1.21.4"},"jars":[{"file":"META-INF/jars/baritone-api-fabric-1.13.1.jar"}]} \ No newline at end of file +{"schemaVersion":1,"id":"autostore","version":"1.1.2","name":"AutoStore","description":"","authors":[],"contact":{},"license":"All-Rights-Reserved","environment":"client","entrypoints":{"fabric-datagen":["autostore.client.AutoStoreModDataGenerator"],"client":["autostore.client.AutoStoreModClient"],"main":["autostore.AutoStoreMod"]},"mixins":["autostore.mixins.json",{"config":"autostore.client.mixins.json","environment":"client"}],"depends":{"fabricloader":">=0.16.14","fabric-api":"*","minecraft":"1.21.4"},"jars":[{"file":"META-INF/jars/baritone-api-fabric-1.13.1.jar"}]} \ No newline at end of file