M1 -- Machine One AI Interface
请审查上述分支以获取源代码树。
M1 是一个 Minecraft 模组,它通过纯文本本地回环套接字暴露正在运行的真实游戏客户端。 它将客户端面前的屏幕或世界描述为文本,并接受文本命令来驱动游戏——因此,无论是终端前的人类用户还是通过套接字连接的 AI,都可以通过打字完全操作 Minecraft。无需 GUI 鼠标/键盘,也无需在屏幕上“注视”任何内容;窗口纯粹用于可观测性。
作为涵盖 Minecraft 1.20 至 26.x 的 Fabric、NeoForge 和 Forge 模组发布,包含一个客户端代理以及一个可选的服务端 /m1srv 命令(两端均非必需)。
源代码 / 构建与设置指南 | 报告问题 / 获取支持
新手?请先阅读 AI_Brain (00_Index.md)。 这是 AI 代理在游戏会话之前预期加载的文件。本 README 是其背后的参考手册。
1. M1 的热门用途
大多数“AI 玩 Minecraft”项目实际上从未真正运行过 Minecraft。它们是协议机器人,从外部与服务器网络协议通信(如 Mineflayer,以及基于其构建的 LLM 代理 Voyager),或是锁定在古老版本上的研究堆栈(Malmo、MineRL)。由于它们从不加载真实的客户端,它们对客户端渲染的任何内容都视而不见——模组 GUI 对它们来说根本不存在,且版本或模组不匹配会导致它们失效。
M1 就是 真实的客户端。它作为普通的 Fabric / NeoForge / Forge 模组加载,读取每一个真实的屏幕,并以你操作游戏的方式驱动游戏。这解锁了协议机器人无法触及的功能:
- 模组开发与真实客户端测试。 以玩家实际体验的方式测试你的模组——打开其屏幕、点击按钮、读取物品栏、驱动菜单、截取截图——全部通过文本完成。M1 已在跨越多个 Minecraft 版本和所有三种加载器的 20+ 个发行版中作为实时测试工具链使用,因此你可以验证模组在整个范围内的表现,而不仅仅是在一个锁定的版本上。
- 真正游玩的 AI 代理。 将任何 LLM 指向文本套接字并让其运行——端到端已得到验证:生成、找到一棵树、挖掘、制作并建造一把木斧,完全通过网络完成——并且因为是真实客户端,你的代理也可以操作 模组 GUI,而不仅仅是原版移动。
- 免手/无障碍游玩。 通过打字运行整个游戏——菜单、世界、物品栏、合成——无需在屏幕上查看任何内容。
- 自动化与脚本编写。 重复的命令序列用于处理繁琐的事情(收集、制作、导航、设置世界),来自任何语言,纯文本格式——内置自动升级盔甲功能。
无需逆向工程协议,无需像素流水线,无需强化学习训练,无需锁定于单个 AI 模型或单个 Minecraft 版本——只需向真实游戏输入纯文本。
M1 公平游玩——它不会作弊或使用透视。 scan 仅感知玩家在查看屏幕时所能看到的内容:它永远不会看到隐藏在未暴露岩石内部的原始矿石,并且——除了在所有方向都能检测到的活体实体外——它只报告玩家面前的内容,绝不会穿透或绕过墙壁。由 AI 驱动 M1 所依据的信息与坐在键盘前的人类完全相同。
2. 运行 M1
M1 仅限客户端(无服务端模组)。将适用于你的加载器 + MC 版本的 jar 文件放入实例的 mods/ 文件夹中,启动世界,加载时 M1 会在 127.0.0.1:26000 打开其文本套接字并提取 AI_Brain 文档。
要从 Claude Desktop(或任何 MCP 客户端)驱动它,你还需运行源仓库中附带的小型 MCP-Minecraft 桥接程序。完整的逐步设置指南——安装、桥接程序以及 Claude Desktop 配置——请参阅 minecraft-1.20-26.3 分支上的构建与设置指南。
3. 连接
当加载模组的客户端启动时,M1 会在运行客户端的机器上的 127.0.0.1:26000 上打开一个 TCP 服务器。它仅绑定到回环地址——没有新的入站网络表面;只有同一台机器上的进程才能访问它。同时只运行一个加载模组的客户端(每个构建都绑定相同的端口)。
无论是一个人键入还是 AI 发送,通道都是相同的——一种语法,一条代码路径。AI 所做的任何事情都可以手动重现,反之亦然。
线路协议
- 按行分隔。 每行发送一条命令(
<command>\n)。回复由一行或多行文本组成,并以一个单独的信标行结束:<<END。
- 连接时会发送问候语 --
Connected to Machine One (M1). Type START to begin, or HELP for commands. 后跟一个 <<END。在发送第一条命令之前,请读取并丢弃它。
- 在执行动作命令(
click / type)之后,回复还会包含一个 --- now --- 标记,随后是结果屏幕的全新 describe(模组会等待约 150 毫秒让任何过渡/淡入淡出效果稳定下来,然后自动描述)。因此,每个动作都会告诉你新的情况。
- 自动升级通知(见护甲部分)会未经请求地到达,以
[auto-upgrade] 为前缀,附加在你收到的下一条回复之前。
- 每条命令有 10 秒的执行上限。 这是 M1 等待命令处理程序在游戏主线程上完成并返回回复的时间。如果处理程序超时,M1 将返回
ERR exec: ... TimeoutException,而不是让你的连接挂起。该上限针对的是处理程序返回回复的过程——它并不是对游戏内动作持续时间的限制。 异步命令(move / moveto / goto / mine / craft)几乎会立即返回 OK ... poll 'where',然后在后台运行,因此两分钟的行走或长时间的挖矿永远不会触及上限——只有真正停滞或卡住的客户端才会如此。实际后果:将你的套接字读取超时设置为高于 10 秒(例如 15 秒),以便你的读取器比服务器的自身上限存活得更久,从而实际接收到那条 ERR 行,而不是先触发自身的超时。
- 每条命令都在客户端的主线程上运行,因此游戏保持一致性。
quit / exit 关闭你的连接(它不会停止客户端)。
接口技巧
为了快速手动探测(客户端机器上的终端前的真人用户):任何基于行的 TCP 工具均可使用——telnet 127.0.0.1 26000、nc 127.0.0.1 26000 或 PowerShell 的 TcpClient。输入 help,然后 describe。这非常适合探索,但原始的 telnet 不理解 <<END 信标——你只能肉眼观察每条回复在哪里结束。
用于编程/AI 用途时,请使用持久化的缓冲套接字读取器。导致客户端崩溃的两个错误:
- 读取固定数量的字节,而不是读取直到
<<END。回复的长度各不相同。
- 丢弃信标之后到达的字节。TCP 不尊重消息边界;单个
recv 可能包含一条回复的尾部以及下一条回复的头部。保留一个缓冲区,切掉第一个 <<END 之前的所有内容,并保留剩余部分供下次读取——否则你会失去同步,所有后续回复都会错位。
一个最小化且正确的 Python 读取器:
import socket
s = socket.create_connection(("127.0.0.1", 26000), 6)
s.settimeout(15) # > 服务器的 10s 命令上限
buf = b""
def read_reply():
global buf
while b"<<END" not in buf:
chunk = s.recv(4096)
if not chunk:
break
buf += chunk
i = buf.find(b"<<END")
out, buf = (buf[:i], buf[i + 5:].lstrip(b"\r\n")) if i >= 0 else (buf, b"")
return out.decode("utf-8", "replace").rstrip()
def cmd(line):
s.sendall((line + "\n").encode())
return read_reply()
read_reply() # 先消耗掉问候语
print(cmd("describe"))
如果你从另一台机器进行驱动,请不要暴露该端口——在客户端机器上获取一个 shell(SSH、中继代理等),并从那里连接到 127.0.0.1:26000。该模组设计上仅保留在回环地址上。
4. AI_Brain
the AI_Brain (00_Index.md)(在此分支中)是 AI 在会话开始前阅读的背景简介。它故意位于 main 分支上,以便随每个分支和版本一起传播,并且任何操作员都可以阅读它。它是可移植的——它包含可转移的规则,而不是特定机器的启动/控制细节(这些细节保留在内部基础设施文档中)。
它涵盖:
- 角色和范围 -- 代理的唯一任务是通过 M1 进行游戏;它忽略不相关的工具。
- 连接 -- 套接字、协议以及第 3 节中的读取直到
<<END 的规范。
- 操作规范 -- 使自主游戏生效的习惯,以及命令输出旨在支持的内容:
- 移动前先观察 -- 运行
scan + where 并在采取行动之前实际阅读它们。
- 使用寻路移动 -- 提供目的地(
moveto / goto / move);模组会为你绕过墙壁并踏步/跳跃上升。永远不要启用游戏的自动跳跃,永远不要尝试手动跳跃。
- 不要重复失败的尝试 -- 如果移动返回
blocked / timeout / no path,请停止,重新 scan,并选择一个新的或更近的目标。永远不要两次撞击同一面墙。
- 行动前验证 -- 首先确认目标实际上符合目标(例如,在将某处视为“外部”之前,
BOUNDS UP 必须是空气/草地)。
- 利用你所知 -- 应用给定的上下文(例如,“树木在东南方向”)来选择方向。
- 命令快速参考,以及如何阅读
scan 和如何阅读两种槽位编号系统 -- 没有指导时代理容易出错的部分(详见第 5 节)。
- 记录 -- 如何/何时应请求追加到会话日志。
解释性的粘合剂与原始命令同样重要:第 3 节为非显而易见的输出标记了指令文件告诉代理如何阅读它们的方法。
5. 命令参考
在任何动词所在的单独一行发送。help 打印实时列表。别名显示在括号中。方括号 [...] 中的参数是可选的。坐标是绝对世界坐标。
屏幕/菜单导航
| 命令 |
作用 |
describe (screen) |
枚举当前屏幕和每个小部件(递归遍历,包括标签页栏、嵌套配置面板等)。 |
click <id> |
点击具有该 ID 的小部件(随后自动执行 describe 以描述结果)。 |
type <id> <text> |
设置 EditBox 小部件的文本。 |
slots |
列出当前打开容器的插槽。 |
worlds |
列出已保存的世界(在世界选择屏幕上)。 |
joinworld <idx> (join) |
进入/重新进入编号为 idx 的已保存世界。 |
pause |
打开暂停菜单(然后使用 describe + click “保存并退出到标题”来保存并退出)。 |
describe 示例 -- 每个小部件的格式为 [id] Type "label" pos=(x,y) size=WxH FLAGS,其中三个标志分别代表 Visible(可见)/ Active(激活)/ Focused(聚焦)(- 表示关闭)。EditBox 还会显示 value="..."。
screen: TitleScreen title: "Minecraft"
widgets: 5
[0] Button "Singleplayer" pos=(286,98) size=200x20 VA-
[1] Button "Multiplayer" pos=(286,122) size=200x20 VA-
[2] Button "Options..." pos=(286,146) size=98x20 VA-
[3] ImageButton "Language" pos=(265,146) size=20x20 VA-
[4] Button "Quit Game" pos=(389,146) size=98x20 VA-
click 示例 -- handled=true 表示屏幕消耗了此次点击(即发生了真实交互);false 通常意味着你点击了一个装饰性或非活跃的小部件。注意自动描述部分:
OK click 0 "Singleplayer" handled=true
--- now ---
screen: SelectWorldScreen title: "Select World"
widgets: 6
[0] EditBox "search" pos=(...) size=... VA- value=""
[1] Button "Play Selected World" pos=(...) ...
...
type 示例 -- 通过 ID 定位目标框;触发字段的响应器(例如世界种子处理程序):
OK type 0 -> "myseed"
--- now ---
...
type 仅适用于 EditBox。如果将其用于其他小部件,将返回
ERR widget 3 is Button, not an EditBox。
worlds / joinworld -- 世界行位于一个选择列表中(而非小部件列表),因此它们拥有独立的命令:
world entries:
[0] M1Garden, Survival Mode, version 26.1.2
[1] New World, Creative Mode, version 26.2
joinworld 0 -> OK joining world #0
世界状态与感知
| 命令 |
作用 |
where (state) |
玩家位置、朝向、生命值、饥饿值、维度 -- 以及在移动时的实时移动状态。 |
look |
十字准星当前指向的内容。 |
scan [r|<name>] |
视线感知(默认和最大半径为 32)。参见“读取扫描结果”。 |
inv (inventory) |
手持物品 + 所有携带的物品,按稳定的背包索引排列。 |
cmd <command> |
运行服务器命令(无需前导斜杠)。需要世界开启作弊模式。 |
where 示例:
pos=(120.50, 71.00, -8.30) facing=south yaw=2.0 pitch=10.0 health=20.0 food=20 dim=minecraft:overworld
当移动正在进行时,它会附加一个实时进度尾部;一旦完成,则显示结果:
pos=(124.10, 71.00, -4.90) facing=southeast yaw=-44.0 pitch=0.0 health=20.0 food=20 dim=minecraft:overworld | moving -> (130.0,-2.0) wp 7/19 dist 8.6
...
pos=(130.00, 71.00, -2.00) ... | last move: arrived
指令文件如何解读此内容: moving -> (x,z) wp i/N dist D 表示第 i 个路标,共 N 个,距离目标 D 格 -- 轮询它以观察进度。arrived = 已完成。blocked / timeout = 卡住:停止,重新扫描,选择一个新目标 -- 不要重复触发相同的移动指令。
look 示例 -- 报告十字准星下的方块(或实体)、击中的面以及距离;如果十字准星未对准任何内容,则显示 look: nothing in reach:
look: block minecraft:oak_log at (15,71,-8) face=north dist=2.4
scan 示例 -- 四个标记的部分,仅限视线范围内(它无法透视墙壁;你无法前往你看不到的地方):
SCAN pos=(120,71,-8) facing=SOUTH r=32 (line-of-sight)
BOUNDS N:stone 1 S:open >32 E:oak_log 3 W:stone 1 UP:open >32 DOWN:stone 1
VISIBLE oak_log (15,71,-8) E 3 +more | oak_leaves (14,73,-9) E 4 | water (122,69,3) S 11
MOBS cow x2 (124,71,-4) SE 5 | zombie (139,72,2) SE 19
ITEMS oak_log (15,71,-8) E 3
解读非显而易见部分(这正是指令文件教给代理的内容):
BOUNDS 是沿六个轴(北、南、东、西、上、下)直线方向最近的表面及其距离 -- 这是你的“我是否被包围 / 地板和天花板是什么”的判断依据。open >32 表示在该方向上没有击中范围内的任何东西。BOUNDS UP: open >32 是标准的“我在户外 / 头顶是开阔天空”检查。
VISIBLE 列出视野中显著的方块,按组排序且最近者优先,每项格式为 name (x,y,z) BEARING dist。常见的填充物(石头、泥土、草、砾石、沙子、草树叶等)在此处故意隐藏 -- 请使用 BOUNDS 来获取这些信息。+more 表示你还看到了其他相同类型的方块(仅列出最近的一个)。坐标是绝对坐标 -- 直接将其输入 goto。
- 无透视,仅前方(M1 不会作弊)。
VISIBLE 是从玩家眼睛出发在朝向方向上的视线范围 -- 只能看到暴露的方块面(永远看不到隐藏在实心岩石内的矿石),且只能看到面前的东西。MOBS(活体实体)是一个例外:它们在四周都被检测到,而不仅仅是在前方。
MOBS / ITEMS 是视野中的活体实体和掉落物品。xN 是该种类的数量(例如 cow x2)。
- 方位 是绝对罗盘方向:
N S E W NE NW SE SW,或者当某物基本上正上方/正下方时使用 UP / DOWN。
定向扫描 -- scan <name> 返回 ID 包含 <name> 的最近可见方块或实体;scan <r> 覆盖半径:
scan logs -> oak_log (15,71,-8) E 3 +more
scan diamond -> scan diamond: none visible within 32
scan 16 -> (a full SCAN, but only out to 16 blocks)
inv 示例 -- held: hotbar[N] 是你选中的快捷栏槽位;物品按稳定的背包索引列出(见下面的槽位编号):
held: hotbar[0] = 1x Wooden Axe
items:
[0] 1x Wooden Axe
[9] 12x Oak Log
[10] 6x Oak Planks
cmd 示例 -- 发送服务器命令,就像你输入了 /... 一样(需要作弊权限):
cmd time set 6000 -> OK sent: /time set 6000
移动
| 命令 |
作用 |
moveto <x> <z> |
寻路并步行至 x,z(Y 轴跟随地形)。 |
goto <x> <y> <z> |
寻路并步行至完整坐标。 |
move <dir> <n> |
寻路并沿罗盘方向步行 n 个方块。 |
face <dir|yaw [pitch]|x y z> |
设置朝向:罗盘词、原始偏航角(+可选俯仰角),或注视某坐标。 |
stop |
停止移动(并停止挖掘)。 |
所有三个移动动词都运行 M1 自己的寻路算法(nav own,为默认值;nav vanilla 则回退到借用的原版 A*)。它是为 PLAYER(玩家)体型设计的,而非生物:它会在路径中自行打开栅栏门和门,走过铁轨,走上楼梯(而不是跳跃),绕过墙壁,并通过以 16 个方块为一段进行规划来抵达任意距离(即使目标在数百万方块之外也没问题——它每次仅计算前方约 18 个方块)。将固体方块指定为目标时,它会重新定位到其旁边可站立的单元格。进度和诚实的失败原因会以 [agent] nav: 行的形式返回。你无需计时按键按住的时间,也无需自己执行跳跃操作。
move se 8 -> OK move se -> (126.3,-2.3) via 9 waypoints. poll 'where'.
moveto 130 -2 -> OK moveto -> (130.0,-2.0) via 19 waypoints. poll 'where'.
goto 15 71 -8 -> OK goto -> (15.0,-8.0) via 12 waypoints (partial, will re-route). poll 'where'.
晦涩的输出说明:via N waypoints = 找到的路径长度。(partial, will re-route) 意味着只有路线的一部分最初可达;模组将在行进过程中重新计算。如果目标不可达,你会立即收到 no path to (x,z) -- re-scan and pick a closer/clearer point ——指令文件将其视为一个强烈的“选择不同目标”信号。
face 示例:
face south -> OK facing south (yaw 0.0)
face 90 -> OK yaw=90.0
face 15 71 -8 -> OK looking at (15.0,71.0,-8.0) yaw=-12.3 pitch=8.7
本引擎中的罗盘映射:偏航角 0 = south(南),方向为
north/south/east/west/ne/nw/se/sw。静止视角为 face 0 0(水平,面向南方)。
挖掘
| 命令 |
作用 |
mine [x y z] |
挖掘准星所在的方块,或位于 x y z 的方块(会先为你面对该方块)。 |
mine 15 71 -8 -> OK mining minecraft:oak_log at (15,71,-8). poll 'inv'/'look'.
mine -> mine: not looking at a block (face it first, or 'mine x y z')
挖掘操作保持 攻击 键功能,这仅在游戏窗口拥有鼠标焦点时(即在聚焦的游戏内窗口中)且没有打开任何菜单时才破坏方块。
物品栏与合成
| 命令 |
作用 |
openinv |
打开物品栏屏幕(2x2 合成网格)。 |
close |
关闭打开的屏幕。 |
hold <0-8> |
选择快捷栏槽位(基于 0 计数;hold 0 = 快捷栏第 1 格)。 |
equip <item> | equip all |
按名称或 ID 自动路由:护甲 -> 对应槽位,盾牌 -> 副手,背包 -> 穿戴,否则放入手中。equip all 可在一条命令中让你全套装备。 |
place |
将你手持的物品放置/使用在你注视的方块上(放置方块、打开工作台、按下按钮、使用床等)。 |
craft planks|sticks|table|axe |
合成物品(异步操作;轮询 inv)。 |
slot <id> [btn] [pickup|quick|swap] |
通过打开菜单的索引进行底层原始槽位点击。 |
openinv -> OK inventory open (2x2 grid, containerId=2)
hold 0 -> OK hold hotbar 0 = 1x Wooden Axe
equip crafting_table -> OK equipped crafting_table to hotbar 0
place -> OK place/use -> SUCCESS
craft planks -> OK crafting planks (poll 'inv')
slot 1 0 quick -> OK slot 1 btn 0 QUICK_MOVE
合成是感知网格且基于刻驱动的。 planks 和 table 可在 2x2 物品栏网格中工作;
sticks 和 axe 需要打开已放置的工作台(3x3)。配方结果大约在原料放置后的一刻出现,且只有在空手时才会移出——craft 命令会为你处理这个时机,因此只需轮询 inv 即可。
Agent 层、战斗、存储、物品栏动词及组合件 (0.6-0.9)
agent 动词在 M1 的代理引擎上排队自主的、逐刻执行的动作:每个子命令立即返回 queued ...,在后续的世界刻中运行,并在随后的回复中以 [agent] <seq> <CLASS>: <text> 行的形式异步报告。轮询 agent status。
| 命令 |
功能说明 |
agent status / agent ping |
引擎状态 / 端到端探测。 |
agent goto <x y z> / agent moveto <x z> / agent patrol <x z ...> |
排队寻路移动。 |
agent look <x y z|yaw [pitch]> / agent mine <x y z> / agent use / agent place |
瞄准、破坏、使用/放置。 |
agent hold <0-8> / agent equip <item> / agent slot <id> [btn] [mode] |
将库存操作作为计划步骤。 |
agent drop [all] |
将手中物品(或整组)丢弃到地上。 |
agent jump / agent sneak [on|off] / agent sprint [on|off] |
模拟按键行为(基于 KeyMapping)。 |
agent openinv / agent close |
打开 2x2 合成栏界面 / 关闭界面,作为计划步骤。 |
attack [nearest|<id>|crosshair] [crit|normal|ranged] |
通用战斗:自动装备最佳武器,靠近敌人并把握暴击时机。ranged 模式会拉弓射击(弹道瞄准);手持长矛可在 2-4.5 格距离内刺击。内置针对每种敌人的战术(苦力怕打后撤、骷髅兵举盾推进、飞行生物优先使用弓箭)。 |
agent follow <player> [dist] |
锁定一名玩家并保持跟随(支持冲刺追赶、传送门),直到执行 stop。 |
defend [on|off|status|auto|<player>] |
自动防御机制:如果你或被保护者受到攻击,模组会介入攻击者,随后恢复之前的计划。 |
agent shield [ticks] |
举起/保持盾牌格挡。 |
agent stop / stop |
清除计划,停止移动/挖掘,释放潜行/疾跑状态。 |
银行金库存储(需要 Bank Vault 模组,版本 26.x):
vault mark [x y z](记住金库方块位置),vault status,vault contents [filter](读取已打开的金库并记录全局存储记忆),vault withdraw <n> <item>,
vault deposit rows|all|<item>(rows 永远不会触碰快捷栏 -- 快捷栏是保留列表),
vault find <item> / vault memory(查询上次在何处看到某物),以及 agent vault close --
一种受保护的关闭操作:重新打开标记的金库,根据会话快照验证佩戴的饰品,并将因已知的 Trinkets 关闭时弹出 bug 而掉入背包的物品重新装备。
通用合成(26.x):cancraft <item> 回答“我现在能制作这个吗?”它来自实时配方书 -- YES 附带配方,或 NO 并逐材料标注 HAVE/NEED 行,带有 (in vault: <id>) 和 (craftable) 注释。agent craft <item> [count] 合成任何配方书内的配方:打开 2x2 合成栏或工作台,它会选择一个可行的配方,自动填充网格,收集结果,并在存储记忆确认存在时自动从你的银行金库中取出缺失的材料。(熔炉/锻造台/切石机及中间材料的自动合成为规划中功能。)
SAFE-MOB 原则。attack nearest 绝不会主动攻击中立生物(僵尸猪灵、末影人、狼、蜜蜂、铁傀儡等)-- 仅用于自卫,且模组不会为了你/主人去防御其中之一的攻击(加入战斗会激怒群体)。你仍然可以手动明确指定攻击它们。
高级库存动词(使用名称而非索引)。这些命令接受物品名称和人类可读的槽位词,并为你处理槽位逻辑(如果容器界面已打开则自动打开):equip all(穿戴最佳护甲 + 副手盾牌 + 最佳武器),equip <item>(自动路由:护甲 -> 对应槽位,盾牌 -> 副手,背包 -> 穿戴,否则放入手中),organize hotbar(标准布局:剑/镐/斧/铲/锄/食物),takeall(清空已打开的容器),stash junk(将杂物移出快捷栏),
moveitem <item> to <hb1-9\|offhand\|head\|chest\|legs\|feet>。
组合命令。sleep -- 寻找床(或部署 Travelers-Backpack 睡袋),走到床边,睡觉,失败时会给出具体原因。recover -- 一条命令清理死亡墓地点(名牌 + 箱子 + 盔甲架):打破名牌,清空箱子,打破盔甲架,拾取掉落物,然后执行 equip all + organize hotbar。
Travelers Backpack(需要该模组):pack on 在代码层面穿戴背包(无需 GUI);pack contents [f] / pack put <item\|all\|junk> / pack take <item> [n] 读取并批量移动其存储空间。
自动界面 + 死亡反射。右键点击名牌会打开编辑对话框 -- M1 会自动将其关闭(挖掘/攻击名牌即可移除它)。死亡后自动重生(死亡位置会被报告)。当菜单正在限制你的移动时,where 会警告 screen OPEN: ... -- 发送 close 以关闭。
AI_Brain 命令卡片(m1_ai_brain/10_command_card.md,随 jar 包一起分发)是上述所有内容的最新语法参考。
装备 / 自动护甲升级
| 命令 |
功能说明 |
openpack |
打开你当前穿戴的 Travelers Backpack(独立触发其快捷键)。 |
upgrades |
重新显示任何待处理的自动护甲升级消息。 |
autoupgrade on|off |
切换自动护甲升级开关(默认开启)。 |
自动升级自行运行,每约 5 秒一次且无需打开 GUI:它按以下层级为每个槽位装备你携带的最佳护甲:
nothing < gold(仅空槽) < leather < copper < chainmail < iron < diamond < netherite
(平局时剩余耐久度高的优先;黄金仅填充空槽,一旦找到真实等级立即替换)。你不需要管理护甲。当它更换物品时,会在你的下一次回复中告知你:
[auto-upgrade] CHEST: leather_chestplate -> iron_chestplate
[auto-upgrade] FEET: nothing -> golden_boots
upgrades -> no upgrades pending
autoupgrade off -> OK auto-upgrade OFF
openpack 的存在是因为穿戴的背包界面是通过快捷键打开的,而不是通过小部件。M1 找到背包键映射并以隔离方式触发它(临时将其重新绑定到scratch键),这样共享的物理按键 -- 例如小地图和背包都绑定到 B -- 就不会同时触发。回复:OK triggered key.travelersbackpack.inventory in isolation -- poll 'describe'.
实用工具
| 命令 |
功能说明 |
screenshot [name] (shot) |
通过游戏自带的截图保存器,将当前帧保存为 PNG 格式。 |
help |
打印命令列表。 |
quit / exit |
关闭此连接(不会停止客户端)。 |
screenshot scene1 -> OK screenshot scene1.png (148213 bytes) path=<gameDir>/screenshots/scene1.png
6. 槽位编号规则
存在两种编号方案,混淆它们是导致槽位错误的最常见原因。
inv 索引是稳定的 —— 无论打开什么界面,它们都永远不会改变。请将其用于
hold / equip 以及确认你携带的物品:
0-8 快捷栏,从左到右 (游戏中的快捷栏槽位 N = inv 索引 N-1)
9-35 主储物栏(9-17 第一行,18-26 第二行,27-35 第三行)
36 靴子 | 37 护腿 | 38 胸甲 | 39 头盔 | 40 副手
slots 索引会为每个打开的容器重新编号 —— 始终运行 slots 以获取实时数据,
切勿想当然。你自己的物品存储会在容器的槽位之后被重新索引并追加显示:
打开背包 (openinv, 2x2): 0 结果格 | 1-4 2x2 网格 | 5 头盔 6 胸甲 7 护腿 8 靴子
| 9-35 主储物栏 | 36-44 快捷栏 | 45 副手
打开工作台 (3x3): 0 结果格 | 1-9 3x3 网格 | 10-36 主储物栏 | 37-45 快捷栏
任何其他容器: 首先是容器槽位 (0..N-1),然后是主储物栏 (27),最后是快捷栏 (9)
slot <id> ... 是通过当前打开菜单的索引(来自 slots)进行点击,而非 inv 索引。
合成网格仅在界面打开时存在,因此它们会出现在 slots 中,绝不会出现在 inv 中。
7. 操作注意事项与安全须知
- 仅限客户端。 M1 不在服务端运行任何逻辑。
cmd 仅仅是发送一个正常的客户端到服务器的
命令,就像玩家输入 /time 一样。
- 切勿在加载的世界中直接断开连接。 要离开世界,请先执行
pause,然后点击“保存并退出到标题画面”
—— 这会先进行保存。
- 异步命令 (
move*, goto, mine, craft) 会立即返回;请轮询
where / inv / look。stop 用于中止移动和挖掘。
- 覆盖范围上限,老实说: M1 能够枚举结构良好、基于小部件/容器的 GUI。
那些使用即时模式手绘 UI 的模组(绘制纹理、对硬编码矩形进行命中测试)
没有可供列出的小部件对象 —— 可见窗口是发现这些遗漏区域的手段。
仓库与构建
源代码、设置步骤及完整的构建说明位于
minecraft-1.20-26.3 构建与设置分支
(模组 + 桥接设置、各加载器的工具链、版本覆盖矩阵,以及代码生成机制)。内部工具;保留所有权利 (ARR)。
M1 -- Machine One AI Interface
PLEASE review the branches above for the source code tree.
M1 is a Minecraft mod that exposes the real, running game client over a plain
localhost text socket. It describes whatever screen or world is in front of the client as text,
and accepts text commands to drive it -- so a human at a terminal, or an AI over a socket, can
operate Minecraft entirely by typing. No GUI mouse/keyboard is required and nothing needs to be
"looked at" on screen; the window is there purely for observability.
Ships as a Fabric, NeoForge, and Forge mod spanning Minecraft 1.20 through 26.x, as a client agent plus an optional server-side /m1srv command (needs neither side present).
Source code / build & setup guide | Report an issue / get support
New here? Read the AI_Brain (00_Index.md) first. That is the file an AI agent
is expected to load before a play session. This README is the reference manual behind it.
1. Popular Uses for M1
Most "AI plays Minecraft" projects never actually run Minecraft. They are protocol bots that speak
the server's network protocol from the outside (Mineflayer, and LLM agents built on it like
Voyager), or research stacks pinned to ancient versions (Malmo, MineRL). Because they never load
the real client, they are blind to anything the client draws -- mod GUIs simply do not exist to
them, and a version or mod mismatch breaks them.
M1 is the real client. It loads as an ordinary Fabric / NeoForge / Forge mod, reads every real screen, and
drives the game the way you would. That unlocks what the protocol bots cannot touch:
- Mod development & real-client testing. Test your mod the way a player actually experiences
it -- open its screens, click its buttons, read its inventories, drive its menus, grab
screenshots -- all by text. M1 has served as the live test harness across 20+ release builds
spanning many Minecraft versions and all three loaders, so you validate a mod across the whole
range, not one pinned version.
- AI agents that genuinely play. Point any LLM at a text socket and let it go -- proven
end-to-end: spawn, find a tree, mine, craft, and build a wooden axe, entirely over the wire --
and because it is the real client, your agent can operate mod GUIs too, not just vanilla
movement.
- Hands-free / accessible play. Run the whole game -- menus, worlds, inventory, crafting -- by
typing. Nothing on screen needs to be looked at.
- Automation & scripting. Repeatable command sequences for the tedious stuff (gather, craft,
navigate, set up a world), from any language, in plain text -- with auto armor-upgrade built in.
No protocol reverse-engineering, no pixel pipeline, no RL training, no lock-in to one AI model or
one Minecraft version -- just plain text into the real game.
M1 plays fair -- it does not cheat or x-ray. A scan perceives only what a player looking at
the screen could: it never sees raw ores buried inside unexposed rock, and -- apart from living
entities, which it detects all around -- it reports only what is in front of the player, never
through or behind walls. An AI driving M1 works from exactly the information a human at the keyboard
would have.
2. Getting M1 running
M1 is client-side only (no server mod). Drop the jar for your loader + MC version in your
instance's mods/ folder, launch a world, and on load M1 opens its text socket on
127.0.0.1:26000 and extracts the AI_Brain docs.
To drive it from Claude Desktop (or any MCP client) you also run the small MCP-Minecraft
bridge shipped in the source repo. Full step-by-step setup -- install, the bridge, and the Claude
Desktop wiring -- is in the build & setup guide on the minecraft-1.20-26.3
branch.
3. Connecting
When the modded client starts, M1 opens a TCP server on 127.0.0.1:26000 on the machine
running the client. It binds loopback only -- there is no new inbound network surface; only
processes already on that machine can reach it. Run one modded client at a time (every build binds
the same port).
The channel is the same whether a person types it or an AI sends it -- one grammar, one code path.
Anything an AI does is reproducible by hand and vice versa.
Wire protocol
- Newline-delimited. Send one command per line (
<command>\n). The reply is one or more lines
of text, terminated by a single sentinel line: <<END.
- A greeting is sent on connect --
Connected to Machine One (M1). Type START to begin, or HELP for commands. followed by a <<END. Read and
discard it before sending your first command.
- After an action command (
click / type) the reply also contains a --- now --- marker
followed by a fresh describe of the resulting screen (the mod waits ~150 ms for any
transition/fade to settle, then auto-describes). So every action tells you the new situation.
- Auto-upgrade notices (see the armor section) arrive unsolicited, prefixed
[auto-upgrade], prepended to the next reply you receive.
- Each command has a 10-second execution cap. This is how long M1 waits for a command's
handler to finish on the game's main thread and hand back a reply. If a handler overruns,
M1 returns
ERR exec: ... TimeoutException rather than leaving your connection hanging. The
cap is on the handler returning a reply -- it is NOT a limit on how long an in-world action
takes. The asynchronous commands (move / moveto / goto / mine / craft) return almost
instantly with OK ... poll 'where' and then run in the background, so a two-minute walk or a
long mine never hits the cap -- only a genuinely stalled or hitched client would. Practical
consequence: set your socket read timeout above 10 s (e.g. 15 s) so your reader outlasts the
server's own cap and actually receives that ERR line instead of tripping its own timeout first.
- Each command runs on the client's main thread, so the game stays consistent.
quit / exit closes your connection (it does not stop the client).
Interfacing tips
For a quick manual poke (a human at a shell on the client machine): any line-oriented TCP tool
works -- telnet 127.0.0.1 26000, nc 127.0.0.1 26000, or PowerShell's TcpClient. Type help,
then describe. This is great for exploring, but raw telnet does not understand the <<END
sentinel -- you just eyeball where each reply ends.
For programmatic / AI use, use a persistent, buffered socket reader. The two mistakes that
break clients:
- Reading a fixed number of bytes instead of reading until
<<END. Replies vary in length.
- Throwing away bytes that arrive after the sentinel. TCP does not respect message
boundaries; a single
recv can contain the tail of one reply and the head of the next. Keep a
buffer, slice off everything up to the first <<END, and retain the remainder for the next
read -- otherwise you desync and every later reply is misaligned.
A minimal, correct Python reader:
import socket
s = socket.create_connection(("127.0.0.1", 26000), 6)
s.settimeout(15) # > the server's 10s command cap
buf = b""
def read_reply():
global buf
while b"<<END" not in buf:
chunk = s.recv(4096)
if not chunk:
break
buf += chunk
i = buf.find(b"<<END")
out, buf = (buf[:i], buf[i + 5:].lstrip(b"\r\n")) if i >= 0 else (buf, b"")
return out.decode("utf-8", "replace").rstrip()
def cmd(line):
s.sendall((line + "\n").encode())
return read_reply()
read_reply() # consume the greeting first
print(cmd("describe"))
If you are driving from another machine, do not expose the port -- get a shell on the client
machine (SSH, a relay agent, etc.) and connect to 127.0.0.1:26000 from there. The mod stays
loopback-only by design.
4. The AI_Brain
the AI_Brain (00_Index.md) (in this branch) is the standing brief an AI reads in
before a session. It is deliberately on main so it travels with every branch and version, and
so any operator can read it. It is portable -- it contains the transferable rules, not any one
machine's launch/control specifics (those stay in internal infra docs).
It covers:
- Role and scope -- the agent's only job is to play through M1; it ignores unrelated tooling.
- Connecting -- the socket, the protocol, and the read-until-
<<END discipline in section 3.
- Operating discipline -- the habits that make autonomous play work, and that the command
outputs are designed to support:
- Look before you move -- run
scan + where and actually read them before acting.
- Move with pathfinding -- give a destination (
moveto / goto / move); the mod routes
around walls and steps/jumps up for you. Never enable the game's Auto-Jump, never try to jump
manually.
- Do not repeat what failed -- if a move comes back
blocked / timeout / no path, stop,
re-scan, and pick a new or closer target. Never bump the same wall twice.
- Verify before you act -- confirm a target actually meets the goal first (e.g.
BOUNDS UP is
air/grass before treating a spot as "outside").
- Use what you know -- apply given context (e.g. "trees are to the southeast") to choose a
direction.
- The command quick-reference, plus how to read a
scan and how to read the two slot
numbering systems -- the parts an agent gets wrong without guidance (detailed in section 5).
- Recording -- how/when to append to a session log (on request only).
The interpretive glue matters as much as the raw commands: section 3 marks, for the non-obvious
outputs, how the instruction file tells an agent to read them.
5. Command reference
Send any verb on its own line. help prints the live list. Aliases are shown in parentheses.
Bracketed [...] args are optional. Coordinates are absolute world coordinates.
Screen / menu navigation
| Command |
What it does |
describe (screen) |
Enumerate the current screen and every widget, recursively (tab bars, nested config panels). |
click <id> |
Click the widget with that id (then auto-describes the result). |
type <id> <text> |
Set the text of an EditBox widget. |
slots |
List the slots of the currently open container. |
worlds |
List saved worlds (on the world-select screen). |
joinworld <idx> (join) |
Enter/re-enter saved world number idx. |
pause |
Open the pause menu (then describe + click "Save and Quit to Title" to save+exit). |
describe example -- each widget is [id] Type "label" pos=(x,y) size=WxH FLAGS, where the
three flags are Visible / Active / Focused (a - means off). An EditBox also shows
value="...".
screen: TitleScreen title: "Minecraft"
widgets: 5
[0] Button "Singleplayer" pos=(286,98) size=200x20 VA-
[1] Button "Multiplayer" pos=(286,122) size=200x20 VA-
[2] Button "Options..." pos=(286,146) size=98x20 VA-
[3] ImageButton "Language" pos=(265,146) size=20x20 VA-
[4] Button "Quit Game" pos=(389,146) size=98x20 VA-
click example -- handled=true means the screen consumed the click (a real interaction);
false usually means you clicked a decorative/inactive widget. Note the auto-describe:
OK click 0 "Singleplayer" handled=true
--- now ---
screen: SelectWorldScreen title: "Select World"
widgets: 6
[0] EditBox "search" pos=(...) size=... VA- value=""
[1] Button "Play Selected World" pos=(...) ...
...
type example -- targets the box by id; fires the field's responder (e.g. the world-seed
handler):
OK type 0 -> "myseed"
--- now ---
...
type only works on an EditBox. Aiming it at another widget returns
ERR widget 3 is Button, not an EditBox.
worlds / joinworld -- world rows live in a selection list (not the widget list), so they
have their own commands:
world entries:
[0] M1Garden, Survival Mode, version 26.1.2
[1] New World, Creative Mode, version 26.2
joinworld 0 -> OK joining world #0
World state & perception
| Command |
What it does |
where (state) |
Player position, facing, health, food, dimension -- and live movement status while moving. |
look |
What the crosshair is pointed at right now. |
scan [r|<name>] |
Line-of-sight perception (default and max radius 32). See "Reading a scan". |
inv (inventory) |
Held item + everything you carry, by stable inventory index. |
cmd <command> |
Run a server command (no leading slash). Needs cheats in the world. |
where example:
pos=(120.50, 71.00, -8.30) facing=south yaw=2.0 pitch=10.0 health=20.0 food=20 dim=minecraft:overworld
While a move is running it appends a live progress tail; once finished it shows the outcome:
pos=(124.10, 71.00, -4.90) facing=southeast yaw=-44.0 pitch=0.0 health=20.0 food=20 dim=minecraft:overworld | moving -> (130.0,-2.0) wp 7/19 dist 8.6
...
pos=(130.00, 71.00, -2.00) ... | last move: arrived
How the instruction file reads this: moving -> (x,z) wp i/N dist D means waypoint i of
N, D blocks from the goal -- poll it to watch progress. arrived = done. blocked /
timeout = stuck: stop, re-scan, pick a new target -- do not re-fire the same move.
look example -- reports the block (or entity) under the crosshair, the face hit, and the
distance; look: nothing in reach if the crosshair is on nothing:
look: block minecraft:oak_log at (15,71,-8) face=north dist=2.4
scan example -- four labelled sections, line-of-sight only (it never sees through walls;
you cannot path to what you cannot see):
SCAN pos=(120,71,-8) facing=SOUTH r=32 (line-of-sight)
BOUNDS N:stone 1 S:open >32 E:oak_log 3 W:stone 1 UP:open >32 DOWN:stone 1
VISIBLE oak_log (15,71,-8) E 3 +more | oak_leaves (14,73,-9) E 4 | water (122,69,3) S 11
MOBS cow x2 (124,71,-4) SE 5 | zombie (139,72,2) SE 19
ITEMS oak_log (15,71,-8) E 3
Reading the non-obvious bits (this is exactly what the instruction file teaches an agent):
BOUNDS is the nearest surface straight along each of the 6 axes (N S E W UP DOWN), with
distance -- your "am I boxed in / what's the floor and ceiling" read. open >32 means
nothing was hit within range that way. BOUNDS UP: open >32 is the standard "I'm outside / under
open sky" check.
VISIBLE lists notable blocks in sight, grouped and sorted nearest-first, each as
name (x,y,z) BEARING dist. Common filler (stone, dirt, grass, gravel, sand, leaves-grass,
etc.) is hidden here on purpose -- use BOUNDS for those. +more means you also saw
other blocks of that same type (only the nearest is listed). Coordinates are absolute -- feed
them straight into goto.
- No x-ray, front-only (M1 does not cheat).
VISIBLE is line-of-sight from the player's eye in
the facing direction -- only exposed block faces are seen (never ore hidden inside solid
rock), and only what is in front of you. MOBS (living entities) are the one exception: they
are detected all around, not just ahead.
MOBS / ITEMS are living entities and dropped items in sight. xN is the count of
that kind (e.g. cow x2).
- Bearings are absolute compass:
N S E W NE NW SE SW, or UP / DOWN when something is
essentially straight above/below.
Targeted scan -- scan <name> returns the nearest visible block or entity whose id contains
<name>; scan <r> overrides the radius:
scan logs -> oak_log (15,71,-8) E 3 +more
scan diamond -> scan diamond: none visible within 32
scan 16 -> (a full SCAN, but only out to 16 blocks)
inv example -- held: hotbar[N] is your selected hotbar slot; items are listed by a
stable inventory index (see slot numbering below):
held: hotbar[0] = 1x Wooden Axe
items:
[0] 1x Wooden Axe
[9] 12x Oak Log
[10] 6x Oak Planks
cmd example -- sends a server command as if you typed /... (cheats required):
cmd time set 6000 -> OK sent: /time set 6000
Movement
| Command |
What it does |
moveto <x> <z> |
Pathfind + walk to x,z (Y follows terrain). |
goto <x> <y> <z> |
Pathfind + walk to full coordinates. |
move <dir> <n> |
Pathfind + walk n blocks in a compass direction. |
face <dir|yaw [pitch]|x y z> |
Set facing: a compass word, a raw yaw (+optional pitch), or look-at a coordinate. |
stop |
Stop moving (and stop mining). |
All three move verbs run M1's own pathfinder (nav own, the default; nav vanilla falls back
to the borrowed vanilla A*). It is built for a PLAYER body, not a mob: it opens fence gates and
doors itself mid-route, walks over rails, walks up stairs (rather than jumping), routes
around walls, and reaches any distance by planning in 16-block segments (a destination
millions of blocks away is fine -- it only ever computes ~18 blocks ahead). Name a solid block as
the target and it retargets to a standable cell beside it. Progress + honest failure reasons arrive
as [agent] nav: lines. You do not time key-holds and you do not jump yourself.
move se 8 -> OK move se -> (126.3,-2.3) via 9 waypoints. poll 'where'.
moveto 130 -2 -> OK moveto -> (130.0,-2.0) via 19 waypoints. poll 'where'.
goto 15 71 -8 -> OK goto -> (15.0,-8.0) via 12 waypoints (partial, will re-route). poll 'where'.
Obscure outputs: via N waypoints = path length found. (partial, will re-route) means
only part of the route was reachable up front; the mod will recompute as it goes. If the target
is unreachable you get no path to (x,z) -- re-scan and pick a closer/clearer point straight
away -- the instruction file treats that as a hard "pick a different target" signal.
face examples:
face south -> OK facing south (yaw 0.0)
face 90 -> OK yaw=90.0
face 15 71 -8 -> OK looking at (15.0,71.0,-8.0) yaw=-12.3 pitch=8.7
Compass mapping in this engine: yaw 0 = south, and dirs are
north/south/east/west/ne/nw/se/sw. Resting view is face 0 0 (level, facing south).
Mining
| Command |
What it does |
mine [x y z] |
Mine the crosshair block, or the block at x y z (faces it for you first). |
mine 15 71 -8 -> OK mining minecraft:oak_log at (15,71,-8). poll 'inv'/'look'.
mine -> mine: not looking at a block (face it first, or 'mine x y z')
Mining holds the attack key function, which only breaks blocks when the game window has the
mouse grabbed (true on a focused in-game window) and no menu is open.
Inventory & crafting
| Command |
What it does |
openinv |
Open the inventory screen (the 2x2 crafting grid). |
close |
Close the open screen. |
hold <0-8> |
Select a hotbar slot (0-based; hold 0 = hotbar slot 1). |
equip <item> | equip all |
Auto-route by NAME or id: armor -> its slot, shield -> off-hand, backpack -> worn, else to hand. equip all kits you out in one command. |
place |
Use/place the held item on the block you are looking at (places a block, opens a table, presses a button, uses a bed, etc.). |
craft planks|sticks|table|axe |
Craft an item (asynchronous; poll inv). |
slot <id> [btn] [pickup|quick|swap] |
Low-level raw slot click by the open menu's index. |
openinv -> OK inventory open (2x2 grid, containerId=2)
hold 0 -> OK hold hotbar 0 = 1x Wooden Axe
equip crafting_table -> OK equipped crafting_table to hotbar 0
place -> OK place/use -> SUCCESS
craft planks -> OK crafting planks (poll 'inv')
slot 1 0 quick -> OK slot 1 btn 0 QUICK_MOVE
Crafting is grid-aware and tick-driven. planks and table work in the 2x2 inventory grid;
sticks and axe need a placed crafting table open (3x3). A result appears about one tick after
ingredients are placed and only moves out with an empty hand -- the craft command handles that
timing for you, so just poll inv.
Agent layer, combat, storage, inventory verbs & composites (0.6-0.9)
The agent verb queues autonomous, tick-stepped actions on M1's agent engine: each subcommand
returns queued ... immediately, runs over later in-world ticks, and reports back asynchronously as
[agent] <seq> <CLASS>: <text> lines on subsequent replies. Poll agent status.
| Command |
What it does |
agent status / agent ping |
Engine status / end-to-end probe. |
agent goto <x y z> / agent moveto <x z> / agent patrol <x z ...> |
Queued pathfinding movement. |
agent look <x y z|yaw [pitch]> / agent mine <x y z> / agent use / agent place |
Aim, break, use/place. |
agent hold <0-8> / agent equip <item> / agent slot <id> [btn] [mode] |
Inventory verbs as plan steps. |
agent drop [all] |
Drop 1 (or the stack) of the held item on the ground. |
agent jump / agent sneak [on|off] / agent sprint [on|off] |
Movement-key leaves (KeyMapping-driven). |
agent openinv / agent close |
Open the 2x2 inventory / close the screen, as plan steps. |
attack [nearest|<id>|crosshair] [crit|normal|ranged] |
Universal combat: auto-equips the best weapon, walks in, times crits. ranged draws a bow (ballistic aim); a held spear stabs at 2-4.5 blocks. Per-enemy tactics built in (creeper hit-and-back, skeleton shield-advance, flyers prefer the bow). |
agent follow <player> [dist] |
Lock onto a player and keep pace (sprint catch-up, portals) until stop. |
defend [on|off|status|auto|<player>] |
Auto-defense reflex: if you or the protectee is hit, the mod engages the attacker, then resumes the previous plan. |
agent shield [ticks] |
Raise/hold a shield. |
agent stop / stop |
Clear the plan, stop moving/mining, release sneak/sprint. |
Bank Vault storage (requires the Bank Vault mod, 26.x):
vault mark [x y z] (remember the vault block), vault status, vault contents [filter] (reads the
open vault and records a per-world storage memory), vault withdraw <n> <item>,
vault deposit rows|all|<item> (rows never touches the hotbar -- the hotbar is the keep-list),
vault find <item> / vault memory (query what was last seen where), and agent vault close --
a guarded close that reopens the marked vault, verifies worn trinkets against the session snapshot,
and re-equips anything the known Trinkets eject-on-close bug knocked into the inventory.
Generic crafting (26.x): cancraft <item> answers "can I make this right now?" from the live
recipe book -- YES with the recipe, or NO with per-ingredient HAVE/NEED lines annotated
(in vault: <id>) and (craftable). agent craft <item> [count] crafts ANY recipe-book recipe:
open the 2x2 or a crafting table, and it picks a satisfiable recipe, auto-fills the grid, collects
the result, and auto-withdraws missing ingredients from your Bank Vault when storage memory
knows they are there. (Furnace/smithing/stonecutter and auto-crafting of intermediates are planned.)
SAFE-MOB doctrine. attack nearest never pre-emptively targets a neutral mob (zombified
piglins, endermen, wolves, bees, iron golems, ...) -- self-defense only, and the mod will not defend
you/the master against one (joining angers the group). You may still target one explicitly.
High-level inventory verbs (names, not indices). These take item names and human slot words and
do the slot mechanics for you (auto-opening the inventory if a container is up): equip all (wear
best armor + shield to off-hand + best weapon), equip <item> (auto-routed: armor -> its slot,
shield -> off-hand, backpack -> worn, else hand), organize hotbar (standard layout: sword/pickaxe/
axe/shovel/hoe/food), takeall (empty an open container), stash junk (junk off the hotbar),
moveitem <item> to <hb1-9\|offhand\|head\|chest\|legs\|feet>.
Composites. sleep -- find a bed (or deploy a Travelers-Backpack sleeping bag), walk beside it,
sleep, with a concrete reason on failure. recover -- clear a death grave-site (name sign + chest +
armor stand) in one command: break the sign, empty the chest, break the stand, collect drops, then
equip all + organize hotbar.
Travelers Backpack (requires the mod): pack on wears a backpack from your inventory at the code
level (no GUI); pack contents [f] / pack put <item\|all\|junk> / pack take <item> [n] read and
batch-move its storage.
Automatic screen + death reflexes. Right-clicking a sign opens its edit dialog -- M1
auto-dismisses it (mine/attack a sign to remove it). On death you auto-respawn (the death spot is
reported). where warns screen OPEN: ... when a menu is holding your movement -- send close.
The AI_Brain command card (m1_ai_brain/10_command_card.md, shipped in the jar) is the always-current
syntax reference for everything above.
Gear / auto armor-upgrade
| Command |
What it does |
openpack |
Open your worn Travelers Backpack (fires its keybind in isolation). |
upgrades |
Re-show any pending auto-armor-upgrade messages. |
autoupgrade on|off |
Toggle automatic armor upgrading (default on). |
Auto-upgrade runs by itself every ~5 s with no GUI open: it equips the best armor you are
carrying per slot, by the tree
nothing < gold(bare-slot-only) < leather < copper < chainmail < iron < diamond < netherite
(ties break on more remaining durability; gold only fills an empty slot and is replaced as soon as
a real tier is found). You do not manage armor. When it swaps something it tells you on your
next reply:
[auto-upgrade] CHEST: leather_chestplate -> iron_chestplate
[auto-upgrade] FEET: nothing -> golden_boots
upgrades -> no upgrades pending
autoupgrade off -> OK auto-upgrade OFF
openpack exists because a worn backpack's screen is opened by a keybind, not a widget. M1 finds
the backpack key mapping and triggers it in isolation (temporarily rebinding it to a scratch
key) so a shared physical key -- e.g. a minimap and the backpack both bound to B -- does not
co-fire. Reply: OK triggered key.travelersbackpack.inventory in isolation -- poll 'describe'.
Utility
| Command |
What it does |
screenshot [name] (shot) |
Save a PNG of the current frame via the game's own writer. |
help |
Print the command list. |
quit / exit |
Close this connection (does not stop the client). |
screenshot scene1 -> OK screenshot scene1.png (148213 bytes) path=<gameDir>/screenshots/scene1.png
6. Slot numbering
There are two numbering schemes and mixing them up is the most common slot bug.
inv indices are STABLE -- they never change, no matter what screen is open. Use them for
hold / equip and for knowing what you carry:
0-8 hotbar, left to right (hotbar slot N in-game = inv index N-1)
9-35 main storage (9-17 top row, 18-26 middle, 27-35 bottom)
36 boots | 37 leggings | 38 chestplate | 39 helmet | 40 off-hand
slots indices RENUMBER for every open container -- always run slots to read them live,
never assume. Your own storage is re-indexed and appended after the container's own slots:
Inventory open (openinv, 2x2): 0 result | 1-4 the 2x2 grid | 5 helmet 6 chest 7 legs 8 boots
| 9-35 main | 36-44 hotbar | 45 off-hand
Crafting table open (3x3): 0 result | 1-9 the 3x3 grid | 10-36 main | 37-45 hotbar
Any other container: container slots first (0..N-1), then main (27), then hotbar (9)
slot <id> ... clicks by the open menu's index (from slots), not the inv index. The
craft grids exist only while a screen is open, so they appear in slots, never in inv.
7. Operating notes & safety
- Client-only. M1 never runs server-side logic.
cmd is just sending a normal client-to-server
command, exactly like a player typing /time.
- Never cold-kill a loaded world. To leave a world,
pause then click "Save and Quit to
Title" -- that saves first.
- Asynchronous commands (
move*, goto, mine, craft) return immediately; poll
where / inv / look. stop aborts movement and mining.
- Coverage ceiling, honestly: M1 enumerates well-structured, widget/container-based GUIs.
Mods that hand-draw their UI in immediate mode (paint a texture, hit-test a hardcoded rectangle)
have no widget object to list -- the visible window is the instrument for spotting those gaps.
Repo & building
Source, setup steps, and full build instructions live on the
minecraft-1.20-26.3 build & setup branch
(mod + bridge setup, toolchain per loader, the version-coverage matrix, and how the code generation
works). Internal tooling; all rights reserved (ARR).
评论 0
登录后参与评分
还没有评论,来抢沙发吧