Material condition

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

AboveSurface

AboveSurface

True above the preliminary surface: the rough terrain height worked out from the noise before caves are carved. Vanilla wraps its whole surface layer in it so cave floors deep underground don't get grass.

AboveSurface()
SurfaceRule top = If(AboveSurface() && StoneDepth(Floor)) { Block(grass_block) }

AboveWater

AboveWater

True for blocks at or above the water surface over them, shifted by offset, and also where there is no water above at all. Vanilla uses it so grass doesn't grow under lakes and oceans.

AboveWater(offset?, surface_depth_multiplier?, add_stone_depth?)
offsetdefault 0
int

Blocks added to the water height before comparing. -1 also passes one block below the water.

surface_depth_multiplierdefault 0
int -20..20

Multiplies the surface depth noise and adds it to the water height, for an uneven shoreline. From -20 to 20.

add_stone_depthdefault false
bool

Adds the block's depth below the surface to its Y before comparing.

SurfaceRule dry_grass = If(AboveWater()) { Block(grass_block) }

Biome

Biome

True when the block's biome is one of these. Takes any number of biomes.

Biome(biome_is)
biome_is
biome id | #biome tag | list of biome ids

The biomes, by id.

SurfaceRule desert_sand = If(Biome(desert, beach)) { Block(sand) }

Hole

Hole

True where the surface depth noise is zero or less: spots where the surface layer is missing. Vanilla badlands leave these as plain terracotta.

Hole()
SurfaceRule bands = If(!Hole()) { Block(orange_terracotta) }

NoiseThreshold

NoiseThreshold

True where a noise, sampled at the block's x and z, lies between min_threshold and max_threshold. Use it for patches such as coarse dirt in savannas.

NoiseThreshold(noise, min_threshold, max_threshold, is_3d?)
noise
noise id

The noise to sample, by id (a Noise declaration or a vanilla one such as surface).

min_threshold
number

Lowest noise value that passes. Written as .Min(x).

max_threshold
number

Highest noise value that passes. Written as .Max(x).

is_3doptional
bool

Defaults to false.

SurfaceRule patches = If(NoiseThreshold(surface).Min(0.2).Max(1)) { Block(coarse_dirt) }

Not

Not

True when invert is false. Usually written with !, as in !Hole().

Not(invert)
invert
MaterialConditionRef

The condition to invert.

Steep

Steep

True on steep slopes, where the terrain height jumps by four or more blocks between neighbouring columns. Vanilla puts stone on steep mountainsides with it.

Steep()
SurfaceRule cliffs = If(Steep()) { Block(stone) }

StoneDepth

StoneDepth

True for blocks close to a surface: just under the ground's top (Floor) or just above a cave roof's underside (Ceiling). Vanilla puts grass on the first block and dirt a few blocks deeper with it.

StoneDepth(surface_type, offset?, add_surface_depth?, secondary_depth_range?)
surface_type
CaveSurface

Which surface depth is counted from: floor counts down from the top of the ground, ceiling counts up from the underside of an overhang or cave roof.

offsetdefault 0
int

Extra depth that still passes. With 0 only the surface block itself passes; with 2 the top three blocks do.

add_surface_depthdefault false
bool

Adds the surface depth to offset: a noise of a few blocks that varies across the world, so the layer has an uneven bottom like vanilla dirt.

secondary_depth_rangedefault 0
int

Adds a second noise, from 0 up to this many blocks, to the depth. Vanilla uses it for patchy layers such as badlands terracotta.

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

Temperature

Temperature

True where the biome is cold enough at this height for snow to fall.

Temperature()
SurfaceRule snowy = If(Temperature()) { Block(snow_block) }

VerticalGradient

VerticalGradient

True at and below true_at_and_below, false at and above false_at_and_above, and true at random in between, less often the higher the block. Vanilla makes the bedrock floor and the deepslate transition with it.

VerticalGradient(random_name, true_at_and_below, false_at_and_above)
random_name
string

Seeds the randomness. Give each gradient its own name, such as "bedrock_floor", so they don't line up.

true_at_and_below
VerticalAnchor

The height where the condition is always true, and below.

false_at_and_above
VerticalAnchor

The height where the condition is always false, and above.

SurfaceRule bedrock = If(VerticalGradient("bedrock_floor", AboveBottom(0), AboveBottom(5))) { Block(bedrock) }

YAbove

YAbove

True for blocks at or above a height. The height can shift with the surface depth noise for an uneven edge.

YAbove(anchor, surface_depth_multiplier?, add_stone_depth?)
anchor
VerticalAnchor

The height, as a number (absolute Y) or an anchor such as AboveBottom(5).

surface_depth_multiplierdefault 0
int -20..20

Multiplies the surface depth noise and adds it to the height. From -20 to 20. Written as .Mul(x).

add_stone_depthdefault false
bool

Adds the block's depth below the surface to its Y before comparing. Written as .Add().

SurfaceRule peaks = If(YAbove(200)) { Block(snow_block) }