BlockInWorldPredicate

@ApiStatus.NonExtendable
fun interface BlockInWorldPredicate

A predicate that tests whether a block in the world matches certain conditions.

Implementations of this interface are used as the result type for block predicate arguments. The predicate can optionally load the chunk containing the block before testing.

Example usage in a command:

blockInWorldPredicate("filter") {
executes { context ->
val predicate = context.getArgument("filter", BlockInWorldPredicate::class.java)
val block = player.location.block
val result = predicate.testBlock(block)
if (result.asBoolean()) player.sendMessage("Block matches!")
1
}
}

Types

Link copied to clipboard

The predicate result is yielded by the BlockInWorldPredicate when applied to a block.

Functions

Link copied to clipboard
open fun testBlock(block: Block): BlockInWorldPredicate.Result

Checks if the passed block matches the block predicate, loading the chunk if necessary.

abstract fun testBlock(block: Block, loadChunk: Boolean): BlockInWorldPredicate.Result

Checks if the passed block matches the block predicate.