Skip to content

World - Features Module

anvil.api.features.features

AggregateFeature

Bases: Feature

Places a collection of features in an arbitrary order. All features in the collection use the same input position. Features should not depend on each other, as there is no guarantee in which order the features will be placed. - Succeeds if At least one feature is placed successfully. - Fails if All features fail to be placed.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name)

Places a collection of features in an arbitrary order.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
Documentation reference

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

early_out(early_out)

Do not continue placing features once either the first success or first failure has occurred.

features(feature_list)

Sets the collection of features to be placed one by one.

No guarantee of order. All features use the same input position.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

CaveCarverFeature

Bases: Feature

Carves caves through the world during pregeneration.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, fill_with=None, width_modifier=None, skip_carve_chance=None, height_limit=None, y_scale=None, horizontal_radius_multiplier=None, vertical_radius_multiplier=None, floor_level=None)

Carves caves through the world during pregeneration.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
fill_with MinecraftBlockDescriptor | Identifier | None

Reference to the block to fill the cave with.

None
width_modifier Molang | float | int | None

How many blocks to increase the cave radius by, from the center point of the cave.

None
skip_carve_chance int | None

The chance to skip doing the carve (1 / value).

None
height_limit int | None

The height limit where we attempt to carve.

None
y_scale int | float | tuple[int | float, int | float] | list[int | float] | Mapping[str, int | float] | None

The scaling in y.

None
horizontal_radius_multiplier int | float | tuple[int | float, int | float] | list[int | float] | Mapping[str, int | float] | None

Horizontal radius multiplier.

None
vertical_radius_multiplier int | float | tuple[int | float, int | float] | list[int | float] | Mapping[str, int | float] | None

Vertical radius multiplier.

None
floor_level int | float | tuple[int | float, int | float] | list[int | float] | Mapping[str, int | float] | None

Floor Level.

None
Documentation reference

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

Feature

Bases: AddonObject

Base class for Bedrock worldgen feature definitions.

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name)

Initializes the base feature definition content.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

FossilFeature

Bases: Feature

Generates a fossil structure with a configurable ore block.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, ore_block, max_empty_corners)

Generates a fossil structure with a configurable ore block.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
ore_block MinecraftBlockDescriptor | Identifier

Ore block used by the fossil feature.

required
max_empty_corners int

Maximum number of empty corners allowed.

required
Documentation reference

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

GeodeFeature

Bases: Feature

Generates a geode with configurable shell layers, point distribution, and crack behavior.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, *, filler, inner_layer, alternate_inner_layer, middle_layer, outer_layer, min_outer_wall_distance, max_outer_wall_distance, min_distribution_points, max_distribution_points, min_point_offset, max_point_offset, max_radius, crack_point_offset, generate_crack_chance, base_crack_size, noise_multiplier, use_potential_placements_chance, use_alternate_layer0_chance, placements_require_layer0_alternate, invalid_blocks_threshold, inner_placements=None)

Generates a geode with configurable shell layers, point distribution, and crack behavior.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
filler MinecraftBlockDescriptor | Identifier

The block to fill the inside of the geode.

required
inner_layer MinecraftBlockDescriptor | Identifier

The block that forms the inside layer of the geode shell.

required
alternate_inner_layer MinecraftBlockDescriptor | Identifier

The block that has a chance of generating instead of inner_layer.

required
middle_layer MinecraftBlockDescriptor | Identifier

The block that forms the middle layer of the geode shell.

required
outer_layer MinecraftBlockDescriptor | Identifier

The block that forms the outer shell of the geode.

required
min_outer_wall_distance int

The minimum distance each distribution point must be from the outer wall.

required
max_outer_wall_distance int

The maximum distance each distribution point can be from the outer wall.

required
min_distribution_points int

The minimum number of points inside the distance field that can get generated.

required
max_distribution_points int

The maximum number of points inside the distance field that can get generated.

required
min_point_offset int

The lowest possible value of random offset applied to the position of each distribution point.

