Sounds - Music Definitions
anvil.api.sounds.music_definitions
The resource pack's sounds/music_definitions.json: the music played in each
situation.
MusicDefinition
Bases: JsonFile[_MusicDefinitionsFile]
The music definitions of the resource pack, sounds/music_definitions.json: the
music played for each music category. There is one per pack.
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__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. |
music_definition(music_reference, min_delay=60, max_delay=180, server_sound=None)
Defines the music of a music category, played as the sound
<namespace>:music.<music_reference>.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
music_reference
|
MusicCategory | str
|
The music category. |
required |
min_delay
|
int
|
The shortest wait between two tracks, in seconds. Defaults to 60. |
60
|
max_delay
|
int
|
The longest wait between two tracks, in seconds. Defaults to 180. |
180
|
server_sound
|
MusicInfo
|
Also registers the music in the behavior pack's server sound definitions. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
_SoundDescription |
_SoundDescription
|
The music's sound definition; add its files with |
queue()
Queues the music definitions for export.