Skip to content

Dimension - Components

anvil.api.dimension.components

The dimension components, added to DimensionConfiguration.components.

DimensionClouds

Bases: DimensionComponent

Sets the cloud height of the dimension.

Parameters:

Name Type Description Default
height int

The Y coordinate of the clouds, from -512 to 512. Game default 128.

required

__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 component as {identifier: payload}.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__payload_schema__(definitions) classmethod

The schema of the payload under the identifier.

__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 {identifier: payload}.

__validate__()

Cross-field checks, run on export after the fields are checked.

DimensionComponent

Bases: JsonComponent

Base class of the dimension components, added to DimensionConfiguration.components.

__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 component as {identifier: payload}.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__payload_schema__(definitions) classmethod

The schema of the payload under the identifier.

__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 {identifier: payload}.

__validate__()

Cross-field checks, run on export after the fields are checked.

DimensionDefaultBiome

Bases: DimensionComponent

Sets the biome used throughout the dimension.

Parameters:

Name Type Description Default
biome str

The namespaced identifier of the biome. Game default minecraft:ocean.

required

__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 component as {identifier: payload}.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__payload_schema__(definitions) classmethod

The schema of the payload under the identifier.

__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 {identifier: payload}.

__validate__()

Cross-field checks, run on export after the fields are checked.

DimensionGeneration

Bases: DimensionComponent

Sets how the terrain of the dimension is generated. Only the void generator exists.

Parameters:

Name Type Description Default
generator_type Literal['void']

The world generator.

required

__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 component as {identifier: payload}.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__payload_schema__(definitions) classmethod

The schema of the payload under the identifier.

__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 {identifier: payload}.

__validate__()

Cross-field checks, run on export after the fields are checked.

DimensionHeight

Bases: DimensionComponent

Sets the vertical bounds of the dimension. Already generated terrain is not reshaped, only cut off at the new bounds.

Parameters:

Name Type Description Default
min_y int

The lowest block height, from -512 to 512. Game default -64.

required
height_range int

The total height, a multiple of 16 from 16 to 1024. Game default 384.

required

__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 component as {identifier: payload}.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__payload_schema__(definitions) classmethod

The schema of the payload under the identifier.

__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 {identifier: payload}.