required
max_point_offset int

The highest possible value of random offset applied to the position of each distribution point.

required
max_radius int

The maximum possible radius of the geode generated.

required
crack_point_offset float

An offset applied to each distribution point that forms the geode crack opening.

required
generate_crack_chance float

The likelihood of a geode generating with a crack in its shell.

required
base_crack_size float

How large the crack opening of the geode should be when generated.

required
noise_multiplier float

A multiplier applied to the noise that is applied to the distribution points within the geode. Higher = more noisy.

required
use_potential_placements_chance float

The likelihood that a special block will be placed on the inside of the geode.

required
use_alternate_layer0_chance float

The likelihood that a block in the innermost layer of the geode will be replaced with an alternate option.

required
placements_require_layer0_alternate bool

If true, the potential placement block will only be placed on the alternate layer0 blocks that get placed.

required
invalid_blocks_threshold int

The threshold of invalid blocks for a geode to have a distribution point in before it aborts generation entirely.

required
inner_placements list[MinecraftBlockDescriptor | Identifier] | None

A list of blocks that may be replaced during placement. Omit this field to allow any block to be replaced.

None
Documentation reference

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

inner_placements(blocks)

Sets a list of blocks that may be replaced during placement.

Omit this field to allow any block to be replaced.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

GrowingPlantFeature

Bases: Feature

Places a growing plant column with weighted height, body, and head blocks.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, growth_direction, age=None, allow_water=False)

Places a growing plant in the world.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
growth_direction Literal['UP', 'DOWN']

Direction that the plant grows towards.

required
age int | tuple[int, int] | list[int] | Mapping[str, int] | None

Age of the head of the plant.

None
allow_water bool

Plant blocks can be placed in water.

False
Documentation reference

add_body_block(block, weight=1.0)

Adds a body_blocks entry with a plant body block and weight.

add_head_block(block, weight=1.0)

Adds a head_blocks entry with a plant head block and weight.

add_height(height, weight=1.0)

Adds a height_distribution entry with plant height and weight used in random selection.

age(age)

Sets the age of the head of the plant.

body_blocks(blocks)

Adds multiple body_blocks entries with plant body blocks and weights.

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

head_blocks(blocks)

Adds multiple head_blocks entries with plant head blocks and weights.

height_distribution(heights)

Adds multiple height_distribution entries with plant height and weight values.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

MultiBlockFeature

Bases: Feature

Places a multi-block in the world as a biome decoration feature.

A multi-block must be defined with the minecraft:multi_block trait. The required places_block field must reference the first part of a multi-block (i.e. its minecraft:multi_block_part state must equal 0).

  • The optional may_replace allowlist specifies which blocks each part of the multi-block may replace. If omitted, multi-block parts can be placed anywhere except on top of other multi-block parts.
  • The optional randomize_rotation field randomizes the multi-block's cardinal orientation. Requires the block to have a cardinal direction state.
  • The optional enforce_placement_rules field checks whether each part of the multi-block may be placed on top of existing blocks, optionally consulting the block's minecraft:placement_filter component.
Note

Requires format_version of at least 1.26.50.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, places_block, randomize_rotation=False, enforce_placement_rules=False)

Places a multi-block in the world as a biome decoration feature.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
places_block MinecraftBlockDescriptor | Identifier

Reference to the multi-block to be placed. Must be the identifier of the first part of a multi-block (minecraft:multi_block_part state == 0).

required
randomize_rotation bool

If True, randomizes the multi-block's cardinal orientation. The multi-block must have a cardinal direction state.

False
enforce_placement_rules bool

If True, checks each part of the multi-block against the block's canPlace rules, optionally including its minecraft:placement_filter component.

False
Documentation reference

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

may_replace(blocks)

Sets the may_replace allowlist.

Specifies which blocks each part of the multi-block may replace. Other multi-blocks can never be replaced regardless of this list.

Parameters:

Name Type Description Default
blocks list[MinecraftBlockDescriptor | Identifier]

