v1.1.4: 寻路优化(避矿洞+超时回城自救+不接壤目标校验)
- Baritone设置:限制下落高度(10格)与轻微挖方块惩罚,减少走入矿洞,同时保留峡谷/高山通行 - 寻路超时且玩家在地下时自动执行 /u return 回城自救,等待10秒传送后重新规划 - 新增目标有效性校验:寻路/等待/重试前实时校验目标是否仍与己方领土接壤,不接壤立即跳过并重新规划,修复走到不接壤区块死等bug
这个提交包含在:
@@ -13,6 +13,7 @@ import autostore.client.config.ExpansionConfig;
|
||||
import autostore.client.territory.ChunkPos;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
||||
/**
|
||||
* Baritone API 封装(桥接层)。
|
||||
@@ -36,6 +37,12 @@ public final class BaritoneBridge {
|
||||
settings.allowPlace.value = config.allowPlace;
|
||||
settings.allowParkour.value = config.allowJump;
|
||||
settings.avoidance.value = config.avoidMobs;
|
||||
// 减少走入地下矿洞:限制无水源时的下落高度,避免掉进深坑/矿洞。
|
||||
// 放宽到 10 格,仍允许穿越峡谷、下坡等正常地形,同时避免掉入深坑
|
||||
settings.maxFallHeightNoWater.value = 10;
|
||||
// 轻微提高挖掘方块的额外代价,让寻路尽量绕行地面而非挖洞穿山,
|
||||
// 但不会阻止必要挖掘(高山、峡谷等仍可通行)
|
||||
settings.blockBreakAdditionalPenalty.value = 0.5;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,6 +69,18 @@ public final class BaritoneBridge {
|
||||
baritone.getPathingBehavior().forceCancel();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送服务器聊天命令(如 /u return 回城),command 参数不含前导斜杠。
|
||||
* 用于寻路超时后的回城自救,避免玩家被困在地下矿洞等位置。
|
||||
*/
|
||||
public void sendCommand(String command) {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
if (client == null || client.player == null || client.getNetworkHandler() == null) {
|
||||
return;
|
||||
}
|
||||
client.getNetworkHandler().sendChatCommand(command);
|
||||
}
|
||||
|
||||
/** @return 当前是否正在寻路 */
|
||||
public boolean isPathing() {
|
||||
IBaritone baritone = this.primary();
|
||||
|
||||
在新工单中引用
屏蔽一个用户