/agent 命令

/agent 命令

来源:Commands/agent,英文修订 ID:3889467。

此命令仅适用于基岩版与 Minecraft Education。Minecraft Education 的权限等级要求为 0,基岩版为 1。

/agent 用于控制智能体。智能体控制命令仅允许由玩家所连接的 WebSocket 一侧执行;玩家不能直接在游戏内执行,除非使用 NPC。agent 命令可通过 NPC 运行。

如果玩家通过 NPC 召唤智能体,要从世界中移除它,只能使用 NBT 编辑器删除该智能体的 actorprefix 项、执行 /kill,或通过附加包调用它的 .remove() 方法。

语法

所有子命令均以 agent 开头:

子命令 功能
agent move <direction> 向指定方向移动智能体
agent turn <turnDirection> 向指定方向旋转智能体 90 度
agent attack <direction> 令智能体向指定方向攻击
agent destroy <direction> 令智能体破坏指定方向的方块或物品
agent drop <int:slotNum> <int:quantity> <direction> 将指定槽位中指定数量的物品朝指定方向丢出
agent dropall <direction> 将所有槽位中的物品丢到指定方向一格外的地面上
agent inspect <direction> 返回指定方向方块的名称
agent inspectdata <direction> 返回指定方向方块的数据值
agent detect <direction> 检测指定方向是否存在可碰撞方块
agent detectredstone <direction> 检测指定方向的红石信号
agent transfer <int:srcSlotNum> <int:quantity> <int:dstSlotNum> 将智能体物品栏中指定数量的物品从一个槽位转移到另一个槽位
agent create 在当前玩家位置创建智能体
agent tp <coordinates> 将智能体传送到指定位置
agent collect <string:item> 收集以智能体为中心、三维空间中一格范围内的所有物品
agent till <direction> 令智能体耕锄指定方向的草方块
agent place <int:slotNum> <direction> 令智能体向指定方向放置方块
agent setitem <int:slotNum> <int:quantity> <int:amount> <int:data> 原文标记为需要补充信息
agent getitemcount <int:slotNum> 返回指定槽位中的物品数量,即用完前可使用的数量
agent getitemspace <int:slotNum> 返回指定槽位中的剩余容量,即装满前还可加入的物品数量
agent getitemdetail <int:slotNum> 返回指定槽位中物品的名称
agent getposition 取得智能体在世界中的位置

参数

<direction> 为 forward、back、left、right、up、down 之一。

<turnDirection> 为 left 或 right。

另见


本文为 Minecraft Wiki 对应英文条目的中文翻译与改编,已按要求省略变更历史。原作者与贡献者见来源页及其历史;除另有说明外,按 CC BY-NC-SA 3.0 非商业、署名、相同方式共享。