World - Features Module
anvil.api.features
World generation features: what is placed in the world, such as a block, a scatter of
other features or a structure. A feature is only placed when a
:class:~anvil.api.features.feature_rule.FeatureRule attaches it to biomes, or when another
feature, a sapling or /place feature places it.
Each feature type writes one typed document. Its file class builds it with the same methods as before: the constructor takes the options every feature of that type needs, and methods set the rest. Values are checked when the file is exported.
Example
Documentation reference
anvil.api.features.feature
The base of every feature type, and the distribution shared by scatter features
and feature rules.
Each feature type has its own module with three classes: _XFeature is the body of the
feature, _XFeatureFile is the document written to the file (format_version and the
body under its minecraft: key), and XFeature is the file class you create and build.
CoordinateRange
Bases: JsonObject
A random offset along one axis of a scatter, between the two ends of extent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
distribution
|
Literal['uniform', 'gaussian', 'inverse_gaussian', 'triangle', 'fixed_grid', 'jittered_grid']
|
How the offset is picked within |
required |
extent
|
tuple[int, int]
|
The lowest and highest offset, both included, from the position the scatter starts at. |
required |
grid_offset
|
int
|
Grid distributions only: the offset of the grid along this axis. |
required |
step_size
|
int
|
Grid distributions only: the distance between two steps of the grid. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
DistributionMixin
Gives a scatter feature or a feature rule its distribution() builder.
distribution(iterations, scatter_chance, x, y, z, coordinate_eval_order=None)
Sets where, how many times and how likely the feature is placed.
Coordinates are offsets from the position the scatter starts at: a number, a Molang
expression or a :class:CoordinateRange.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iterations
|
int | str
|
How many times the feature is placed, or a Molang expression that returns it. |
required |
scatter_chance
|
float | tuple[int, int] | str | None
|
The chance that any
iteration runs, checked once: a percentage, a |
required |
x
|
float | str | CoordinateRange
|
The x offset, evaluated each iteration. |
required |
y
|
float | str | CoordinateRange
|
The y offset, evaluated each iteration. |
required |
z
|
float | str | CoordinateRange
|
The z offset, evaluated each iteration. |
required |
coordinate_eval_order
|
Literal['xyz', 'xzy', 'yxz', 'yzx', 'zxy', 'zyx']
|
The order the coordinates are evaluated in, when one depends on another. Game default "xzy". |
None
|
Feature
Bases: JsonFile[D]
The base of the feature types. Create one of them, such as :class:ScatterFeature.
A feature is written as its identifier wherever another file references it.
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates the feature file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. The identifier is
|
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
When |
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
queue()
Queues the feature for export.
anvil.api.features.feature_rule
Feature rules: they attach one feature to biomes, and say when and where it is placed.
FeatureRule
Bases: DistributionMixin, JsonFile[_FeatureRuleFile]
Attaches one feature to the biomes that pass its biome filter, and says in which pass and where in each chunk the feature is placed.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the rule, also its file name. The identifier is
|
required |
feature
|
Feature | str
|
The feature the rule places, or its identifier. |
required |
placement_pass
|
FeatureRulePlacementPass
|
The pass the rule runs in. Earlier passes run before later ones; rules of one pass run in no set order. |
required |
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
biome_filter(filters)
distribution(iterations, scatter_chance, x, y, z, coordinate_eval_order=None)
Sets where, how many times and how likely the feature is placed.
Coordinates are offsets from the position the scatter starts at: a number, a Molang
expression or a :class:CoordinateRange.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iterations
|
int | str
|
How many times the feature is placed, or a Molang expression that returns it. |
required |
scatter_chance
|
float | tuple[int, int] | str | None
|
The chance that any
iteration runs, checked once: a percentage, a |
required |
x
|
float | str | CoordinateRange
|
The x offset, evaluated each iteration. |
required |
y
|
float | str | CoordinateRange
|
The y offset, evaluated each iteration. |
required |
z
|
float | str | CoordinateRange
|
The z offset, evaluated each iteration. |
required |
coordinate_eval_order
|
Literal['xyz', 'xzy', 'yxz', 'yzx', 'zxy', 'zyx']
|
The order the coordinates are evaluated in, when one depends on another. Game default "xzy". |
None
|
queue()
Queues the feature rule for export.
anvil.api.features.aggregate
The minecraft:aggregate_feature.
AggregateFeature
Bases: Feature[_AggregateFeatureFile]
Places a collection of features, all at the same position, in no guaranteed order. The features should not depend on each other.
- Succeeds if at least one feature is placed.
- Fails if every feature fails to be placed.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates the feature file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. The identifier is
|
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
When |
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
early_out(early_out)
Stops placing features after the first success or the first failure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
early_out
|
Literal['none', 'first_failure', 'first_success']
|
When to stop. |
required |
features(feature_list)
Adds features to place. At least one is needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature_list
|
Sequence[Feature | str]
|
The features, or their identifiers. |
required |
queue()
Queues the feature for export.
anvil.api.features.cave_carver
The cave carvers: minecraft:cave_carver_feature, minecraft:nether_cave_carver_feature
and minecraft:underwater_cave_carver_feature.
CaveCarverFeature
Bases: _CaveCarver[_CaveCarverFeatureFile]
Carves a cave through the current chunk and the chunks around it. Only works when its
feature rule places it in the pregeneration_pass.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates a cave carver feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
fill_with
|
str | Block | BlockDescriptor
|
The block the cave is filled with. |
None
|
width_modifier
|
float | str
|
How many blocks the cave radius grows by, from its centre: a number or a Molang expression. |
None
|
skip_carve_chance
|
int
|
The chance to skip the carve, as 1 in this value. At least 1. |
None
|
height_limit
|
int
|
The height limit of the carve. |
None
|
y_scale
|
float | tuple[float, float]
|
The scale along y, or a range it is picked from. |
None
|
horizontal_radius_multiplier
|
float | tuple[float, float]
|
The horizontal radius multiplier, or a range it is picked from. |
None
|
vertical_radius_multiplier
|
float | tuple[float, float]
|
The vertical radius multiplier, or a range it is picked from. |
None
|
floor_level
|
float | tuple[float, float]
|
The floor level, or a range it is picked from. |
None
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
queue()
Queues the feature for export.
NetherCaveCarverFeature
Bases: _CaveCarver[_NetherCaveCarverFeatureFile]
Carves a cave through the Nether in the current chunk and the chunks around it. Only
works when its feature rule places it in the pregeneration_pass.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates a cave carver feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
fill_with
|
str | Block | BlockDescriptor
|
The block the cave is filled with. |
None
|
width_modifier
|
float | str
|
How many blocks the cave radius grows by, from its centre: a number or a Molang expression. |
None
|
skip_carve_chance
|
int
|
The chance to skip the carve, as 1 in this value. At least 1. |
None
|
height_limit
|
int
|
The height limit of the carve. |
None
|
y_scale
|
float | tuple[float, float]
|
The scale along y, or a range it is picked from. |
None
|
horizontal_radius_multiplier
|
float | tuple[float, float]
|
The horizontal radius multiplier, or a range it is picked from. |
None
|
vertical_radius_multiplier
|
float | tuple[float, float]
|
The vertical radius multiplier, or a range it is picked from. |
None
|
floor_level
|
float | tuple[float, float]
|
The floor level, or a range it is picked from. |
None
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
queue()
Queues the feature for export.
UnderwaterCaveCarverFeature
Bases: _CaveCarver[_UnderwaterCaveCarverFeatureFile]
Carves a cave below sea level through the current chunk and the chunks around it.
Only works when its feature rule places it in the pregeneration_pass.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates an underwater cave carver feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
fill_with
|
str | Block | BlockDescriptor
|
The block the cave is filled with. |
None
|
width_modifier
|
float | str
|
How many blocks the cave radius grows by, from its centre: a number or a Molang expression. |
None
|
skip_carve_chance
|
int
|
The chance to skip the carve, as 1 in this value. At least 1. |
None
|
height_limit
|
int
|
The height limit of the carve. |
None
|
y_scale
|
float | tuple[float, float]
|
The scale along y, or a range it is picked from. |
None
|
horizontal_radius_multiplier
|
float | tuple[float, float]
|
The horizontal radius multiplier, or a range it is picked from. |
None
|
vertical_radius_multiplier
|
float | tuple[float, float]
|
The vertical radius multiplier, or a range it is picked from. |
None
|
floor_level
|
float | tuple[float, float]
|
The floor level, or a range it is picked from. |
None
|
replace_air_with
|
str | Block | BlockDescriptor
|
The block air is replaced with. |
None
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
queue()
Queues the feature for export.
anvil.api.features.fossil
The minecraft:fossil_feature.
FossilFeature
Bases: Feature[_FossilFeatureFile]
Places a skeleton of bone blocks with ore blocks in it.
- Succeeds if the fossil is placed.
- Fails if it overlaps another structure, or too many corners of its bounding box are air or fluid.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates a fossil feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
ore_block
|
str | Block | BlockDescriptor
|
The ore block in the fossil. |
required |
max_empty_corners
|
int
|
How many corners of the bounding box may be air or fluid. At least 0. |
required |
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
queue()
Queues the feature for export.
anvil.api.features.geode
The minecraft:geode_feature.
GeodeFeature
Bases: Feature[_GeodeFeatureFile]
Places a rock formation like a geode: layers of shell around a filler, with optional blocks growing inside and a crack.
- Succeeds if at least one block of the geode is placed.
- Fails if every block fails to be placed.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates a geode feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
filler
|
str | Block | BlockDescriptor
|
The block inside the geode. |
required |
inner_layer
|
str | Block | BlockDescriptor
|
The inside layer of the shell. |
required |
alternate_inner_layer
|
str | Block | BlockDescriptor
|
The block that may replace a block of the inside layer. |
required |
middle_layer
|
str | Block | BlockDescriptor
|
The middle layer of the shell. |
required |
outer_layer
|
str | Block | BlockDescriptor
|
The outer layer of the shell. |
required |
min_outer_wall_distance
|
int
|
The least distance from a distribution point to the outer wall, from 1 to 10. |
required |
max_outer_wall_distance
|
int
|
The greatest distance from a distribution point to the outer wall, from 1 to 20. |
required |
min_distribution_points
|
int
|
The fewest distribution points, from 1 to 10. |
required |
max_distribution_points
|
int
|
The most distribution points, from 1 to 20. |
required |
min_point_offset
|
int
|
The lowest random offset of a distribution point, from 0 to 10. |
required |
max_point_offset
|
int
|
The highest random offset of a distribution point, from 0 to 10. |
required |
max_radius
|
int
|
The largest radius of the geode. |
required |
crack_point_offset
|
float
|
The offset of the points that form the crack, from 0 to 10. |
required |
generate_crack_chance
|
float
|
The chance the geode has a crack, from 0 to 1. |
required |
base_crack_size
|
float
|
The size of the crack, from 0 to 5. |
required |
noise_multiplier
|
float
|
How noisy the distribution points are. |
required |
use_potential_placements_chance
|
float
|
The chance a block from
|
required |
use_alternate_layer0_chance
|
float
|
The chance a block of the inside layer is the alternate block, from 0 to 1. |
required |
placements_require_layer0_alternate
|
bool
|
The inner placements only grow on the alternate blocks. |
required |
invalid_blocks_threshold
|
int
|
How many invalid blocks around a distribution point stop the geode. At least 0. |
required |
inner_placements
|
Sequence[str | Block | BlockDescriptor]
|
The blocks that may grow inside the geode. |
None
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
inner_placements(blocks)
Sets the blocks that may grow inside the geode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
Sequence[str | Block | BlockDescriptor]
|
The blocks. At least one. |
required |
queue()
Queues the feature for export.
anvil.api.features.growing_plant
The minecraft:growing_plant_feature.
GrowingPlantFeature
Bases: Feature[_GrowingPlantFeatureFile]
Places a growing plant: a column anchored to the floor or the ceiling, made of body blocks and a head block at its tip, such as cave vines.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates a growing plant feature. Add heights, body blocks and head blocks next.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
growth_direction
|
Literal['UP', 'DOWN']
|
Whether the plant grows up from the floor or down from the ceiling. |
required |
age
|
float | tuple[float, float]
|
The age of the head, or a range it is picked from. |
None
|
allow_water
|
bool
|
The plant can be placed in water. Defaults to False. |
False
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
add_body_block(block, weight=1.0)
Adds a block the body can be made of.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
str | Block | BlockDescriptor
|
The block. |
required |
weight
|
float
|
Its weight, relative to the others. Defaults to 1. |
1.0
|
add_head_block(block, weight=1.0)
Adds a block the head can be.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
str | Block | BlockDescriptor
|
The block. |
required |
weight
|
float
|
Its weight, relative to the others. Defaults to 1. |
1.0
|
add_height(height, weight=1.0)
Adds a height the plant can have.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
height
|
float | tuple[float, float]
|
The height, or a range it is picked from. |
required |
weight
|
float
|
Its weight, relative to the others. Defaults to 1. |
1.0
|
age(age)
Sets the age of the head of the plant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
age
|
float | tuple[float, float]
|
The age, or a range it is picked from. |
required |
body_blocks(blocks)
Adds blocks the body can be made of.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
Sequence[tuple[str | Block | BlockDescriptor, float]]
|
|
required |
head_blocks(blocks)
Adds blocks the head can be.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
Sequence[tuple[str | Block | BlockDescriptor, float]]
|
|
required |
height_distribution(heights)
Adds heights the plant can have.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
heights
|
Sequence[tuple[float | tuple[float, float], float]]
|
|
required |
queue()
Queues the feature for export.
anvil.api.features.height_difference_filter
The minecraft:height_difference_filter_feature.
HeightDifferenceFilterFeature
Bases: Feature[_HeightDifferenceFilterFeatureFile]
Places a feature only where the terrain has the right shape: the height differences up and down, within a radius in each cardinal direction, must be within the limits given. Useful for features that only fit cliffs, slopes or flat ground.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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_radius=None, min_required_upward_height_diff=None, max_allowed_upward_height_diff=None, min_required_downward_height_diff=None, max_allowed_downward_height_diff=None)
Creates a height difference filter feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
places_feature
|
Feature | str
|
The feature placed when the terrain fits. |
required |
search_radius
|
int
|
How far, in each cardinal direction, heights are checked. |
None
|
min_required_upward_height_diff
|
int
|
The least height difference upwards. |
None
|
max_allowed_upward_height_diff
|
int
|
The greatest height difference upwards. |
None
|
min_required_downward_height_diff
|
int
|
The least height difference downwards. |
None
|
max_allowed_downward_height_diff
|
int
|
The greatest height difference downwards. |
None
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
queue()
Queues the feature for export.
anvil.api.features.multi_block
The minecraft:multi_block_feature.
MultiBlockFeature
Bases: Feature[_MultiBlockFeatureFile]
Places a multi-block, a block with the minecraft:multi_block trait.
places_block must be the first part of the multi-block, the one whose
minecraft:multi_block_part state is 0. Without may_replace, the parts can replace any
block but the parts of other multi-blocks. With randomize_rotation, the multi-block
needs a cardinal direction state. With enforce_placement_rules, each part checks it can
be placed, including against its minecraft:placement_filter.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates a multi-block feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
places_block
|
str | Block | BlockDescriptor
|
The first part of the multi-block. |
required |
randomize_rotation
|
bool
|
The multi-block faces a random cardinal direction. Defaults to False. |
False
|
enforce_placement_rules
|
bool
|
Each part checks it can be placed. Defaults to False. |
False
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
may_replace(blocks)
Sets the blocks the parts may replace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
Sequence[str | Block | BlockDescriptor]
|
The blocks. |
required |
queue()
Queues the feature for export.
anvil.api.features.multiface
The minecraft:multiface_feature.
MultifaceFeature
Bases: Feature[_MultifaceFeatureFile]
Places a block on floors, walls or ceilings, and spreads it around, such as glow lichen. Any block can be placed.
- Succeeds if at least one block is placed.
- Fails if every placement fails.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates a multiface feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
places_block
|
str | Block | BlockDescriptor
|
The block placed. |
required |
search_range
|
int
|
How far, in blocks, a valid position is searched for, from 1 to 64. |
required |
can_place_on_floor
|
bool
|
The block can be placed on the top face of a block. |
required |
can_place_on_ceiling
|
bool
|
The block can be placed on the bottom face of a block. |
required |
can_place_on_wall
|
bool
|
The block can be placed on the side faces of a block. |
required |
chance_of_spreading
|
float
|
The chance each placed block spreads to another, from 0 to 1. |
required |
can_place_on
|
Sequence[str | Block | BlockDescriptor]
|
The blocks it can be placed on. Any block when left out. |
None
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
can_place_on(blocks)
Sets the blocks the block can be placed on.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
Sequence[str | Block | BlockDescriptor]
|
The blocks. At least one. |
required |
queue()
Queues the feature for export.
anvil.api.features.ore
The minecraft:ore_feature.
OreFeature
Bases: Feature[_OreFeatureFile]
Places a vein of blocks, like an ore deposit. Any block can be placed.
Each position checks the replace rules in order and uses the first one whose
may_replace has the block there; a rule without may_replace replaces any block.
- Succeeds if at least one block is placed.
- Fails if every placement fails.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates an ore feature. Add replace rules next.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
count
|
int
|
The number of blocks placed. At least 1. |
required |
discard_chance_on_air_exposure
|
float
|
The chance a block next to air is not placed, from 0 to 1. |
None
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
add_replace_rule(places_block, may_replace=None)
Adds a replace rule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
places_block
|
str | Block | BlockDescriptor
|
The block placed. |
required |
may_replace
|
Sequence[str | Block | BlockDescriptor]
|
The blocks it may replace. Any block when left out. |
None
|
queue()
Queues the feature for export.
anvil.api.features.partially_exposed_blob
The minecraft:partially_exposed_blob_feature.
PartiallyExposedBlobFeature
Bases: Feature[_PartiallyExposedBlobFeatureFile]
Places a blob of a block, embedded in the surface but for one face that may be exposed to air or water.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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=BlockFaceValues.Up)
Creates a partially exposed blob feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
places_block
|
str | Block | BlockDescriptor
|
The block placed. |
required |
placement_radius_around_floor
|
int
|
The cubic radius of the blob, from 1 to 8. |
required |
placement_probability_per_valid_position
|
float
|
The chance a block is placed at each valid position, from 0 to 1. |
required |
exposed_face
|
BlockFaceValues
|
The face that may be exposed: up, down, north, south, east or west. Defaults to up. |
Up
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
queue()
Queues the feature for export.
anvil.api.features.scatter
The minecraft:scatter_feature.
ScatterFeature
Bases: DistributionMixin, Feature[_ScatterFeatureFile]
Places a feature several times around its position, as set by distribution().
Coordinates are offsets from the position, not absolute positions. The scatter chance is checked once: either every iteration runs, or none does.
- Succeeds if at least one placement succeeds.
- Fails if every placement fails.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates a scatter feature. Set its distribution next.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
places_feature
|
Feature | str
|
The feature scattered. |
required |
project_input_to_floor
|
bool
|
Snap the y of each position to the terrain height. Defaults to False. |
False
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
distribution(iterations, scatter_chance, x, y, z, coordinate_eval_order=None)
Sets where, how many times and how likely the feature is placed.
Coordinates are offsets from the position the scatter starts at: a number, a Molang
expression or a :class:CoordinateRange.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iterations
|
int | str
|
How many times the feature is placed, or a Molang expression that returns it. |
required |
scatter_chance
|
float | tuple[int, int] | str | None
|
The chance that any
iteration runs, checked once: a percentage, a |
required |
x
|
float | str | CoordinateRange
|
The x offset, evaluated each iteration. |
required |
y
|
float | str | CoordinateRange
|
The y offset, evaluated each iteration. |
required |
z
|
float | str | CoordinateRange
|
The z offset, evaluated each iteration. |
required |
coordinate_eval_order
|
Literal['xyz', 'xzy', 'yxz', 'yzx', 'zxy', 'zyx']
|
The order the coordinates are evaluated in, when one depends on another. Game default "xzy". |
None
|
queue()
Queues the feature for export.
anvil.api.features.sculk_patch
The minecraft:sculk_patch_feature.
SculkPatchFeature
Bases: Feature[_SculkPatchFeatureFile]
Places a patch of sculk that spreads from cursors, with an optional block at its centre.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates a sculk patch feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
can_place_sculk_patch_on
|
Sequence[str | Block | BlockDescriptor]
|
The blocks the patch can be placed on. |
required |
cursor_count
|
int
|
The number of cursors, from 0 to 32. |
required |
charge_amount
|
int
|
The charge of each cursor, from 1 to 1000. |
required |
spread_attempts
|
int
|
The spread attempts of each cursor, from 1 to 64. |
required |
growth_rounds
|
int
|
The growth rounds, from 0 to 8. |
required |
spread_rounds
|
int
|
The spread rounds, from 0 to 8. |
required |
central_block
|
str | Block | BlockDescriptor
|
The block at the centre of the patch. |
None
|
central_block_placement_chance
|
float
|
The chance the central block is placed, from 0 to 1. |
None
|
extra_growth_chance
|
float | tuple[float, float]
|
The extra growth chance, or a range it is picked from. |
None
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
can_place_sculk_patch_on(blocks)
Sets the blocks the patch can be placed on.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
Sequence[str | Block | BlockDescriptor]
|
The blocks. |
required |
central_block(block, placement_chance=None)
Sets the block placed at the centre of the patch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
str | Block | BlockDescriptor
|
The block. |
required |
placement_chance
|
float
|
The chance it is placed, from 0 to 1. |
None
|
queue()
Queues the feature for export.
anvil.api.features.search
The minecraft:search_feature.
SearchFeature
Bases: Feature[_SearchFeatureFile]
Sweeps a box, layer by layer along an axis, for positions where a feature can be
placed, and places it when enough are found. With -x, positions with greater x are
checked first.
- Succeeds if
required_successespositions are found (1 by default). - Fails if fewer are found.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates a search feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
places_feature
|
Feature | str
|
The feature placed. |
required |
search_axis
|
Literal['-x', '+x', '-y', '+y', '-z', '+z']
|
The axis the search sweeps along. |
required |
min_position
|
tuple[int, int, int]
|
The corner of the box with the smallest offsets. |
required |
max_position
|
tuple[int, int, int]
|
The opposite corner. |
required |
required_successes
|
int
|
How many valid positions must be found. At least 1. |
None
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
queue()
Queues the feature for export.
search_volume(min_position, max_position)
Sets the box searched, as offsets from the feature's position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_position
|
tuple[int, int, int]
|
The corner with the smallest offsets. |
required |
max_position
|
tuple[int, int, int]
|
The opposite corner. |
required |
anvil.api.features.sequence
The minecraft:sequence_feature.
SequenceFeature
Bases: Feature[_SequenceFeatureFile]
Places a collection of features in order. Each feature starts at the position the previous one ended at.
- Succeeds if every feature is placed.
- Fails if any feature fails to be placed; the features after it are skipped.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates the feature file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. The identifier is
|
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
When |
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
features(feature_list)
Adds features to place in order. At least one is needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature_list
|
Sequence[Feature | str]
|
The features, or their identifiers. |
required |
queue()
Queues the feature for export.
anvil.api.features.single_block
The minecraft:single_block_feature.
SingleBlockFeature
Bases: Feature[_SingleBlockFeatureFile]
Places one block, picked at random by weight from the blocks added.
may_attach_to and may_replace are allowlists of where the block can be placed: any
place when left out. may_not_attach_to is a denylist of blocks it cannot be next to.
The block's own placement and survival rules are only checked when enforced, which gives
natural results but can make failures harder to debug.
- Succeeds if the block is placed.
- Fails if it is not.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates a single block feature. Add the blocks it places next.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
enforce_placement_rules
|
bool
|
Check the block can be placed there. Defaults to False. |
False
|
enforce_survivability_rules
|
bool
|
Check the block can survive there. Defaults to False. |
False
|
randomize_rotation
|
bool
|
The block faces a random cardinal direction. Defaults to False. |
False
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
may_attach_to(face, blocks, min_sides_must_attach=1, auto_rotate=False)
Adds blocks the block may be placed next to on a face. Call it once per face.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
face
|
BlockFaceValues | Literal['diagonal']
|
The face: |
required |
blocks
|
Sequence[str | Block | BlockDescriptor]
|
The blocks. |
required |
min_sides_must_attach
|
int
|
How many side faces must pass, from 1 to 4. Defaults to 1; None leaves it as it is. |
1
|
auto_rotate
|
bool
|
Rotate the block to attach sensibly, unless the rotation is random. Defaults to False; None leaves it as it is. |
False
|
may_not_attach_to(face, blocks)
Adds blocks the block may not be placed next to on a face. Call it once per face.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
face
|
BlockFaceValues | Literal['diagonal']
|
The face: |
required |
blocks
|
Sequence[str | Block | BlockDescriptor]
|
The blocks. |
required |
may_replace(blocks)
Sets the blocks the block may replace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
Sequence[str | Block | BlockDescriptor]
|
The blocks. |
required |
place_block(block, weight=1.0)
Adds a block that can be placed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
str | Block | BlockDescriptor
|
The block. |
required |
weight
|
float
|
Its weight, relative to the others. Defaults to 1. |
1.0
|
queue()
Queues the feature for export.
anvil.api.features.snap_to_surface
The minecraft:snap_to_surface_feature.
SnapToSurfaceFeature
Bases: Feature[_SnapToSurfaceFeatureFile]
Places a feature on the floor, the ceiling or a wall found within a range above or below its position. Fails if the surface is in another biome.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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, search_range, surface='floor', allow_air_placement=True, allow_non_air_placement=False, allow_underwater_placement=False, allowed_surface_blocks=None, embed_in_surface=False)
Creates a snap to surface feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
feature_to_snap
|
Feature | str
|
The feature placed on the surface. |
required |
search_range
|
int
|
How far a surface is searched for. |
required |
surface
|
Literal['ceiling', 'floor', 'random_horizontal', 'wall']
|
The surface snapped to. Defaults to "floor". |
'floor'
|
allow_air_placement
|
bool
|
The search goes through air. Defaults to True. |
True
|
allow_non_air_placement
|
bool
|
The search goes through blocks other than air and water, when it starts in one. Defaults to False. |
False
|
allow_underwater_placement
|
bool
|
The search goes through water. Defaults to False. |
False
|
allowed_surface_blocks
|
Sequence[str | Block | BlockDescriptor]
|
The blocks it may snap to. Any block that supports the face when left out. |
None
|
embed_in_surface
|
bool
|
Place the feature in the surface block rather than on it. Defaults to False. |
False
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
allowed_surface_blocks(blocks)
Sets the blocks the feature may snap to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
Sequence[str | Block | BlockDescriptor]
|
The blocks. |
required |
queue()
Queues the feature for export.
anvil.api.features.structure_template
The minecraft:structure_template_feature.
StructureTemplateFeature
Bases: Feature[_StructureTemplateFeatureFile]
Places a structure saved as a .mcstructure file in the structures folder of a
behavior pack, any behavior pack.
The constraints say where it may be placed. The feature searches the nearest position
within adjustment_radius that satisfies them all, and places nothing when there is none.
- Succeeds if the structure is placed.
- Fails if it is not.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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, ground_level=None)
Creates a structure template feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
structure_name
|
str
|
The identifier of the structure. |
required |
adjustment_radius
|
int
|
How far the structure may move to find a valid position, from 0 to 16. Game default 0. |
None
|
facing_direction
|
Literal['north', 'south', 'east', 'west', 'random']
|
The direction the structure faces. Game default "random". |
None
|
rotate_around_center
|
bool
|
Rotate the structure around its centre rather than its corner. Defaults to False. |
False
|
ground_level
|
int
|
The y of the structure's layer that is its ground level. Game default 0. |
None
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
block_allowlist(blocks, only_check_intersection_for_motion_blocking_blocks=None)
Requires the structure to intersect only these blocks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
Sequence[str | Block | BlockDescriptor]
|
The blocks. |
required |
only_check_intersection_for_motion_blocking_blocks
|
bool
|
Only the structure's motion blocking blocks are checked, rather than all of its blocks but structure voids. |
None
|
grounded()
Requires the ground level of the structure to touch the ground.
leveled(max_steepness=None)
Requires mostly flat terrain under the ground level of the structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_steepness
|
int
|
The greatest height difference between the position and the terrain halfway along each side. Game default 2. |
None
|
queue()
Queues the feature for export.
unburied()
Requires air above the structure.
anvil.api.features.surface_relative_threshold
The minecraft:surface_relative_threshold_feature.
SurfaceRelativeThresholdFeature
Bases: Feature[_SurfaceRelativeThresholdFeatureFile]
Places a feature only when its position is below the estimated surface of the world. Only works in the Overworld, with the 1.18 world generation or later.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates a surface relative threshold feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
feature_to_place
|
Feature | str
|
The feature placed. |
required |
minimum_distance_below_surface
|
int
|
How many blocks below the surface the position must be. Defaults to 0. |
0
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
queue()
Queues the feature for export.
anvil.api.features.tree
The tree feature: a trunk, an optional canopy and, for mangroves, roots.
A tree has one trunk type and at most one canopy type, each set with its own method of
:class:TreeFeature. Trunks with branches (acacia, cherry and mega trunks) also grow a
canopy at the end of each branch: a canopy set with sync_to_branches (the default) is
used there too, and the branch_*_canopy methods set a different one.
Example
Documentation reference
TreeFeature
Bases: Feature[_TreeFeatureFile]
Places a tree: a trunk anchored to a base block, and a canopy around its top.
Set one trunk and at most one canopy. Setting another trunk, or another canopy, replaces it.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates a tree feature. Set its trunk and canopy next.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
acacia_canopy(leaf_block, canopy_size=3, simplify_canopy=False, sync_to_branches=True)
Sets a flat canopy, like an acacia.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
leaf_block
|
str | Block | BlockDescriptor
|
The block of the canopy. |
required |
canopy_size
|
int
|
The size of the canopy. At least 1. Defaults to 3. |
3
|
simplify_canopy
|
bool
|
Use a simpler pattern. Defaults to False. |
False
|
sync_to_branches
|
bool
|
Also grow it at the end of the trunk's branches. Defaults to True. |
True
|
acacia_trunk(trunk_block, trunk_width=1, base_height=5, height_intervals=None, min_height_for_canopy=None, allow_diagonal_growth=True, lean_height=(1, 5), lean_steps=(1, 4), lean_length=None, branch_chance=0.0, branch_length=(1, 4), branch_position=(1, 3))
Sets a trunk that can lean, with branches, like an acacia.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trunk_block
|
str | Block | BlockDescriptor
|
The block of the trunk. |
required |
trunk_width
|
int
|
The width of the trunk. At least 1. Defaults to 1. |
1
|
base_height
|
int
|
The least height. At least 1. Defaults to 5. |
5
|
height_intervals
|
Sequence[int]
|
Each adds a random number below it to the height. |
None
|
min_height_for_canopy
|
int
|
The least height the canopy is placed at. |
None
|
allow_diagonal_growth
|
bool
|
The trunk can lean. Defaults to True. |
True
|
lean_height
|
int | tuple[int, int]
|
How far below the top the lean starts, or a range it is picked from. Defaults to (1, 5). |
(1, 5)
|
lean_steps
|
int | tuple[int, int]
|
How many blocks the trunk moves sideways, or a range. Defaults to (1, 4). |
(1, 4)
|
lean_length
|
int | tuple[int, int]
|
How long the lean is along y, or a range. |
None
|
branch_chance
|
float | tuple[int, int]
|
The chance of a branch: a
number or a |
0.0
|
branch_length
|
int | tuple[int, int]
|
The length of a branch along y, or a range. Defaults to (1, 4). |
(1, 4)
|
branch_position
|
int | tuple[int, int]
|
Where a branch starts along y, or a range. Defaults to (1, 3). |
(1, 3)
|
base_block(blocks)
Sets the block at the base of the tree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
str | Block | BlockDescriptor | Sequence[str | Block | BlockDescriptor]
|
The block, or blocks. |
required |
base_cluster(num_clusters=1, cluster_radius=0, may_replace=None)
Sets clusters of the base block, placed at random around the base of the tree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_clusters
|
int
|
The number of clusters. At least 1. Defaults to 1. |
1
|
cluster_radius
|
int
|
The radius of each cluster. At least 0. Defaults to 0. |
0
|
may_replace
|
Sequence[str | Block | BlockDescriptor]
|
The blocks a cluster may replace. |
None
|
branch_acacia_canopy(leaf_block, canopy_size=3, simplify_canopy=False)
Grows an acacia canopy at the end of the trunk's branches. The arguments are the
ones of acacia_canopy().
branch_cherry_canopy(leaf_block, height=4, radius=4, trunk_width=None, wide_bottom_layer_hole_chance=25.0, corner_hole_chance=50.0, hanging_leaves_chance=16.6666, hanging_leaves_extension_chance=33.3333)
Grows a cherry canopy at the end of the trunk's branches. The arguments are the
ones of cherry_canopy().
branch_fancy_canopy(leaf_block, height=4, radius=4)
Grows a fancy canopy at the end of the trunk's branches. The arguments are the
ones of fancy_canopy().
canopy(leaf_block, min_width=None, canopy_offset_min=None, canopy_offset_max=None, slope_rise=None, slope_run=None, variation_chance=None, sync_to_branches=True)
Sets a layered canopy, like an oak or a birch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
leaf_block
|
str | Block | BlockDescriptor
|
The block of the canopy. |
required |
min_width
|
int
|
The least width of the canopy. At least 0. |
None
|
canopy_offset_min
|
int
|
The lowest layer, from the block above the
trunk. Set with |
None
|
canopy_offset_max
|
int
|
The highest layer, from the block above the trunk. |
None
|
slope_rise
|
int
|
The rise of the canopy's slope. At least 1. |
None
|
slope_run
|
int
|
The run of the canopy's slope. At least 1. |
None
|
variation_chance
|
Sequence[float | tuple[int, int]]
|
For each layer,
the chance of each leaf: a number or a |
None
|
sync_to_branches
|
bool
|
Also grow it at the end of the trunk's branches. Defaults to True. |
True
|
canopy_decoration(decoration_chance, decoration_block=None, num_steps=None, step_direction=None)
Spreads blocks from the canopy, such as vines. Set a canopy or a mangrove canopy first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
decoration_chance
|
float | tuple[int, int]
|
The chance of a decoration: a
number or a |
required |
decoration_block
|
str | Block | BlockDescriptor
|
The block placed. |
None
|
num_steps
|
int
|
How many blocks are placed. |
None
|
step_direction
|
Literal['down', 'up', 'out', 'away']
|
The direction the blocks spread in. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
When the tree has no canopy that takes a decoration. |
cherry_canopy(leaf_block, height=4, radius=4, trunk_width=None, wide_bottom_layer_hole_chance=25.0, corner_hole_chance=50.0, hanging_leaves_chance=16.6666, hanging_leaves_extension_chance=33.3333, sync_to_branches=True)
Sets a round canopy with hanging leaves, like a cherry tree.
Chances are percentages, or (numerator, denominator) fractions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
leaf_block
|
str | Block | BlockDescriptor
|
The block of the canopy. |
required |
height
|
int | tuple[int, int]
|
The number of layers, or a range. Defaults to 4. |
4
|
radius
|
int | tuple[int, int]
|
The radius, or a range. Defaults to 4. |
4
|
trunk_width
|
int
|
The width of the trunk. At least 1. |
None
|
wide_bottom_layer_hole_chance
|
float | tuple[int, int]
|
The chance of a hole in the bottom layer. Defaults to 25. |
25.0
|
corner_hole_chance
|
float | tuple[int, int]
|
The chance of a hole in a corner. Defaults to 50. |
50.0
|
hanging_leaves_chance
|
float | tuple[int, int]
|
The chance of hanging leaves. Defaults to 16.6666. |
16.6666
|
hanging_leaves_extension_chance
|
float | tuple[int, int]
|
The chance hanging leaves go one further. Defaults to 33.3333. |
33.3333
|
sync_to_branches
|
bool
|
Also grow it at the end of the trunk's branches. Defaults to True. |
True
|
cherry_trunk(trunk_block, base_height=7, height_intervals=None, one_branch_weight=10, two_branches_weight=10, two_branches_and_trunk_weight=10, branch_horizontal_length=(2, 4), branch_start_offset_from_top=(-4, -3), branch_end_offset_from_top=(-1, 0))
Sets a trunk with one or two long branches, like a cherry tree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trunk_block
|
str | Block | BlockDescriptor
|
The block of the trunk. |
required |
base_height
|
int
|
The least height. At least 2. Defaults to 7. |
7
|
height_intervals
|
Sequence[int]
|
Each adds a random number below it to the height. |
None
|
one_branch_weight
|
int
|
The weight of a tree with one branch. Defaults to 10. |
10
|
two_branches_weight
|
int
|
The weight of a tree with two branches. Defaults to 10. |
10
|
two_branches_and_trunk_weight
|
int
|
The weight of a tree with two branches and the trunk going on. Defaults to 10. |
10
|
branch_horizontal_length
|
int | tuple[int, int]
|
The length of a branch along x and z, or a range. Defaults to (2, 4). |
(2, 4)
|
branch_start_offset_from_top
|
int | tuple[int, int]
|
Where a branch starts, from the top of the tree, or a range. Defaults to (-4, -3). |
(-4, -3)
|
branch_end_offset_from_top
|
int | tuple[int, int]
|
Where a branch ends, from the top of the tree, or a range. Defaults to (-1, 0). |
(-1, 0)
|
fallen_trunk(trunk_block, log_length=(4, 7), stump_height=None, height_modifier=None, log_decoration_feature=None)
Sets a fallen log, with an optional stump.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trunk_block
|
str | Block | BlockDescriptor
|
The block of the log. |
required |
log_length
|
int | tuple[int, int]
|
The length of the log, or a range. Defaults to (4, 7). |
(4, 7)
|
stump_height
|
int | tuple[int, int]
|
The height of the stump, or a range. |
None
|
height_modifier
|
int | tuple[int, int]
|
Added to the length, or a range. |
None
|
log_decoration_feature
|
Feature | str
|
A feature that decorates the log. |
None
|
fancy_canopy(leaf_block, height=4, radius=4, sync_to_branches=True)
Sets the round canopy of a fancy oak.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
leaf_block
|
str | Block | BlockDescriptor
|
The block of the canopy. |
required |
height
|
int
|
The number of layers. At least 1. Defaults to 4. |
4
|
radius
|
int
|
The radius. At least 0. Defaults to 4. |
4
|
sync_to_branches
|
bool
|
Also grow it at the end of the trunk's branches. Defaults to True. |
True
|
fancy_trunk(trunk_block, trunk_width=1, base_height=5, height_variance=12, height_scale=0.618, branch_slope=0.381, branch_density=1.0, branch_min_altitude_factor=0.2, width_scale=1.0, foliage_altitude_factor=0.3)
Sets a tall trunk with many branches, like a fancy oak.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trunk_block
|
str | Block | BlockDescriptor
|
The block of the trunk. |
required |
trunk_width
|
int
|
The width of the trunk. At least 1. Defaults to 1. |
1
|
base_height
|
int
|
The least height. At least 1. Defaults to 5. |
5
|
height_variance
|
int
|
Added to the height at random. At least 1. Defaults to 12. |
12
|
height_scale
|
float
|
The height is multiplied by this, from 0 to 1. Defaults to 0.618. |
0.618
|
branch_slope
|
float
|
The slope of a branch: 0 is flat, 1 vertical. Defaults to 0.381. |
0.381
|
branch_density
|
float
|
How dense the foliage is. Defaults to 1. |
1.0
|
branch_min_altitude_factor
|
float
|
The lowest branch, as a share of the height, from 0 to 1. Defaults to 0.2. |
0.2
|
width_scale
|
float
|
Scales the radius of the tree. At least 0. Defaults to 1. |
1.0
|
foliage_altitude_factor
|
float
|
The lowest foliage, as a share of the height, from 0 to 1. Defaults to 0.3. |
0.3
|
mangrove_canopy(leaf_blocks, canopy_height=(3, 5), canopy_radius=(3, 5), leaf_placement_attempts=100, hanging_block=None, hanging_block_placement_chance=None, sync_to_branches=True)
Sets a canopy of leaves placed at random, with hanging blocks, like a mangrove.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
leaf_blocks
|
Sequence[tuple[str | Block | BlockDescriptor, float] | str | Block | BlockDescriptor]
|
The leaf blocks, with their weight; 1 for a block given alone. |
required |
canopy_height
|
int | tuple[int, int]
|
The number of layers, or a range. Defaults to (3, 5). |
(3, 5)
|
canopy_radius
|
int | tuple[int, int]
|
The radius, or a range. Defaults to (3, 5). |
(3, 5)
|
leaf_placement_attempts
|
int
|
How many times a leaf is tried. At least 1. Defaults to 100. |
100
|
hanging_block
|
str | Block | BlockDescriptor
|
The block hanging under the leaves. |
None
|
hanging_block_placement_chance
|
float | tuple[int, int]
|
The chance
of a hanging block: a number or a |
None
|
sync_to_branches
|
bool
|
Also grow it at the end of the trunk's branches. Defaults to True. |
True
|
mangrove_roots(root_block, muddy_root_block=None, max_root_width=5, max_root_length=15, y_offset=0, roots_may_grow_through=None, mud_block=None, above_root_block=None, above_root_chance=None)
Sets the roots of a mangrove.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root_block
|
str | Block | BlockDescriptor
|
The block of the roots. |
required |
muddy_root_block
|
str | Block | BlockDescriptor
|
The block of the roots in mud. |
None
|
max_root_width
|
int
|
The widest the roots get, growing down. At least 1. Defaults to 5. |
5
|
max_root_length
|
int
|
The longest a root gets. At least 1. Defaults to 15. |
15
|
y_offset
|
int
|
The offset of the roots from the trunk. Defaults to 0. |
0
|
roots_may_grow_through
|
Sequence[str | Block | BlockDescriptor]
|
The blocks roots can grow through. |
None
|
mud_block
|
str | Block | BlockDescriptor
|
The block where a muddy root is placed. |
None
|
above_root_block
|
str | Block | BlockDescriptor
|
A block placed on top of the roots. |
None
|
above_root_chance
|
float | tuple[int, int]
|
The chance of that block:
a number or a |
None
|
mangrove_trunk(trunk_block, trunk_width=1, base_height=5, height_rand_a=1, height_rand_b=1, branch_length=(2, 4), branch_steps=(1, 3), branch_chance=100.0)
Sets a trunk with branches, like a mangrove. Add roots with mangrove_roots().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trunk_block
|
str | Block | BlockDescriptor
|
The block of the trunk. |
required |
trunk_width
|
int
|
The width of the trunk. At least 1. Defaults to 1. |
1
|
base_height
|
int
|
The least height. At least 1. Defaults to 5. |
5
|
height_rand_a
|
int
|
The first height modifier. At least 1. Defaults to 1. |
1
|
height_rand_b
|
int
|
The second height modifier. At least 1. Defaults to 1. |
1
|
branch_length
|
int | tuple[int, int]
|
The length of a branch along y, or a range. Defaults to (2, 4). |
(2, 4)
|
branch_steps
|
int | tuple[int, int]
|
The number of branches, or a range. Defaults to (1, 3). |
(1, 3)
|
branch_chance
|
float | tuple[int, int]
|
The chance of a branch: a
number or a |
100.0
|
may_grow_on(blocks)
Sets the blocks the tree can grow on.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
Sequence[str | Block | BlockDescriptor]
|
The blocks. |
required |
may_grow_through(blocks)
Sets the blocks the tree can grow through.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
Sequence[str | Block | BlockDescriptor]
|
The blocks. |
required |
may_replace(blocks)
Sets the blocks the tree may replace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
Sequence[str | Block | BlockDescriptor]
|
The blocks. |
required |
mega_canopy(leaf_block, canopy_height=(4, 6), base_radius=4, core_width=2, simplify_canopy=False, sync_to_branches=True)
Sets the wide canopy of a mega tree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
leaf_block
|
str | Block | BlockDescriptor
|
The block of the canopy. |
required |
canopy_height
|
int | tuple[int, int]
|
The number of layers, or a range. Defaults to (4, 6). |
(4, 6)
|
base_radius
|
int
|
The radius. At least 0. Defaults to 4. |
4
|
core_width
|
int
|
The width of the trunk. At least 1. Defaults to 2. |
2
|
simplify_canopy
|
bool
|
Use a simpler pattern. Defaults to False. |
False
|
sync_to_branches
|
bool
|
Also grow it at the end of the trunk's branches. Defaults to True. |
True
|
mega_pine_canopy(leaf_block, canopy_height=(8, 12), base_radius=4, radius_step_modifier=0.5, core_width=2, sync_to_branches=True)
Sets the canopy of a mega spruce.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
leaf_block
|
str | Block | BlockDescriptor
|
The block of the canopy. |
required |
canopy_height
|
int | tuple[int, int]
|
The number of layers, or a range. Defaults to (8, 12). |
(8, 12)
|
base_radius
|
int
|
The radius. At least 0. Defaults to 4. |
4
|
radius_step_modifier
|
float
|
Changes the radius from layer to layer. At least 0. Defaults to 0.5. |
0.5
|
core_width
|
int
|
The width of the trunk. At least 1. Defaults to 2. |
2
|
sync_to_branches
|
bool
|
Also grow it at the end of the trunk's branches. Defaults to True. |
True
|
mega_trunk(trunk_block, trunk_width=2, base_height=15, height_intervals=None, height_modifier=None, branch_length=None, branch_slope=None, branch_interval=None, branch_altitude_factor=None)
Sets a wide trunk, like a mega jungle tree or a dark oak.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trunk_block
|
str | Block | BlockDescriptor
|
The block of the trunk. |
required |
trunk_width
|
int | tuple[int, int]
|
The width of the trunk, or a range. At least 1. Defaults to 2. |
2
|
base_height
|
int
|
The least height. At least 1. Defaults to 15. |
15
|
height_intervals
|
Sequence[int]
|
Each adds a random number below it to the height. |
None
|
height_modifier
|
int | tuple[int, int]
|
Added to the height, or a range. |
None
|
branch_length
|
int
|
The length of a branch. At least 1. |
None
|
branch_slope
|
float
|
The slope of a branch: 0 is flat, 1 vertical. |
None
|
branch_interval
|
int | tuple[int, int]
|
The distance between two branches, or a range. |
None
|
branch_altitude_factor
|
float | tuple[float, float]
|
Where branches grow, as a share of the height from 0 to 1, or a range. |
None
|
pine_canopy(leaf_block, canopy_height=(4, 5), base_radius=2, sync_to_branches=True)
Sets the canopy of a pine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
leaf_block
|
str | Block | BlockDescriptor
|
The block of the canopy. |
required |
canopy_height
|
int | tuple[int, int]
|
The number of layers, or a range. Defaults to (4, 5). |
(4, 5)
|
base_radius
|
int
|
The radius. At least 1. Defaults to 2. |
2
|
sync_to_branches
|
bool
|
Also grow it at the end of the trunk's branches. Defaults to True. |
True
|
poplar_canopy(leaf_block, radius=None, trunk_width=None, sync_to_branches=True)
Sets the canopy of a poplar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
leaf_block
|
str | Block | BlockDescriptor
|
The block of the canopy. |
required |
radius
|
Sequence[tuple[int, int]]
|
|
None
|
trunk_width
|
int
|
The width of the trunk. At least 1. |
None
|
sync_to_branches
|
bool
|
Kept for symmetry: a poplar canopy cannot grow on branches. Defaults to True. |
True
|
poplar_trunk(trunk_block, trunk_height=(5, 8), remaining_trunk_height_above_branches=None, amount_of_foliage_support_branches=None, height_modifier=None)
Sets a tall, thin trunk, like a poplar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trunk_block
|
str | Block | BlockDescriptor
|
The block of the trunk. |
required |
trunk_height
|
int | tuple[int, int]
|
The height, or a range. Defaults to (5, 8). |
(5, 8)
|
remaining_trunk_height_above_branches
|
int | tuple[int, int]
|
The height of the trunk above the branches, or a range. |
None
|
amount_of_foliage_support_branches
|
int
|
The number of branches that hold the foliage. |
None
|
height_modifier
|
int | tuple[int, int]
|
Added to the height, or a range. |
None
|
queue()
Queues the feature for export.
random_spread_canopy(leaf_blocks, canopy_height=(3, 5), canopy_radius=(3, 5), leaf_placement_attempts=100, sync_to_branches=True)
Sets a canopy of leaves placed at random, like an azalea.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
leaf_blocks
|
Sequence[tuple[str | Block | BlockDescriptor, float] | str | Block | BlockDescriptor]
|
The leaf blocks, with their weight; 1 for a block given alone. |
required |
canopy_height
|
int | tuple[int, int]
|
The number of layers, or a range. Defaults to (3, 5). |
(3, 5)
|
canopy_radius
|
int | tuple[int, int]
|
The radius, or a range. Defaults to (3, 5). |
(3, 5)
|
leaf_placement_attempts
|
int
|
How many times a leaf is tried. At least 1. Defaults to 100. |
100
|
sync_to_branches
|
bool
|
Kept for symmetry: a random spread canopy cannot grow on branches. Defaults to True. |
True
|
roofed_canopy(leaf_block, canopy_height=3, core_width=1, outer_radius=3, inner_radius=2, sync_to_branches=True)
Sets the flat, wide canopy of a dark oak.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
leaf_block
|
str | Block | BlockDescriptor
|
The block of the canopy. |
required |
canopy_height
|
int
|
The number of middle layers. At least 3. Defaults to 3. |
3
|
core_width
|
int
|
The width of the trunk. At least 1. Defaults to 1. |
1
|
outer_radius
|
int
|
The radius of the base and top layers. At least 0. Defaults to 3. |
3
|
inner_radius
|
int
|
The radius of the middle layers. At least 0. Defaults to 2. |
2
|
sync_to_branches
|
bool
|
Also grow it at the end of the trunk's branches. Defaults to True. |
True
|
root_decoration(decoration_chance, decoration_block=None, num_steps=None, step_direction=None)
Spreads blocks from the mangrove roots. Set the roots first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
decoration_chance
|
float | tuple[int, int]
|
The chance of a decoration: a
number or a |
required |
decoration_block
|
str | Block | BlockDescriptor
|
The block placed. |
None
|
num_steps
|
int
|
How many blocks are placed. |
None
|
step_direction
|
Literal['down', 'up', 'out', 'away']
|
The direction the blocks spread in. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
When the tree has no mangrove roots. |
spruce_canopy(leaf_block, lower_offset=(0, 0), upper_offset=(0, 0), max_radius=(2, 3), sync_to_branches=True)
Sets the canopy of a spruce.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
leaf_block
|
str | Block | BlockDescriptor
|
The block of the canopy. |
required |
lower_offset
|
int | tuple[int, int]
|
The lowest layer, or a range. Defaults to (0, 0). |
(0, 0)
|
upper_offset
|
int | tuple[int, int]
|
The highest layer, or a range. Defaults to (0, 0). |
(0, 0)
|
max_radius
|
int | tuple[int, int]
|
The largest radius, or a range. Defaults to (2, 3). |
(2, 3)
|
sync_to_branches
|
bool
|
Also grow it at the end of the trunk's branches. Defaults to True. |
True
|
trunk(trunk_block, trunk_height=(4, 7), height_modifier=None, can_be_submerged=None)
Sets a straight trunk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trunk_block
|
str | Block | BlockDescriptor
|
The block of the trunk. |
required |
trunk_height
|
int | tuple[int, int]
|
The height, or a range it is picked from. Defaults to (4, 7). |
(4, 7)
|
height_modifier
|
int | tuple[int, int]
|
Added to the height, or a range it is picked from. |
None
|
can_be_submerged
|
bool | int
|
Whether the trunk can grow under water; a number is the greatest depth, at least 1. |
None
|
trunk_decoration(decoration_chance, decoration_block=None, num_steps=None, step_direction=None)
Spreads blocks from the trunk, such as vines. Set the trunk first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
decoration_chance
|
float | tuple[int, int]
|
The chance of a decoration: a
number or a |
required |
decoration_block
|
str | Block | BlockDescriptor
|
The block placed. |
None
|
num_steps
|
int
|
How many blocks are placed. |
None
|
step_direction
|
Literal['down', 'up', 'out', 'away']
|
The direction the blocks spread in. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
When the tree has no trunk, or its trunk has no decorations (cherry, fancy and poplar trunks). |
anvil.api.features.vegetation_patch
The minecraft:vegetation_patch_feature.
VegetationPatchFeature
Bases: Feature[_VegetationPatchFeatureFile]
Places a patch of ground blocks and a vegetation feature on it, such as moss.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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 vegetation patch feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. |
required |
ground_block
|
str | Block | BlockDescriptor
|
The block the patch is made of. |
required |
vegetation_feature
|
Feature | str
|
The feature placed on the patch. |
required |
depth
|
float | tuple[float, float]
|
How deep the ground blocks go, or a range it is picked from. |
required |
vertical_range
|
int
|
How far up or down a surface is searched for. |
required |
horizontal_radius
|
float | tuple[float, float]
|
The radius of the patch, or a range it is picked from. |
required |
surface
|
Literal['floor', 'ceiling']
|
Whether the patch grows on the floor or the ceiling. Defaults to "floor". |
'floor'
|
extra_deep_block_chance
|
float
|
The chance the ground goes one block deeper, from 0 to 1. |
None
|
vegetation_chance
|
float
|
The chance vegetation is placed on a ground block, from 0 to 1. |
None
|
extra_edge_column_chance
|
float
|
The chance vegetation is placed on the edge of the patch. At least 0. |
None
|
waterlogged
|
bool
|
Waterlog the positions of the ground blocks. Defaults to False. |
False
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
queue()
Queues the feature for export.
replaceable_blocks(blocks)
Sets the blocks the ground blocks may replace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
Sequence[str | Block | BlockDescriptor]
|
The blocks. |
required |
anvil.api.features.weighted_random
The minecraft:weighted_random_feature.
WeightedRandomFeature
Bases: Feature[_WeightedRandomFeatureFile]
Places one feature, picked at random by weight.
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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)
Creates the feature file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the feature, also its file name. The identifier is
|
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
When |
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
add_feature(feature, weight=1.0)
Adds a feature that can be picked.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature
|
Feature | str
|
The feature, or its identifier. |
required |
weight
|
float
|
Its weight, relative to the others. Defaults to 1. |
1.0
|
features(feature_list)
Adds features that can be picked.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature_list
|
Sequence[tuple[Feature | str, float]]
|
|
required |
queue()
Queues the feature for export.