feat: v2.2.1 主世界找矿绕道 + 工具适用性检查;移除自动火把
- 移除自动火把功能(按反馈不需要) - 主世界挖矿新增矿物绕道:每秒扫描周围10格目标矿物并自动绕道挖掉, 解决巷道壁旁钻石不挖的问题(此前只走巷道不主动找矿) - 新增工具适用性检查:用 isSuitableFor 校验手持工具能否采掘目标矿物, 远古残骸等自动换钻石镐;无合适工具时提示并暂停矿物挖掘 - 鱼骨支巷长度改为可配置 branchLength(默认10,原固定6) - 目标矿物 id 兼容 minecraft: 前缀(带不带均可识别)
这个提交包含在:
@@ -7,7 +7,6 @@ import autodig.client.miner.NetherMiner;
|
||||
import autodig.client.miner.OverworldMiner;
|
||||
import autodig.client.service.AutoEat;
|
||||
import autodig.client.service.AutoGear;
|
||||
import autodig.client.service.AutoTorch;
|
||||
import autodig.client.service.AutoTrash;
|
||||
import autodig.client.service.DeathRecorder;
|
||||
import autodig.client.service.KillAura;
|
||||
@@ -36,7 +35,6 @@ public final class DigController {
|
||||
private final KillAura killAura = new KillAura();
|
||||
private final AutoGear autoGear = new AutoGear();
|
||||
private final AutoTrash autoTrash = new AutoTrash();
|
||||
private final AutoTorch autoTorch = new AutoTorch();
|
||||
private final DeathRecorder deathRecorder = new DeathRecorder();
|
||||
private final SessionStats stats = new SessionStats();
|
||||
private final OverworldMiner overworld = new OverworldMiner(this.bridge);
|
||||
@@ -46,6 +44,8 @@ public final class DigController {
|
||||
private BlockPos resumeTarget;
|
||||
private long lastIssue;
|
||||
private long lastWarn;
|
||||
/** 上一次"没有合适工具"提示的时间戳(节流) */
|
||||
private long lastToolWarn;
|
||||
/** 返回死亡点的截止时间(超时后直接续任务,避免不可达时死循环) */
|
||||
private long returnDeadline;
|
||||
/** 装备耐久保护触发前所处的状态,用于恢复后回到该状态 */
|
||||
@@ -60,11 +60,10 @@ public final class DigController {
|
||||
}
|
||||
PlayerEntity player = client.player;
|
||||
|
||||
// 常驻能力:杀戮光环、自动进食、背包满丢垃圾、自动火把、换装冷却
|
||||
// 常驻能力:杀戮光环、自动进食、背包满丢垃圾、换装冷却
|
||||
this.killAura.tick(config);
|
||||
this.autoEat.tick(config);
|
||||
this.autoTrash.tick(config);
|
||||
this.autoTorch.tick(config);
|
||||
this.autoGear.tick();
|
||||
|
||||
// 死亡处理:记录死亡次数,暂停任务,重生后按需回到死亡坐标
|
||||
@@ -133,10 +132,29 @@ public final class DigController {
|
||||
return;
|
||||
}
|
||||
|
||||
this.drive(config, player);
|
||||
// 工具适用性保障:确保手持工具能采掘目标矿物(如远古残骸必须钻石镐)
|
||||
boolean canMineOres = true;
|
||||
if (config.autoTool) {
|
||||
canMineOres = this.autoGear.ensureToolForOres(config, player);
|
||||
if (!canMineOres) {
|
||||
this.warnToolInsufficient(config);
|
||||
}
|
||||
}
|
||||
|
||||
this.drive(config, player, canMineOres);
|
||||
}
|
||||
|
||||
private void drive(DigConfig config, PlayerEntity player) {
|
||||
/** 背包中没有能采掘目标矿物的工具时,每 5 秒提示一次。 */
|
||||
private void warnToolInsufficient(DigConfig config) {
|
||||
long now = System.currentTimeMillis();
|
||||
if (now - this.lastToolWarn > 5000) {
|
||||
this.lastToolWarn = now;
|
||||
String ores = config.task == MineTask.NETHER ? config.netherOres : config.overworldOres;
|
||||
this.sendChat("背包中没有能采掘 " + ores + " 的工具(如需要钻石镐),矿物绕道挖掘已暂停;放入合适工具后自动恢复");
|
||||
}
|
||||
}
|
||||
|
||||
private void drive(DigConfig config, PlayerEntity player, boolean canMineOres) {
|
||||
switch (this.state) {
|
||||
case IDLE -> {
|
||||
// Baritone 未就绪时无法挖矿,节流提示并停留在空闲,避免静默无响应
|
||||
@@ -156,7 +174,7 @@ public final class DigController {
|
||||
}
|
||||
}
|
||||
case OVERWORLD -> {
|
||||
if (this.overworld.tick(config)) {
|
||||
if (this.overworld.tick(config, canMineOres)) {
|
||||
this.bridge.cancelAll();
|
||||
if (this.overworld.isFull()) {
|
||||
// 背包已满无法继续,直接结束任务,避免空转循环
|
||||
|
||||
在新工单中引用
屏蔽一个用户