List of blocks that the multi-block parts are allowed to replace.

required

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

MultifaceFeature

Bases: Feature

Places multiface blocks on floors, walls, and ceilings.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, places_block, search_range, can_place_on_floor, can_place_on_ceiling, can_place_on_wall, chance_of_spreading, can_place_on=None)

Places one or a few multiface blocks on floors, walls, and ceilings.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
places_block MinecraftBlockDescriptor | Identifier

Reference to the block to be placed.

required
search_range int

How far, in blocks, this feature can search for a valid position to place.

required
can_place_on_floor bool

Whether placement on floors is allowed.

required
can_place_on_ceiling bool

Whether placement on ceilings is allowed.

required
can_place_on_wall bool

Whether placement on walls is allowed.

required
chance_of_spreading float

For each block placed by this feature, how likely that block is to spread to another.

required
can_place_on list[MinecraftBlockDescriptor | Identifier] | None

Optional block reference array limiting valid support blocks.

None
Documentation reference

can_place_on(blocks)

Sets the can_place_on block reference array.

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

NetherCaveCarverFeature

Bases: Feature

Carves cave systems through the Nether using the cave carver schema.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, fill_with=None, width_modifier=None, skip_carve_chance=None, height_limit=None, y_scale=None, horizontal_radius_multiplier=None, vertical_radius_multiplier=None, floor_level=None)

Carves cave systems through the Nether.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
fill_with MinecraftBlockDescriptor | Identifier | None

Reference to the block to fill the cave with.

None
width_modifier Molang | float | int | None

How many blocks to increase the cave radius by, from the center point of the cave.

None
skip_carve_chance int | None

The chance to skip doing the carve (1 / value).

None
height_limit int | None

The height limit where we attempt to carve.

None
y_scale int | float | tuple[int | float, int | float] | list[int | float] | Mapping[str, int | float] | None

The scaling in y.

None
horizontal_radius_multiplier int | float | tuple[int | float, int | float] | list[int | float] | Mapping[str, int | float] | None

Horizontal radius multiplier.

None
vertical_radius_multiplier int | float | tuple[int | float, int | float] | list[int | float] | Mapping[str, int | float] | None

Vertical radius multiplier.

None
floor_level int | float | tuple[int | float, int | float] | list[int | float] | Mapping[str, int | float] | None

Floor Level.

None
Documentation reference

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

OreFeature

Bases: Feature

Places a vein of blocks using ordered replacement rules.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, count, discard_chance_on_air_exposure=None)

Places a vein of blocks to simulate ore deposits.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
count int

The number of blocks to be placed.

required
discard_chance_on_air_exposure float | None

Optional discard chance applied when ore is exposed to air.

None
Documentation reference

add_replace_rule(places_block, may_replace=None)

Adds a replace_rules entry with places_block and an optional may_replace array.

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

PartiallyExposedBlobFeature

Bases: Feature

Generates a blob where one face may remain exposed.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, places_block, placement_radius_around_floor, placement_probability_per_valid_position, exposed_face=BlockFaces.Up)

Generates a blob where one face may remain exposed.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
places_block MinecraftBlockDescriptor | Identifier

Block placed by the blob feature.

required
placement_radius_around_floor int

Radius around the floor used for placement.

required
placement_probability_per_valid_position float

Probability per valid position.

required
exposed_face BlockFaces | None

Defines a block face allowed to be exposed.

Up
Documentation reference

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

ScatterFeature

Bases: Feature, DistributionMixin

Places a referenced feature using scatter distribution parameters.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, places_feature, project_input_to_floor=False)

Scatters a feature throughout a chunk.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
places_feature Feature | Identifier

Named reference to the feature being scattered.

required
project_input_to_floor bool

Whether the input position should be projected to the floor before placement.

False
Documentation reference

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

SculkPatchFeature

Bases: Feature

