feat: 自动换备用装备 + 背包满自动丢垃圾 (v2.1.0)
新增 AutoGear 服务: - 护甲/工具耐久过低时自动从背包换上同类备用装备(工具按镐/斧/锹/锄/剑类别, 护甲按头/胸/腿/脚部位匹配),选剩余耐久最高的候选 - 通过 clickSlot 三段点击交换(拿起旧装备->与背包新装备互换->就位), 走正规网络包,客户端/服务端同步,单人/多人均可用 - 控制器改为换装优先:能换就不打断挖矿,无备用才暂停/下界返程 - 装备保护状态下持续尝试换装,换上后自动恢复任务 新增 AutoTrash 服务: - 背包满时自动丢弃 trashItems 清单里的垃圾(默认:圆石/深板岩/凝灰岩/ 泥土/花岗岩/闪长岩/安山岩/下界岩/黑石/玄武岩,GUI 可改) - 方块类垃圾保留 trashReserve 个(默认 64)供 Baritone 搭路垫脚; 满背且无其他垃圾可丢时只丢一组腾位,尽量保住搭路方块 - clickSlot(THROW) 丢整组,每 tick 限 4 组防数据包风暴 配套修复: - NetherMiner: 修复血量低时每帧 cancelAll 导致回程寻路反复被取消卡死的 bug; markGearBroken 现在真正触发 RETURN_PORTAL 阶段;产物计数改用注册表 id + 矿物->掉落物映射 + 任务开始基线(老库存不再被误计为战果) - 两个 Miner 的背包满判定加 20 tick 去抖,给自动丢垃圾留出腾位时间 - GUI 新增两个开关与垃圾清单编辑区,切换任务/开关时保留输入框未应用的编辑 - 装备低耐久检查的手持工具仅限真正的工具,不再误伤钓鱼竿等杂物
这个提交包含在:
@@ -35,6 +35,11 @@ public final class OverworldMiner {
|
||||
private long lastIssue;
|
||||
/** 上一次打印诊断日志的时间戳,用于节流 */
|
||||
private long lastLog;
|
||||
/** 背包满连续持续的 tick 数(去抖:给自动丢垃圾留出腾位时间) */
|
||||
private int fullTicks;
|
||||
|
||||
/** 背包满去抖阈值(tick):连续这么久都满才认定为真满 */
|
||||
private static final int FULL_DEBOUNCE_TICKS = 20;
|
||||
|
||||
public OverworldMiner(BaritoneBridge bridge) {
|
||||
this.bridge = bridge;
|
||||
@@ -64,6 +69,7 @@ public final class OverworldMiner {
|
||||
this.step = 0;
|
||||
this.done = false;
|
||||
this.full = false;
|
||||
this.fullTicks = 0;
|
||||
}
|
||||
|
||||
private List<BlockPos> buildPlan(BlockPos base, int y, int trunkLen, int branchLen, int branchGap, int axis, int sign) {
|
||||
@@ -105,11 +111,17 @@ public final class OverworldMiner {
|
||||
if (player == null) {
|
||||
return true;
|
||||
}
|
||||
// 背包满去抖:连续一段时间都满才认定为真满(给自动丢垃圾留出腾位时间)
|
||||
if (this.inventoryFull(player)) {
|
||||
this.done = true;
|
||||
this.full = true;
|
||||
System.out.println("[AutoDig] overworld 结束:背包已满");
|
||||
return true;
|
||||
this.fullTicks++;
|
||||
if (this.fullTicks >= FULL_DEBOUNCE_TICKS) {
|
||||
this.done = true;
|
||||
this.full = true;
|
||||
System.out.println("[AutoDig] overworld 结束:背包已满");
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
this.fullTicks = 0;
|
||||
}
|
||||
if (this.step >= this.plan.size()) {
|
||||
this.done = true;
|
||||
@@ -194,6 +206,7 @@ public final class OverworldMiner {
|
||||
this.step = best;
|
||||
this.done = false;
|
||||
this.full = false;
|
||||
this.fullTicks = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
在新工单中引用
屏蔽一个用户