From d0ed839d9f45c07306f82e377da5e47bccf75ca5 Mon Sep 17 00:00:00 2001 From: Lyizai Date: Mon, 17 Aug 2026 13:07:51 +0000 Subject: [PATCH] =?UTF-8?q?v1.1.5:=20=E4=BF=AE=E5=A4=8D=E8=A7=84=E5=88=92?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=90=8E=E4=B8=8D=E5=AF=BB=E8=B7=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - isTargetStillValid 增加己方领土数据 fallback 与保守放行 - 修复地图刷新竞态导致 selfState 暂时为 null 时所有目标被跳过、玩家原地不动的问题 --- README.md | 4 ++-- .../client/controller/ExpansionController.java | 11 +++++++++++ src/main/resources/fabric.mod.json | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5659681..cef3cda 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ ## 安装 1. 安装 Fabric Loader 0.16.14+ 和 Fabric API -2. 将 `autostore-1.1.4.jar` 放入 `.minecraft/mods/` 目录 +2. 将 `autostore-1.1.5.jar` 放入 `.minecraft/mods/` 目录 3. 启动游戏,按 `Ctrl+R` 打开 GUI ## 构建 @@ -26,4 +26,4 @@ ./build_mod.sh ``` -输出文件:`autostore-1.1.4.jar` +输出文件:`autostore-1.1.5.jar` diff --git a/src/main/java/autostore/client/controller/ExpansionController.java b/src/main/java/autostore/client/controller/ExpansionController.java index 7dbeab3..283803e 100644 --- a/src/main/java/autostore/client/controller/ExpansionController.java +++ b/src/main/java/autostore/client/controller/ExpansionController.java @@ -400,9 +400,20 @@ implements SubtitleChatMonitor.Listener { } HashSet own = new HashSet(m.sessionClaims()); TerritoryState self = m.selfState(); + // Fallback:如果当前刷新后的模型找不到己方邦国,使用启动/规划时缓存的模型 + // 启动检查成功说明邦国一定存在,fallback 解决竞态/刷新导致的 self 暂时性 null,避免所有目标被跳过 + if (self == null && this.model != null) { + self = this.model.selfState(); + } if (self != null) { own.addAll(self.chunks()); } + // 己方领土数据暂时不可用时保守视为有效,避免所有目标被误跳过导致玩家原地不动; + // 规划器生成目标时己方领土必然非空,此处 own 为空仅可能是刷新竞态,放行让寻路继续 + if (own.isEmpty()) { + this.log("警告:己方领土数据暂时为空,保守放行目标 " + this.target.x() + "," + this.target.z()); + return true; + } return this.ownNeighbors(this.target, own) > 0; } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index aaabb06..28e61af 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1 +1 @@ -{"schemaVersion":1,"id":"autostore","version":"1.1.4","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.5","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