Places a sculk patch with cursor spread settings and an optional central block.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, can_place_sculk_patch_on, cursor_count, charge_amount, spread_attempts, growth_rounds, spread_rounds, central_block=None, central_block_placement_chance=None, extra_growth_chance=None)

Places a sculk patch with cursor spread settings and an optional central block.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
can_place_sculk_patch_on list[MinecraftBlockDescriptor | Identifier]

Blocks that the sculk patch can be placed on.

required
cursor_count int

Number of cursors used during spread.

required
charge_amount int

Amount of charge assigned to the patch.

required
spread_attempts int

Number of spread attempts to perform.

required
growth_rounds int

Number of growth rounds to perform.

required
spread_rounds int

Number of spread rounds to perform.

required
central_block MinecraftBlockDescriptor | Identifier | None

Optional central block placed with the patch.

None
central_block_placement_chance float | None

Optional chance to place the central block.

None
extra_growth_chance int | tuple[int, int] | list[int] | Mapping[str, int] | None

Optional extra growth chance value or range.

None
Documentation reference

can_place_sculk_patch_on(blocks)

Sets the can_place_sculk_patch_on block reference array.

central_block(block, placement_chance=None)

Sets the optional central_block and central_block_placement_chance values.

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

SearchFeature

Bases: Feature

Searches a volume along an axis for valid positions before placing another feature.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, places_feature, search_axis, min_position, max_position, required_successes=None)

Sweeps a volume searching for a valid placement location for its referenced feature.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
places_feature Feature | Identifier

Named reference to the feature placed after a successful search.

required
search_axis Literal['-x', '+x', '-y', '+y', '-z', '+z']

Axis used to sweep the search volume.

required
min_position Sequence[int]

Minimum coordinates of the search_volume object.

required
max_position Sequence[int]

Maximum coordinates of the search_volume object.

required
required_successes int | None

Optional number of successful placements required.

None
Documentation reference

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

queue()

Queues the feature definition for export.

search_volume(min_position, max_position)

Sets the search_volume object with min and max coordinates.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

SequenceFeature

Bases: Feature

Places a collection of features sequentially, in the order they are defined.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name)

Initializes the base feature definition content.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

features(feature_list)

Sets the ordered feature_reference array for the sequence.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

SingleBlockFeature

Bases: Feature

Places a single block in the world. The places_block field supports a single block or a list of weighted blocks, where the weight defines how likely it is for that block to be selected. The may_attach_to and may_replace fields are allowlists which specify where the block can be placed. If these fields are omitted, the block can be placed anywhere. The may_not_attach_to field is a denylist that specifies what blocks can't be close to the placement location. The randomize_rotation field will randomize the block's cardinal orientation. The block's internal survivability and placement rules can optionally be enforced with the enforce_survivability_rules and enforce_placement_rules fields. These rules are specified per-block and are typically designed to produce high quality gameplay or natural behavior. However, enabling this enforcement may make it harder to debug placement failures.

  • Succeeds if: The block is successfully placed in the world.
  • Fails if: The block fails to be placed.
Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, enforce_placement_rules=False, enforce_survivability_rules=False, randomize_rotation=False)

Places a single block in the world.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
enforce_placement_rules bool

Whether block-specific placement rules are enforced.

False
enforce_survivability_rules bool

Whether block survivability rules are enforced.

False
randomize_rotation bool

Whether the block's cardinal rotation should be randomized.

False
Documentation reference

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

may_attach_to(face, blocks, min_sides_must_attach=1, auto_rotate=False)

Sets the may_attach_to object.

The object supports min_sides_must_attach, auto_rotate, and face-based block reference arrays such as top, bottom, sides, all, or diagonal.

may_not_attach_to(face, blocks, min_sides_must_attach=1, auto_rotate=False)

Sets the may_not_attach_to denylist.

This has the same structure as may_attach_to, including min_sides_must_attach, auto_rotate, and face-based block reference arrays.

may_replace(blocks)

Sets the may_replace block reference array.

place_block(block, weight=1.0)

