v1.1.5: 修复规划完成后不寻路问题

- isTargetStillValid 增加己方领土数据 fallback 与保守放行
- 修复地图刷新竞态导致 selfState 暂时为 null 时所有目标被跳过、玩家原地不动的问题
这个提交包含在:
Lyizai
2026-08-17 13:07:51 +00:00
父节点 20c9cb10a3
当前提交 d0ed839d9f
共修改 3 个文件,包含 14 行新增和 3 行删除
+2 -2
查看文件
@@ -16,7 +16,7 @@
## 安装 ## 安装
1. 安装 Fabric Loader 0.16.14+ 和 Fabric API 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 3. 启动游戏,按 `Ctrl+R` 打开 GUI
## 构建 ## 构建
@@ -26,4 +26,4 @@
./build_mod.sh ./build_mod.sh
``` ```
输出文件:`autostore-1.1.4.jar` 输出文件:`autostore-1.1.5.jar`
@@ -400,9 +400,20 @@ implements SubtitleChatMonitor.Listener {
} }
HashSet<ChunkPos> own = new HashSet<ChunkPos>(m.sessionClaims()); HashSet<ChunkPos> own = new HashSet<ChunkPos>(m.sessionClaims());
TerritoryState self = m.selfState(); TerritoryState self = m.selfState();
// Fallback:如果当前刷新后的模型找不到己方邦国,使用启动/规划时缓存的模型
// 启动检查成功说明邦国一定存在,fallback 解决竞态/刷新导致的 self 暂时性 null,避免所有目标被跳过
if (self == null && this.model != null) {
self = this.model.selfState();
}
if (self != null) { if (self != null) {
own.addAll(self.chunks()); 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; return this.ownNeighbors(this.target, own) > 0;
} }
+1 -1
查看文件
@@ -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"}]} {"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"}]}