Class GameTest
-
- All Implemented Interfaces:
public final class GameTest
Represents a running game test. A game test is a special blocked-off area in the world that allows you to test blocks, items, entities, and other game mechanics in a controlled environment. It contains a success condition that looks at the world and determines when the test has succeeded.
Will succeed by default.
-
-
Field Summary
Fields Modifier and Type Field Description private final GameTestConfig
config
private final World
world
private final BlockPosition
center
private final BoundingBox
boundingBox
-
Constructor Summary
Constructors Constructor Description GameTest(GameTestConfig config, World world, BlockPosition center, BoundingBox boundingBox)
-
Method Summary
Modifier and Type Method Description final GameTestConfig
getConfig()
final World
getWorld()
final BlockPosition
getCenter()
final BoundingBox
getBoundingBox()
final Unit
succeed()
final Unit
succeedWhen(Function0<Boolean> condition)
final Unit
fail(String message, Throwable cause)
final Unit
fail(String message)
final Boolean
entityInBounds(Function1<Entity, Boolean> predicate)
final Unit
withDelay(Integer ticks, Runnable block)
final BlockPosition
position()
Returns the center position of the game test final BlockPosition
position(BlockPosition offset)
Returns a position relative to the center of the game test final BlockPosition
position(Integer x, Integer y, Integer z)
Returns a position relative to the center of the game test final Location
location()
Returns the center location of the game test final Location
location(Location location)
Returns a location relative to the center of the game test final Location
location(Double x, Double y, Double z)
Returns a location relative to the center of the game test -
-
Constructor Detail
-
GameTest
GameTest(GameTestConfig config, World world, BlockPosition center, BoundingBox boundingBox)
-
-
Method Detail
-
getConfig
final GameTestConfig getConfig()
-
getCenter
final BlockPosition getCenter()
-
getBoundingBox
final BoundingBox getBoundingBox()
-
succeedWhen
final Unit succeedWhen(Function0<Boolean> condition)
-
fail
@JvmOverloads() final Unit fail(String message, Throwable cause)
-
fail
@JvmOverloads() final Unit fail(String message)
-
entityInBounds
final Boolean entityInBounds(Function1<Entity, Boolean> predicate)
-
position
final BlockPosition position()
Returns the center position of the game test
-
position
final BlockPosition position(BlockPosition offset)
Returns a position relative to the center of the game test
-
position
final BlockPosition position(Integer x, Integer y, Integer z)
Returns a position relative to the center of the game test
-
location
final Location location(Location location)
Returns a location relative to the center of the game test
-
-
-
-