Adds a places_block entry with a block reference and weight.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

SnapToSurfaceFeature

Bases: Feature

Snaps a referenced feature to a floor, ceiling, or random horizontal surface.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, feature_to_snap, vertical_search_range, surface='floor', allow_air_placement=True, allow_underwater_placement=False, allowed_surface_blocks=None, embed_in_surface=False)

Snaps the y-value of a feature placement position to the floor or ceiling within the provided vertical search range.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
feature_to_snap Feature | Identifier

Named reference to the feature that will be snapped to a surface.

required
vertical_search_range int

Vertical distance searched for a valid surface.

required
surface Literal['ceiling', 'floor', 'random_horizontal']

Surface type to snap to.

'floor'
allow_air_placement bool

Whether placement in air is allowed.

True
allow_underwater_placement bool

Whether underwater placement is allowed.

False
allowed_surface_blocks list[MinecraftBlockDescriptor | Identifier] | None

Optional block reference array limiting valid surfaces.

None
embed_in_surface bool

Allows specifying whether the snapped feature should be embedded in the located surface

False
Documentation reference

allowed_surface_blocks(blocks)

Sets the allowed_surface_blocks block reference array.

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

StructureTemplateFeature

Bases: Feature

Places a saved structure template with optional facing and constraints.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, structure_name, adjustment_radius=None, facing_direction=None, rotate_around_center=False)

Places a structure in the world.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
structure_name Identifier

Structure reference stored as a .mcstructure file in the behavior pack structures directory.

required
adjustment_radius int | None

Optional radius used to adjust placement.

None
facing_direction Literal['north', 'south', 'east', 'west', 'random'] | None

Optional facing direction for the structure.

None
rotate_around_center bool

If true, the structure will be rotated around its center. Defaults to False.

False
Documentation reference

block_allowlist(blocks)

Sets the block_allowlist array used by the block_intersection constraint.

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

grounded()

Adds the grounded constraint object.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

unburied()

Adds the unburied constraint object.

SurfaceRelativeThresholdFeature

Bases: Feature

Places a referenced feature only when the position is below the estimated surface.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, feature_to_place, minimum_distance_below_surface=0)

Determines whether the provided position is below the estimated surface level of the world and places a feature if so.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
feature_to_place Feature | Identifier

Named reference to the feature placed when the threshold passes.

required
minimum_distance_below_surface int

Minimum distance below the estimated surface required for placement.

0
Documentation reference

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

TreeFeature

Bases: Feature

Builds a tree feature with optional base data, trunk, canopy, and mangrove roots.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name)

Initializes the base feature definition content.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required

base_block(blocks)

Sets the single block or array of blocks for the base.

base_cluster(may_replace=None, num_clusters=1, cluster_radius=0)

Sets the base_cluster object with may_replace, num_clusters, and cluster_radius.

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

mangrove_roots(**config)

Sets the optional mangrove_roots object.

may_grow_on(blocks)

Sets the may_grow_on block reference array.

may_grow_through(blocks)

Sets the may_grow_through block reference array.

may_replace(blocks)

Sets the may_replace block reference array.

queue()

Queues the feature definition for export.

set_canopy(canopy_type, **config)

Sets one of the canopy objects that can be at the root of tree_feature or inside branch_canopy.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

set_trunk(trunk_type, **config)

Sets one of the trunk objects that must be defined by tree_feature.

UnderwaterCaveCarverFeature

Bases: Feature

Carves underwater caves below sea level during pregeneration.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, fill_with=None, width_modifier=None, skip_carve_chance=None, height_limit=None, y_scale=None, horizontal_radius_multiplier=None, vertical_radius_multiplier=None, floor_level=None, replace_air_with=None)

Carves underwater caves below sea level during pregeneration.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
fill_with MinecraftBlockDescriptor | Identifier | None

Reference to the block to fill the cave with.

None
width_modifier Molang | float | int | None

How many blocks to increase the cave radius by, from the center point of the cave.

None
skip_carve_chance int | None

