-
Notifications
You must be signed in to change notification settings - Fork 2
Developer Guide
ZoyLuo edited this page Jun 5, 2026
·
1 revision
面向想阅读、修改、扩展 AIBot 的开发者。先读 Architecture 建立全局认知。
./gradlew clean build # 全量构建(提 PR 前请确保通过)
./gradlew runServer # 开发服务端
./gradlew runClient # 开发客户端本项目锁定 Yarn 1.21.3+build.2。Minecraft / Fabric API 跨版本方法签名常变——在改动以下内容前,务必先确认当前版本的方法签名:
- 物品组件(Components)
- 进食 / 食物属性
- 燃料注册
- 挖掘速度
- 熔炉库存
- 客户端网络代码
AIBot 自带两个诊断命令,支撑"改动 → 验证 → 回归":
| 命令 | 用途 |
|---|---|
/aibot verify <bot> <feature> |
跑内置验证场景(导航绕障 / 缺口 / 下挖 / 挖矿 / 战斗 等),观察真实行为 |
/aibot deplint <bot> <spec> |
离线审计某目标的规划链(只看 GoalPlanner 倒推结果,不实际执行) |
配合结构化日志 / replay / profile:
/aibot observe tps
/aibot observe profile <bot>
/aibot observe replay …- 继承
AbstractTask,实现onStart/onTick/onAbort。 - 遵守 Task System:G1 内部不 assign 子任务(调用
BlockMiner/DigNav/ActionPack等共享原语);G2 只在主线程操作世界。 - 站桩类任务重写
isWaiting()返回true,并自带NO_PROGRESS/timeout看门狗。 - 用
complete()/fail(reason)收尾,失败原因要清晰(便于GoalExecutor重规划与日志诊断)。
- 在
ToolRegistry用register("tool_name", 描述, schema, [Group], handler)注册。 - 选择合适的
Group(低层 / 记忆 / 协调,或默认高层),受brain配置开关影响(见 Configuration)。 - handler 里把参数落成一个 Task System 或 Goal Engine,而不是直接操作世界——保持 LLM plans, Tasks execute。
- 在
Goal密封类型里新增一种目标。 - 在
GoalPlanner的ensureItem/ 规划分支里补上"如何倒推获得"的逻辑。 - 用
/aibot deplint离线验证倒推链是否正确,再下场实测。
brain/ 大脑:LLM 请求、ToolRegistry、ActionDispatcher
goal/ 目标:Goal、GoalPlanner、GoalExecutor
task/ 任务状态机 + 协调器 + 看门狗
action/ 低层动作原语
pathfinding/ A* 寻路与可站性
craft/ mining/ 配方与矿物知识
entity/ AIPlayerEntity
command/ /aibot 命令
network/ persist/ memory/ observe/ log/ mixin/ 基础设施
详见 Architecture。欢迎提 Issue / PR 🙌
AIBot · GitHub · MIT License · LLM plans · Tasks execute · Bob survives
新手上路
理解原理
参与开发
- Home
- Getting Started
- Commands
- Configuration
- Client Panel
- Architecture
- Goal Engine
- Task System
- Brain & Tools
- Safety Net
- Developer Guide
- FAQ
主仓库 · MIT