Skip to content

World - Structures Module

anvil.api.world.structures

JigsawStructureSet

Bases: AddonObject

A class representing a Structure Set in Minecraft. A Structure Set contains a set of Jigsaw Structures and rules for how those structures should be placed in the world relative to other instances of structures from the same set. Each structure within a set is paired with a weight that influences how frequently it is chosen.

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, separation, spacing, spread_type='linear', placement_type='minecraft:random_spread')

Initializes a JigsawStructureSet instance.

Parameters:

Name Type Description Default
name str

The name of the structure set.

required
separation int

Padding (in chunks) within each grid cell. Structures will not generate within the padded area.

required
spacing int

Grid cell size (in chunks) to use when generating the structure. Structures will attempt to generate at a random position within each cell.

required
spread_type str

Randomness algorithm used when placing structures ("linear" or "triangle"). Defaults to "linear".

'linear'
placement_type str

Describes where structures in the set spawn relative to one another. Defaults to "minecraft:random_spread".

'minecraft:random_spread'

add_jigsaw_structure(structure_name, start_pool, max_depth, start_height, placement_step, weight=1, start_jigsaw_name=None, liquid_settings='apply_waterlogging', start_height_from_sea=False)

Adds a jigsaw structure to the structure set.

Parameters:

Name Type Description Default
structure_name str

The name of the jigsaw structure to add.

required
weight int

The weight of the structure in the set. Defaults to 1.

1

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.

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

JigsawStructureTemplatePool

Bases: AddonObject

A class representing a Structure Template Pool in Minecraft.

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, fallback=None)

Initializes a JigsawStructureTemplatePool instance.

Parameters:

Name Type Description Default
name str

The name of the template pool.

required
fallback str

The fallback structure for the pool. Defaults to None.

None

add_structure_element(structure, processors=None, weight=1, projection='rigid')

Adds a structure to the template pool.

Parameters:

Name Type Description Default
structure str | Structure | Feature | None

The structure to add to the pool.

required
weight int

The weight of the structure. Defaults to 1.

1
processors str | _JigsawStructureProcess | None

The processors for the structure. Defaults to None.

None
projection str

The projection type ("rigid" or "terrain_matching"). Defaults to "rigid".

'rigid'

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.

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

Structure

A class representing a Structure.

identifier property

Returns the identifier of the structure.

reference property

Returns the reference path of the structure.

__export__()

Exports the structure to the file system.

__init__(structure_name)

Initializes a Structure instance.

Parameters:

Name Type Description Default
structure_name str

The name of the structure.

required

queue()

Queues the structure to be exported.