Blocks - blocks.json
anvil.api.blocks.blocks_json
The resource pack's blocks.json: the sound group of each block.
BlocksJSONObject
Bases: JsonFile[_BlocksJsonFile]
The resource pack's blocks.json, which gives blocks their sound group. There is
one per pack.
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.
__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_block(block, sound_group=None)
Adds the block to blocks.json. Its sound is the block's own sound group, the
one the custom block sound events define, unless sound_group names another (a
vanilla one like BlockSoundGroup.Wood).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
str
|
The block identifier. |
required |
sound_group
|
BlockSoundGroup | str
|
The sound group. |
None
|
queue()
Queues blocks.json for export, when it has a block.