实验性
实验性
Name of the batch for the test.
RegistrationBuilder object where additional configuration methods can be called.
Sets the batch for the test to run in.
无法在只读模式下调用此函数,详见 WorldBeforeEvents。
This function can be called in early-execution mode.
实验性
RegistrationBuilder object where additional configuration methods can be called.
Sets the maximum number of times a test will try to rerun if it fails.
无法在只读模式下调用此函数,详见 WorldBeforeEvents。
This function can be called in early-execution mode.
实验性
RegistrationBuilder object where additional configuration methods can be called.
Sets the maximum number of ticks a test will run for before timing out and failing.
无法在只读模式下调用此函数,详见 WorldBeforeEvents。
This function can be called in early-execution mode.
实验性
Size, in blocks, around the GameTest where additional GameTests should not be created.
RegistrationBuilder object where additional configuration methods can be called.
Size around the GameTest, in blocks, that should be reserved for the test when running multiple tests together.
无法在只读模式下调用此函数,详见 WorldBeforeEvents。
This function can be called in early-execution mode.
实验性
If set to true, the test must pass in order for the entire run of tests to pass.
RegistrationBuilder object where additional configuration methods can be called.
Whether this test is required to pass as part of its broader set of tests.
无法在只读模式下调用此函数,详见 WorldBeforeEvents。
This function can be called in early-execution mode.
实验性
RegistrationBuilder object where additional configuration methods can be called.
Sets the number of successful test runs to be considered successful.
无法在只读模式下调用此函数,详见 WorldBeforeEvents。
This function can be called in early-execution mode.
实验性
If true, runs the test in all four rotations when run via /gametest runset.
无法在只读模式下调用此函数,详见 WorldBeforeEvents。
This function can be called in early-execution mode.
实验性
RegistrationBuilder object where additional configuration methods can be called.
Sets the number of ticks for a test to wait before executing when the structure is spawned.
无法在只读模式下调用此函数,详见 WorldBeforeEvents。
This function can be called in early-execution mode.
实验性
RegistrationBuilder object where additional configuration methods can be called.
Overrides the default structure placement with a specific location. If height (y) is set to Dimension.heightRange.max, the structure will snap to the ground.
无法在只读模式下调用此函数,详见 WorldBeforeEvents。
This function can be called in early-execution mode.
实验性
RegistrationBuilder object where additional configuration methods can be called.
Sets the name of the structure for a test to use. "xyz:bar"
will load /structures/xyz/bar.mcstructure
from the
behavior pack stack.
无法在只读模式下调用此函数,详见 WorldBeforeEvents。
This function can be called in early-execution mode.
import { Test, register } from "@minecraft/server-gametest";
import { MinecraftEntityTypes } from "@minecraft/vanilla-data";
function phantomsShouldFlyFromCats(test: Test) {
test.spawn(MinecraftEntityTypes.Cat, { x: 4, y: 3, z: 3 });
test.spawn(MinecraftEntityTypes.Phantom, { x: 4, y: 3, z: 3 });
test.succeedWhenEntityPresent(MinecraftEntityTypes.Phantom, { x: 4, y: 6, z: 3 }, true);
}
register("MobBehaviorTests", "phantoms_should_fly_from_cats", phantomsShouldFlyFromCats)
.structureName("gametests:glass_cells");
实验性
RegistrationBuilder object where additional configuration methods can be called.
Adds a tag to a test. You can run all tests with a given tag
with /gametest runset <tag>
.
无法在只读模式下调用此函数,详见 WorldBeforeEvents。
This function can be called in early-execution mode.
import { Test, register } from "@minecraft/server-gametest";
import { MinecraftEntityTypes } from "@minecraft/vanilla-data";
function phantomsShouldFlyFromCats(test: Test) {
test.spawn(MinecraftEntityTypes.Cat, { x: 4, y: 3, z: 3 });
test.spawn(MinecraftEntityTypes.Phantom, { x: 4, y: 3, z: 3 });
test.succeedWhenEntityPresent(MinecraftEntityTypes.Phantom, { x: 4, y: 6, z: 3 }, true);
}
register("MobBehaviorTests", "phantoms_should_fly_from_cats", phantomsShouldFlyFromCats)
.structureName("gametests:glass_cells");
A utility class to set GameTest parameters for a test. Methods can be chained together to set multiple properties.