GameTest

class GameTest(val config: GameTestConfig, val world: World, val center: BlockPosition, val boundingBox: BoundingBox)(source)

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.

This represents a running test in the world.

Default behaviour is to simply succeed.

See also

Constructors

Link copied to clipboard
constructor(config: GameTestConfig, world: World, center: BlockPosition, boundingBox: BoundingBox)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
inline fun entityInBounds(predicate: (Entity) -> Boolean): Boolean

Checks whether any entity in the gametest matches predicate

Link copied to clipboard
fun fail(message: String, cause: Throwable? = null)
Link copied to clipboard

Returns the center location of the game test

fun location(location: Location): Location

Returns a location relative to the center of the game test

Link copied to clipboard

Returns the center position of the game test

fun position(x: Int, y: Int, z: Int): BlockPosition

Returns a position relative to the center of the game test

Link copied to clipboard
fun succeed()
Link copied to clipboard
fun succeedWhen(condition: () -> Boolean)

Set the condition under which the test will succeed. Will be checked periodically.

Link copied to clipboard
fun withDelay(ticks: Int, runnable: Runnable)

Runs runnable on the main thread after waiting for the specified number of ticks