Placement modifier

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

Biome

Biome

Drops positions whose biome doesn't list this feature. Vanilla ends most placements with it.

Biome()

BlockPredicateFilter

BlockPredicateFilter

Keeps positions where a block predicate passes, such as Solid() or MatchingBlocks(air).

BlockPredicateFilter(predicate)
predicate
BlockPredicate

Count

Count

Repeats each position count times. Follow it with InSquare() to spread the copies over the chunk.

Count(count)
count
IntProvider of int 0..4096

How many: a number, or a range such as 2..5.

PlacedFeature trees { feature = minecraft:oak, placement = [Count(3), InSquare(), Heightmap(WORLD_SURFACE_WG), Biome()] }

CountOnEveryLayer

CountOnEveryLayer

Places count positions on each layer of the terrain, from the top down, so features appear under overhangs too. Vanilla nether forests use it.

CountOnEveryLayer(count)
count
IntProvider of int 0..256

Cuboid

Cuboid
Cuboid(xz_size, y_size, include_interior?, include_edges?)
xz_size
IntProvider of int 1..16
y_size
IntProvider of int 1..16
include_interioroptional
bool

Defaults to true.

include_edgesoptional
bool

Defaults to true.

EnvironmentScan

EnvironmentScan

Moves each position up or down, at most max_steps blocks, until target_condition passes. Drops it if nothing is found.

EnvironmentScan(direction_of_search, max_steps, target_condition, allowed_search_condition?)
direction_of_search
VerticalDirection

up or down.

max_steps
int 1..32

How far to search, in blocks.

target_condition
BlockPredicate

The block predicate to search for.

allowed_search_conditionoptional
BlockPredicate

The scan stops if a block on the way fails this.

FixedPlacement

FixedPlacement

Replaces each position with a fixed list of positions.

FixedPlacement(positions)
positions
list of (list of int (exactly 3))

Fixed list of block positions to place the feature at.

HeightRange

HeightRange

Sets each position's Y to a height picked by a height provider.

HeightRange(height)
height
HeightProvider

The height, such as Uniform(AboveBottom(0), Absolute(64)).

Heightmap

Heightmap

Moves each position up or down onto the surface of a heightmap, such as WORLD_SURFACE_WG for the top block or OCEAN_FLOOR_WG for the sea floor.

Heightmap(heightmap)
heightmap
HeightmapType

Which surface to use.

InSquare

InSquare

Moves each position to a random x and z within its chunk.

InSquare()

NoiseBasedCount

NoiseBasedCount

Repeats each position a number of times that follows a noise, so features cluster in some areas. The count is ceil((noise + noise_offset) * noise_to_count_ratio).

NoiseBasedCount(noise_to_count_ratio, noise_factor, noise_offset?)
noise_to_count_ratio
int

Multiplies the noise to get the count.

noise_factor
number

Divides x and z before sampling; larger values give larger clusters.

noise_offsetoptional
number

NoiseThresholdCount

NoiseThresholdCount

Repeats each position below_noise times where a noise is below noise_level, and above_noise times where it is above.

NoiseThresholdCount(noise_level, below_noise, above_noise)
noise_level
number
below_noise
int
above_noise
int

Offset

Offset

Moves each position by the given number of blocks.

Offset(x, y, z)
x
IntProvider of int -16..16
y
IntProvider of int -16..16
z
IntProvider of int -16..16

RandomChance

RandomChance

Keeps each position with probability chance, from 0 to 1.

RandomChance(chance)
chance
number 0..1

RandomlySelected

RandomlySelected
RandomlySelected(placements)
placements
list of PlacementModifier (at least 1)

RarityFilter

RarityFilter

Keeps each position with a chance of 1 in chance.

RarityFilter(chance)
chance
int 0..

Keep one position in this many, on average.

PlacedFeature rare_rocks { feature = minecraft:forest_rock, placement = [RarityFilter(16), InSquare(), Heightmap(MOTION_BLOCKING), Biome()] }

SurfaceRelativeThresholdFilter

SurfaceRelativeThresholdFilter

Keeps positions whose Y, measured from a heightmap's surface, is from min_inclusive to max_inclusive.

SurfaceRelativeThresholdFilter(heightmap, min_inclusive?, max_inclusive?)
heightmap
HeightmapType
min_inclusiveoptional
int
max_inclusiveoptional
int

SurfaceWaterDepthFilter

SurfaceWaterDepthFilter

Keeps positions where the water above the surface is at most max_water_depth blocks deep.

SurfaceWaterDepthFilter(max_water_depth)
max_water_depth
int