1 次代码提交
共修改 3 个文件,包含 40 行新增和 16 行删除
+2 -2
查看文件
@@ -15,7 +15,7 @@
## 安装 ## 安装
1. 安装 Fabric Loader 0.16.14+ 和 Fabric API 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 3. 启动游戏,按 `Ctrl+R` 打开 GUI
## 构建 ## 构建
@@ -25,4 +25,4 @@
./build_mod.sh ./build_mod.sh
``` ```
输出文件:`autostore-1.1.1.jar` 输出文件:`autostore-1.1.2.jar`
@@ -89,7 +89,7 @@ extends Screen {
this.mapY = 40; this.mapY = 40;
this.mapW = Math.max(120, this.panelX - this.mapX - 8); 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); this.mapH = Math.max(140, this.height - this.mapY - infoHeight - 8);
// 屏幕较矮时压缩垂直间距,保证右侧面板内容不被截断 // 屏幕较矮时压缩垂直间距,保证右侧面板内容不被截断
@@ -422,26 +422,50 @@ extends Screen {
/** 绘制右侧信息面板:字段标签、运行日志与状态/进度信息 */ /** 绘制右侧信息面板:字段标签、运行日志与状态/进度信息 */
private void drawInfo(DrawContext context) { private void drawInfo(DrawContext context) {
int shown; // ===== 右侧配置面板字段标签 =====
context.drawTextWithShadow(this.textRenderer, "\u90a6\u56fd", this.panelX + 4, this.stateFieldY + 4, -5592406); 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, "\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); 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 logWidth = Math.max(120, (int)(this.mapW * 0.52));
int statusX = this.mapX + logWidth + 20; int statusX = this.mapX + logWidth + 24;
int statusWidth = this.mapW - logWidth - 20; 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<String> logs = this.controller.logs(); List<String> logs = this.controller.logs();
for (int i = shown = Math.min(4, logs.size()); i > 0; --i) { int shown = Math.min(4, logs.size());
String trimmed = this.textRenderer.trimToWidth(logs.get(logs.size() - i), logWidth); for (int i = 0; i < shown; ++i) {
context.drawTextWithShadow(this.textRenderer, trimmed, this.mapX, belowY + (shown - i) * 12, -6577233); 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; int target = this.config.targetCount;
String targetText = target > 0 ? Integer.toString(target) : "\u6301\u7eed"; 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); String error = this.mod.dataService().lastError();
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); String[] statusLines = new String[]{
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); "\u72b6\u6001\uff1a" + this.controller.status(),
context.drawWrappedTextWithShadow(this.textRenderer, Text.literal(this.refreshStatusText()), statusX, belowY + 46, statusWidth, -5592406); "\u8fdb\u5ea6\uff1a" + this.controller.completedClaims() + " / " + targetText + "\uff0c\u7b49\u5f85\uff1a" + this.controller.lastProgress() + "%",
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); "\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);
} }
/** 生成地图刷新状态文本(显示上次成功刷新距今的时间) */ /** 生成地图刷新状态文本(显示上次成功刷新距今的时间) */
+1 -1
查看文件
@@ -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"}]} {"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"}]}