比较提交
| 作者 | SHA1 | 提交日期 | |
|---|---|---|---|
|
|
15b4a40b6d |
+3
@@ -2,6 +2,9 @@
|
||||
.gradle/
|
||||
build/
|
||||
|
||||
# Secrets
|
||||
.env
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
*.iml
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
## 安装
|
||||
|
||||
1. 安装 Fabric Loader 0.16.14+ 和 Fabric API
|
||||
2. 将 `autostore-1.1.6.jar` 放入 `.minecraft/mods/` 目录
|
||||
2. 将 `autostore-1.1.7.jar` 放入 `.minecraft/mods/` 目录
|
||||
3. 启动游戏,按 `Ctrl+R` 打开 GUI
|
||||
|
||||
## 构建
|
||||
@@ -26,4 +26,4 @@
|
||||
./build_mod.sh
|
||||
```
|
||||
|
||||
输出文件:`autostore-1.1.6.jar`
|
||||
输出文件:`autostore-1.1.7.jar`
|
||||
|
||||
+14
@@ -10,6 +10,11 @@ base {
|
||||
archivesName = project.archives_base_name
|
||||
}
|
||||
|
||||
// 用于把 Baritone 原样打包进模组 jar 的资源(不放默认依赖里,避免 Gradle 误解析)
|
||||
configurations {
|
||||
nestedJar
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Minecraft
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
@@ -21,6 +26,9 @@ dependencies {
|
||||
|
||||
// Baritone API (local jar, compile only)
|
||||
modImplementation files("libs/baritone-api-fabric-1.13.1.jar")
|
||||
|
||||
// 标记需要嵌套打包的 jar
|
||||
nestedJar files("libs/baritone-api-fabric-1.13.1.jar")
|
||||
}
|
||||
|
||||
processResources {
|
||||
@@ -30,6 +38,12 @@ processResources {
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": project.version
|
||||
}
|
||||
|
||||
// 将 Baritone 嵌套打包进 META-INF/jars,匹配 fabric.mod.json 的 jars 声明,
|
||||
// 使玩家无需单独安装 baritone 依赖即可运行
|
||||
from(configurations.nestedJar) {
|
||||
into "META-INF/jars"
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ yarn_mappings=1.21.4+build.8
|
||||
loader_version=0.19.3
|
||||
|
||||
# Mod Properties
|
||||
mod_version=1.1.6
|
||||
mod_version=1.1.7
|
||||
maven_group=autostore
|
||||
archives_base_name=autostore
|
||||
|
||||
|
||||
@@ -387,45 +387,18 @@ implements SubtitleChatMonitor.Listener {
|
||||
|
||||
/**
|
||||
* 判断当前目标是否仍然有效:
|
||||
* 未被任何邦国占领,且与己方领土(含本次会话新占领)至少一个区块接壤。
|
||||
* 使用实时地图数据校验,避免寻路到与领土不接壤的孤立区块。
|
||||
* 未被任何邦国占领即可——规划器已保证目标与己方领土相邻,
|
||||
* 运行时无需重复验证邻居关系,避免地图刷新后 own 集合不一致导致误判跳过。
|
||||
*
|
||||
* <p>注意:己方领土数据暂时不可用时保守视为有效(可能性极小,仅刷新竞态时发生),
|
||||
* 避免所有目标被误跳过导致玩家原地不动。
|
||||
*/
|
||||
private boolean isTargetStillValid() {
|
||||
if (this.target == null) {
|
||||
return false;
|
||||
}
|
||||
TerritoryModel m = this.dataService.model();
|
||||
if (m.allClaimedChunks().contains(this.target)) {
|
||||
return false;
|
||||
}
|
||||
HashSet<ChunkPos> own = new HashSet<ChunkPos>(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;
|
||||
}
|
||||
|
||||
/** 统计区块周围(上下左右)属于给定集合的邻居数量 */
|
||||
private int ownNeighbors(ChunkPos chunk, Set<ChunkPos> own) {
|
||||
int count = 0;
|
||||
for (ChunkPos neighbor : this.cardinalNeighbors(chunk)) {
|
||||
if (own.contains(neighbor)) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
return !m.allClaimedChunks().contains(this.target);
|
||||
}
|
||||
|
||||
/** 判断区块是否属于己方领土(含本次会话新占领) */
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"schemaVersion":1,"id":"autostore","version":"1.1.6","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.7","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"}]}
|
||||
在新工单中引用
屏蔽一个用户