World - Structures Module
anvil.api.world.structures
JigsawStructureSet
Bases: JsonFile[_StructureSetFile]
A structure set: jigsaw structures, picked by weight, and how they spread in the world relative to other structures of the same set.
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, separation, spacing, spread_type='linear')
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. Must be less than half of |
required |
spacing
|
int
|
Grid cell size (in chunks). Structures will attempt to generate at a random position within each cell. |
required |
spread_type
|
Literal['linear', 'triangular']
|
How the position is picked in each cell. Defaults to "linear". |
'linear'
|
__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_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 set. The arguments are the jigsaw structure's,
see _JigsawStructure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure_name
|
str
|
The name of the jigsaw structure. |
required |
weight
|
int
|
Its weight in the set, at least 1. Defaults to 1. |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
_JigsawStructure |
'_JigsawStructure'
|
The jigsaw structure, queued with the set. |
JigsawStructureTemplatePool
Bases: JsonFile[_TemplatePoolFile]
A template pool: structure templates, features or nothing, picked by weight when a jigsaw block asks for this pool.
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, fallback=None)
Initializes a JigsawStructureTemplatePool instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the template pool. |
required |
fallback
|
str
|
The identifier of the template pool used when no element of this one fits. Defaults to None. |
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_structure_element(structure, processors=None, weight=1, projection='rigid')
Adds an element to the template pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure
|
Structure | Feature | str | None
|
The structure template (a path in
|
required |
processors
|
str | _JigsawStructureProcess
|
The processor list run on a structure template. A name creates the processor list. Defaults to None. |
None
|
weight
|
int
|
The element's weight, from 1 to 200. Defaults to 1. |
1
|
projection
|
Literal['rigid', 'terrain_matching']
|
How a structure template follows the terrain. Defaults to "rigid". |
'rigid'
|
Returns:
| Type | Description |
|---|---|
_JigsawStructureProcess | None
|
_JigsawStructureProcess | None: The processor list, queued with the pool. |
Structure
A structure template (.mcstructure) from assets/structures, copied to the
behavior pack's structures/<namespace> folder.
identifier
property
Returns the identifier of the structure.
reference
property
The structure's path in the behavior pack's structures folder, without its
extension, as template pools reference it.
__export__()
Exports the structure to the file system.
__init__(structure_name)
Initializes a Structure instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure_name
|
str
|
The structure's path in |
required |
queue()
Queues the structure to be exported.