Skip to content

Core

src.anvil.lib.core._AnvilDefinitions

add_material(material_name, base_material=None)

Adds a material to the materials.json file.

Parameters:

Name Type Description Default
material_name str

The name of the material.

required
base_material str

The name of the base material. Defaults to None.

None

register_block(block_identifier, block_data)

Registers blocks.

Parameters:

Name Type Description Default
blocks dict

The blocks to register.

required

register_block_sound_event()

TO IMPLEMENT

Registers a block sound event.

register_lang(key, value)

Adds a localized string to en_US. Translatable.

register_music(music_category, min_delay=60, max_delay=180)

Adds a music to the music definition.

Parameters:

Name Type Description Default
music_category MusicCategory

The category of the music.

required
min_delay int

The min delay of the music. Defaults to 60.

60
max_delay int

The max delay of the music. Defaults to 180.

180

register_scores(**score_id_value)

Adds the provided scores to the setup functions as well as setting the global score values. Score objective must be 16 characters or less.

Parameters:

score_id_value : kwargs The score and it's initial value.

Examples:

ANVIL.score(player_id=0,test=4) ANVIL.score(**{'level':5,'type':1})

register_sound_definition(sound_reference, category, use_legacy_max_distance=False, max_distance=0, min_distance=9999)

Adds a sound to the sound definition.

Parameters:

Name Type Description Default
sound_reference str

The name of the sound definition.

required
category SoundCategory

The category of the sound.

required
use_legacy_max_distance bool

Whether to use legacy max distance. Defaults to False.

False
max_distance int

The max distance of the sound. Defaults to 0.

0
min_distance int

The min distance of the sound. Defaults to 9999.

9999

register_tag(*tags)

Registers tags.

Parameters:

Name Type Description Default
tags str

The tags to register.

()

register_terrain_texture(texture_name, texture_path, *block_textures)

Registers a terrain texture.

Parameters:

Name Type Description Default
texture_name str

The name of the texture.

required
texture_path str

The path to the texture.

required

src.anvil.lib.core._AnvilCore

__init__(config)

Initializes an Anvil instance.

Parameters:

Name Type Description Default
config _Config

The config of the Anvil instance.

required
logger Logger

The logger of the Anvil instance.

required

compile()

Compiles the project.

require_config(*options)

Checks if the config has the required options.

Parameters:

Name Type Description Default
options str

The options to check.

()

translate()

Translates en_US to all supported Minecraft languages. This is a time consuming function, it will be executed with anvil.package(), so it's better to avoid it unless you really want to use it.

src.anvil.lib.core._Anvil

Bases: _AnvilCore

A class representing an Anvil instance.

compile()

Compiles the project.

generate_technical_notes()

Generates a technical notes PDF that contains information about included entities, blocks, items, sounds and more.

mcaddon()

Packages the project into a .mcaddon file.

mcworld()

Packages the project into a .mcworld file.

package_zip(skip_translation=False, apply_overlay=False)

Packages the project into a zip file for Marketplace.

require_config(*options)

Checks if the config has the required options.

Parameters:

Name Type Description Default
options str

The options to check.

()

translate()

Translates en_US to all supported Minecraft languages. This is a time consuming function, it will be executed with anvil.package(), so it's better to avoid it unless you really want to use it.