mirror of
https://github.com/moeru-ai/airi.git
synced 2026-05-17 04:20:26 +00:00
## Description
本次修复解决了 Minecraft 机器人运行中的多个核心崩溃与逻辑问题,让 AI 能稳定执行挖掘、跟随、资源收集等任务:
1. **修复 `expectMoved()` 验证逻辑**:
- 当动作结果中不存在 `movedDistance` 字段时,默认使用 0 而非抛出错误
- 新增非移动动作白名单(挖掘、放置、交互等),对这类动作直接返回成功,不再强制要求移动距离
- 解决了「挖掘动作被误判失败」的核心问题(报错:`Expectation failed: expectMoved() requires
last action result with movedDistance telemetry`)
2. **优化 `breakBlockAt()` 挖掘逻辑**:
- 修正脚下方块位置计算,提升挖掘精准度
- 补充详细调试日志,便于排查挖掘相关问题
3. **修复 `InventoryQueryChain.count()` 空值问题**:
- 增加对 `name` 参数的空值检查,避免 `undefined` 调用 `toLowerCase()` 导致崩溃
- 解决了 `Cannot read properties of undefined (reading 'toLowerCase')` 报错
4. **补全查询链缺失方法**:
- 为 `EntityQueryChain` 新增 `whereName()` 方法,支持按实体名称过滤
- 为 `BlockQueryChain` 新增 `where()` 方法,支持自定义谓词过滤
- 解决了 `whereName is not a function` / `where is not a function` 等类型错误
5. **修复 `JavaScriptPlanner.runAction()` 异步竞态问题**:
- 在异步操作后增加 `this.activeRun` 空值检查,避免 `activeRun` 为 `null` 时访问 `executed`
导致崩溃
- 解决了 `Cannot read properties of null (reading 'executed')` 报错
## Linked Issues
Fixes #1352
## Additional Context
- 所有修改均在 Minecraft 服务目录下,不影响其他模块
- 测试验证:机器人可正常执行挖掘、跟随、资源收集等任务,不再出现上述崩溃
- 原项目 Mineflayer 版本即将弃用,但本修复可让当前实验版机器人稳定可用,也为后续原生 Mod 版本提供参考
---------
Co-authored-by: Rin <shinohara-rin@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
|
||
|---|---|---|
| .. | ||
| web | ||
| debug-service.ts | ||
| index.ts | ||
| mcp-repl-server.test.ts | ||
| mcp-repl-server.ts | ||
| mineflayer-viewer.ts | ||
| server.ts | ||
| tool-executor.ts | ||
| types.ts | ||