
命令
/test
创建、查找、运行、重置和清除游戏测试,即开发者和数据包制作者使用的自动测试结构。
| /test clearall [<radius>] |
| /test (clearthat|clearthese|resetclosest|resetthat|resetthese|stop) |
| /test create <id> [<width> [<height> <depth>]] |
| /test (locate <tests>|verify <tests>) |
| /test pos [<var>] |
| /test run <tests> [<numberOfTimes> [<untilFailed> [<rotationSteps> [<testsPerRow>]]]] |
| /test (runclosest|runthat|runthese) [<numberOfTimes> [<untilFailed>]] |
| /test runfailed |
| /test runfailed <numberOfTimes> [<untilFailed> [<rotationSteps> [<testsPerRow>]]] |
| /test runfailed <onlyRequiredTests> [<numberOfTimes> [<untilFailed> [<rotationSteps> [<testsPerRow>]]]] |
| /test runmultiple <tests> [<amount>] |
| 参数 | 值的类型 | 输入内容 |
|---|---|---|
| <radius> | 整数 | 对于 clearall,搜索测试的距离(格)。默认250;取值范围限定为0至1024。 |
| <id> | ID | 对于 create,新测试的 ID,例如 mypack:door_test。 |
| <width> | 整数 | 对于 create,测试沿 X 轴的大小(格)。省略height和depth时,三条边都使用该值。最大值为48。 |
| <height> | 整数 | 对于 create,测试沿 Y 轴的大小(格)。最大值为48。 |
| <depth> | 整数 | 对于 create,测试沿 Z 轴的大小(格)。最大值为48。 |
| <tests> | ID模式 | 使用哪些测试:测试 id(如 minecraft:always_pass),或带 *(任意文本)和 ? 的模式(任意一个字符),例如minecraft:*。不带命名空间时,默认为 minecraft。至少有一个测试必须匹配。某个测试实例的ID。 |
| <var> | 文本 | 对于pos,复制到剪贴板的那一行中使用的变量名。单个单词。默认:pos。一个不含空格的词。 |
| <numberOfTimes> | 整数 | 每个测试运行多少次。最小值为0;0表示无限重复。至少为0。 |
| <untilFailed> | 真或假 | true或false。为 true 时,重复的测试一旦失败就停止重复。 |
| <rotationSteps> | 整数 | 运行前将测试结构旋转多少个四分之一圈。 |
| <testsPerRow> | 整数 | 每行放置多少个测试结构。默认:8。 |
| <onlyRequiredTests> | 真或假 | true或false。为 true 时,runfailed 只运行被标记为必需的失败测试。 |
| <amount> | 整数 | 对于runmultiple:每个选定测试运行多少次。 |
| 权限等级 | 2:管理员、开启作弊的世界、命令方块和函数 |
| 适用于 | 服务器管理员、在启用了作弊的单人或局域网世界中的玩家、服务器控制台、命令方块和函数。/test pos必须由玩家执行。 |
| 结果 | run命令会显示“正在运行N个测试……”,结束时显示通过和失败测试的汇总,测试开始后返回1(如果没有找到测试,则返回0并显示“没有需要运行的测试”)。 locate、reset命令和clear命令返回找到、重置或清除的测试结构数量。create、pos和stop返回1。 |
| run | /test run <tests> [numberOfTimes] [untilFailed] [rotationSteps] [testsPerRow]会在你附近放置所选测试并运行。默认情况下每个测试运行一次,测试按每行8个排列。 |
| runmultiple | /test runmultiple <tests> [amount]会运行所选测试,每个测试有amount份副本。 |
| runclosest, runthese, runthat | 运行已存在于世界中的测试:runclosest运行15个方块范围内最近的测试,runthese运行250个方块范围内的所有测试,runthat运行你正在看着的测试。每个都接受[numberOfTimes] [untilFailed]。 |
| runfailed | /test runfailed [onlyRequiredTests] [numberOfTimes] [untilFailed] [rotationSteps] [testsPerRow]会重新运行上次运行中失败的测试。onlyRequiredTests 设为 true 时,会跳过可选测试。 |
| verify | /test verify <tests>会在4个旋转方向中分别将每个所选测试运行100次,并在首次失败时停止。 |
| locate | /test locate <tests>会在每个维度中搜索250个方块范围内所选测试的测试方块,并列出它们的位置和距离。如果没有任何一个,则会失败并提示“未找到测试实例”。 |
| resetclosest, resetthese, resetthat | 将测试结构恢复到初始状态:15格方块内最近的测试、250格方块内的所有测试,或你正在看的测试。 |
| clearthat, clearthese, clearall | 移除测试结构及其测试方块:你正在看的测试、250格方块内的所有测试,或用/test clearall [radius]移除半径内的所有测试。半径默认为250,范围限制为0到1024。 |
| create | /test create <id> [width] [height depth]会在你附近创建一个地面为基岩的空测试。默认大小为5×5×5。只给出宽度时,会生成该大小的立方体。如果任意一边大于48格,则失败。 |
| pos | /test pos [var]会显示你正在看的方块(最远10个方块)相对于包含它的测试的位置。点击结果会将其复制为使用指定变量名的一行代码,默认为pos。 |
| stop | /test stop会停止所有正在运行的测试。开始新的运行、重置或清除也会停止正在运行的测试。 |
| 可用的测试 | 基础游戏附带一个测试:minecraft:always_pass。其他测试来自数据包。 |
/test run minecraft:always_pass在你附近放置测试minecraft:always_pass并运行一次。
/test runthese运行250个方块范围内的所有测试结构。
/test clearall移除250格方块内的所有测试结构。