The chance to skip doing the carve (1 / value).

None
height_limit int | None

The height limit where we attempt to carve.

None
y_scale int | float | tuple[int | float, int | float] | list[int | float] | Mapping[str, int | float] | None

The scaling in y.

None
horizontal_radius_multiplier int | float | tuple[int | float, int | float] | list[int | float] | Mapping[str, int | float] | None

Horizontal radius multiplier.

None
vertical_radius_multiplier int | float | tuple[int | float, int | float] | list[int | float] | Mapping[str, int | float] | None

Vertical radius multiplier.

None
floor_level int | float | tuple[int | float, int | float] | list[int | float] | Mapping[str, int | float] | None

Floor Level.

None
replace_air_with MinecraftBlockDescriptor | Identifier | None

Optional block used to replace carved air.

None
Documentation reference

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

VegetationPatchFeature

Bases: Feature

Creates a patch of ground blocks and scatters a vegetation feature over it.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, ground_block, vegetation_feature, depth, vertical_range, horizontal_radius, surface='floor', extra_deep_block_chance=None, vegetation_chance=None, extra_edge_column_chance=None, waterlogged=False)

Creates a patch of ground blocks and scatters a vegetation feature over it.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required
ground_block MinecraftBlockDescriptor | Identifier

Block used for the generated ground patch.

required
vegetation_feature Feature | Identifier

Named reference to the vegetation feature scattered over the patch.

required
depth int | tuple[int, int] | list[int] | Mapping[str, int]

Patch depth value or range.

required
vertical_range int

Vertical placement range.

required
horizontal_radius int | tuple[int, int] | list[int] | Mapping[str, int]

Horizontal radius value or range.

required
surface Literal['floor', 'ceiling']

Surface type used for placement.

'floor'
extra_deep_block_chance float | None

Optional chance to place extra deep blocks.

None
vegetation_chance float | None

Optional chance to place vegetation.

None
extra_edge_column_chance float | None

Optional chance to add extra edge columns.

None
waterlogged bool

Whether generated blocks should be waterlogged.

False
Documentation reference

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

queue()

Queues the feature definition for export.

replaceable_blocks(blocks)

Sets the replaceable_blocks block reference array.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

WeightedRandomFeature

Bases: Feature

Places one feature chosen from a weighted list of feature references.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name)

Initializes the base feature definition content.

Parameters:

Name Type Description Default
name str

The name of this feature. The resulting identifier uses the format 'namespace_name:feature_name'. 'feature_name' must match the filename.

required

add_feature(feature, weight=1.0)

Adds a weighted feature entry with a named reference to a feature and a weight.

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

features(feature_list)

Adds multiple weighted feature entries with feature references and weights.

queue()

Queues the feature definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

anvil.api.features.feature_rule

FeatureRule

Bases: AddonObject, DistributionMixin

Controls where and when a feature is placed during world generation.

Each feature rule controls exactly one feature and can attach that feature to biomes via minecraft:biome_filter, while placement_pass controls when the rule runs relative to other feature rules.

Documentation reference

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__export__()

Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.

__init__(name, feature, placement_pass)

Creates a feature rule that controls where and when one feature is placed.

Parameters:

Name Type Description Default
name str

The name of this feature rule. The resulting identifier uses the format 'namespace_name:rule_name'. 'rule_name' must match the filename.

required
feature Identifier | Feature

Named reference to the feature controlled by this rule.

required
placement_pass FeatureRulePlacementPass

When the feature should be placed relative to others. Earlier passes are guaranteed to occur before later passes, but order is not guaranteed within each pass.

required
Documentation reference

biome_filter(filters)

Sets the minecraft:biome_filter Filter Group.

This determines which biomes the rule attaches to. Filter groups may be expressed as a single filter object, a grouped filter object such as all_of/any_of/none_of, or a list of filter tests.

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self 'AddonObject'

The instance of the current AddonObject.

queue()

Queues the feature rule definition for export.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required