Rule test

Helpers that build a minecraft:rule_test object, one for each of its types. Where a field takes one, write the helper's call; its name is the type it makes. Click a type to see what it accepts.

AllOf

AllOf
AllOf(rules)
rules
list of RuleTest

AlwaysTrue

AlwaysTrue

Always passes.

AlwaysTrue()

AnyOf

AnyOf
AnyOf(rules)
rules
list of RuleTest

BlockMatch

BlockMatch

Passes when the block is this block.

BlockMatch(block)
block
block id

BlockstateMatch

BlockstateMatch

Passes when the block is exactly this block state.

BlockstateMatch(block_state)
block_state
BlockState

HeightMatch

HeightMatch
HeightMatch(min_inclusive, max_inclusive)
min_inclusive
int
max_inclusive
int

Not

Not
Not(rule)
rule
RuleTest

RandomBlockMatch

RandomBlockMatch

Passes when the block is this block, with probability probability.

RandomBlockMatch(block, probability)
block
block id
probability
number 0..1

RandomBlockstateMatch

RandomBlockstateMatch

Passes when the block is exactly this block state, with probability probability.

RandomBlockstateMatch(block_state, probability)
block_state
BlockState
probability
number 0..1

TagMatch

TagMatch

Passes when the block is in this block tag. Vanilla ores test #stone_ore_replaceables this way.

TagMatch(tag)
tag
block id | #block tag