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. |
__init__(name, separation=4, spacing=10, 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. |
4
|
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. |
10
|
spread_type
|
Literal['linear', 'triangle']
|
Randomness algorithm used when placing structures. |
'linear'
|
placement_type (Literal["minecraft
|
random_spread"]): Describes where structures in the set spawn relative to one another. Currently, the only placement type supported is random_spread, which scatters structures randomly with a given separation and spacing. |
required |
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. |
do_not_shorten()
Setter property that disables shortening of dict
when exporting.
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. |
__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_name, weight=1, projection='minecraft:rigid')
Adds a structure to the template pool.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
structure
|
str | Structure | None
|
The structure to add to the pool. |
required |
weight
|
int
|
The weight of the structure. Defaults to 1. |
1
|
processors_name
|
str
|
The name of the processors for the structure. Defaults to None. |
required |
projection (Literal["minecraft
|
rigid", "minecraft:terrain_matching"], optional): The projection type. Defaults to "minecraft:rigid". |
required |
content(content)
Sets the content of the addon object and returns the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
content
|
any
|
The content to be set for the addon object. |
required |
Returns:
Name | Type | Description |
---|---|---|
self |
AddonObject
|
The instance of the current AddonObject. |
do_not_shorten()
Setter property that disables shortening of dict
when exporting.
Structure
A class representing a Structure.
identifier
property
Returns the identifier of the structure.
reference
property
Returns the reference path of the structure.
__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.