Material rule

Helpers that build a minecraft:material_rule 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.

Bandlands

Bandlands

Places the striped terracotta of badlands, with the colour picked by height.

Bandlands()
SurfaceRule stripes = If(YAbove(63)) { Bandlands() }

Block

Block

Places one block. Writing just a block id where a rule is expected does the same thing.

Block(result_state)
result_state
BlockState

The block, with optional state such as oak_log[axis = y].

SurfaceRule floor = Block(stone)

Condition

Condition

Runs then_run only where if_true passes. Usually written If(condition) { rules }.

Condition(if_true, then_run)
if_true
MaterialConditionRef

The condition to test.

then_run
MaterialRuleRef

The rule to run when it passes.

SurfaceRule grass = If(StoneDepth(Floor)) { Block(grass_block) }

OreVein

OreVein
OreVein(ore_block, raw_ore_block, filler_block, raw_ore_chance, density, richness, filler_gap)
ore_block
BlockState
raw_ore_block
BlockState
filler_block
BlockState
raw_ore_chance
number 0..1
density
DensityFunctionRef
richness
DensityFunctionRef
filler_gap
DensityFunctionRef

Sequence

Sequence

Tries each rule in order and stops at the first one that places a block. A list [a, b], or several rules in an If { } body, makes the same thing.

Sequence(sequence)
sequence
list of MaterialRuleRef

The rules, in order.

SurfaceRule top = [
  If(StoneDepth(Floor)) { Block(grass_block) },
  Block(dirt),
]