/clone 命令

/clone 命令

来源:Commands/clone,英文修订 ID:3887457。

把一个区域内的方块复制到另一个区域。Java 版所需权限等级为 2;基岩版为 1,需要启用作弊。

语法

Java 版

主语法树:

clone . . .
clone from <sourceDimension> . . .
  ... <begin> <end> . . .
    ... <destination> . . .
    ... to <targetDimension> <destination> . . .
      ... [strict] [replace] [force|move|normal]
      ... [strict] masked [force|move|normal]
      ... [strict] filtered <filter> [force|move|normal]

replace 复制所有方块;masked 仅复制非空气方块;filtered <filter> 仅复制与 <filter> 指定方块匹配的方块。

简化树:

clone <begin> <end> . . .
clone from <sourceDimension> <begin> <end> . . .
  ... <destination> . . .
  ... to <targetDimension> <destination> . . .
    ... [strict] [replace|masked] [force|move|normal]
    ... [strict] filtered <filter> [force|move|normal]

原文列出的完整展开形式如下。这份展开表未加入主语法树已有的 strict,按来源保留:

clone <begin> <end> <destination>
clone from <sourceDimension> <begin> <end> <destination>
clone <begin> <end> <destination> replace [force|move|normal]
clone from <sourceDimension> <begin> <end> <destination> replace [force|move|normal]
clone <begin> <end> <destination> masked [force|move|normal]
clone from <sourceDimension> <begin> <end> <destination> masked [force|move|normal]
clone <begin> <end> <destination> filtered <filter> [force|move|normal]
clone from <sourceDimension> <begin> <end> <destination> filtered <filter> [force|move|normal]
clone <begin> <end> to <targetDimension> <destination>
clone from <sourceDimension> <begin> <end> to <targetDimension> <destination>
clone <begin> <end> to <targetDimension> <destination> replace [force|move|normal]
clone from <sourceDimension> <begin> <end> to <targetDimension> <destination> replace [force|move|normal]
clone <begin> <end> to <targetDimension> <destination> masked [force|move|normal]
clone from <sourceDimension> <begin> <end> to <targetDimension> <destination> masked [force|move|normal]
clone <begin> <end> to <targetDimension> <destination> filtered <filter> [force|move|normal]
clone from <sourceDimension> <begin> <end> to <targetDimension> <destination> filtered <filter> [force|move|normal]

基岩版

复制所有方块或仅复制非空气方块:

clone <begin: x y z> <end: x y z> <destination: x y z> [maskMode: MaskMode] [cloneMode: CloneMode]

仅复制与 <tileName: Block> 指定方块 ID 匹配的方块:

clone <begin: x y z> <end: x y z> <destination: x y z> filtered <cloneMode: CloneMode> <tileName: Block> [blockStates: block states]

参数

<sourceDimension>: dimension(仅 Java 版):复制的来源维度,默认为当前命令执行维度。必须为已有维度的资源位置。

<begin>: block_pos、<end>: block_pos/基岩版 begin: x y z、end: x y z(CommandPosition):源区域两个相对顶角方块的坐标。坐标由三个整数,或波浪号/插入符坐标组成。方块位置表示方块西北下角点的坐标,因此各轴较小坐标在区域边界上,而较大坐标距离另一侧边界一格。源区域体积为 (xmax-xmin+1)*(ymax-ymin+1)*(zmax-zmin+1)。例如 0 0 0 0 0 0 包含 1 格;0 0 0 1 1 1 与 1 1 1 0 0 0 指定同一片含 8 格的区域。

<targetDimension>: dimension(仅 Java 版):目标维度,默认为当前命令执行维度。必须为已有维度的资源位置。

<destination>: block_pos/destination: x y z(CommandPosition):目标区域西北下角的坐标,坐标格式同上。

Java 版 replace、masked/基岩版 maskMode: MaskMode:是否过滤被复制的方块,必须为下列值之一,默认 replace。

  • replace:复制所有方块,用源区域的方块覆盖目标区域的所有方块。
  • masked:只复制非空气方块;目标区域中原本会被空气覆盖的方块保持不变。

strict(仅 Java 版):原样放置方块,不触发方块更新与形状更新。

Java 版 force|move|normal/基岩版 cloneMode: CloneMode:如何处理源区域,必须为下列值之一,默认 normal。

  • force:即使源区域和目标区域重叠,也强制复制。
  • move:把源区域复制到目标区域后,用空气替换源区域。在 filtered 模式下,只把实际复制的方块替换为空气。
  • normal:不移动,也不强制复制。

<filter>: block_predicate/tileName: Block:filtered 模式下要复制的方块 ID。Java 版可为方块 ID 或 # 开头的方块标签,并可附带方块状态及 NBT 筛选;基岩版必须为有效方块 ID。

blockStates: block states(基岩版,BlockStateCommandParam):方块状态,以方括号内的键值对表示,例如 ["stone_type"="granite"];空列表为 []。

结果

情况 Java 版 基岩版
命令不完整或参数指定错误 无法解析 无法解析
任一区域未加载或位于世界之外 失败 失败
源区域体积大于 commandModificationBlockLimit 游戏规则的值 失败 不适用
源区域体积大于 655360 不适用 失败
normal 模式下源区域与目标区域重叠 失败 失败
replace move 模式下源区域与目标区域重叠 成功 成功
filtered 模式下源区域没有指定方块 失败 失败
replace 模式下源区域全为屏障 失败,见 MC-231566 不适用
masked 模式下源区域没有非空气且非屏障的方块 失败,见 MC-231566 不适用
filtered 模式下指定方块为屏障 失败,见 MC-231566 不适用
masked 模式下源区域没有非空气方块 不适用 失败
其他情况 成功 成功

来源在此仍使用旧游戏规则名 commandModificationBlockLimit;较新版本已将其改名为 max_block_modifications。

输出

Java 版失败时成功次数、success、result 均为 0;成功时成功次数与 success 为 1,result 为成功复制的方块数量。基岩版失败时成功次数为 0,成功时为 1。

另见

  • /fill:用一种方块填充区域。

参考资料

  • MC-231566:与复制屏障方块相关的问题。

外部链接


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