Skip to content

Features

src.anvil.api.features

CameraPreset

Bases: AddonObject

A class representing a CameraPreset.

__init__(name, inherit_from)

Initializes a CameraPreset instance.

Parameters:

Name Type Description Default
name str

The name of the camera preset.

required
is_vanilla bool

Whether the camera preset is a vanilla camera preset. Defaults to False.

required

extend_player_rendering(value=True)

Sets whether the player rendering is extended.

Parameters:

Name Type Description Default
value bool

Whether the player rendering is extended.

True

listener(value)

Sets whether the listener is enabled.

Parameters:

Name Type Description Default
value bool

Whether the listener is enabled.

required

player_effects(value)

Sets whether the player effects are enabled.

Parameters:

Name Type Description Default
value bool

Whether the player effects are enabled.

required

position(x=0, y=0, z=0)

Sets the position of the camera preset.

Parameters:

Name Type Description Default
x float

The x position of the camera preset.

0
y float

The y position of the camera preset.

0
z float

The z position of the camera preset.

0

queue()

Queues the camera preset to be exported.

rotation(x=0, y=0)

Sets the rotation of the camera preset.

Parameters:

Name Type Description Default
x float

The x rotation of the camera preset.

0
y float

The y rotation of the camera preset.

0

Fog

Bases: AddonObject

A class representing a Fog.

__init__(name, is_vanilla=False)

Initializes a Fog instance.

Parameters:

Name Type Description Default
name str

The name of the fog.

required
is_vanilla bool

Whether the fog is a vanilla fog. Defaults to False.

False

add_distance_location(camera_location=FogCameraLocation.Air)

Adds a distance location to the fog.

Parameters:

Name Type Description Default
camera_location FogCameraLocation

The camera location of the fog. Defaults to FogCameraLocation.Air.

Air

queue()

Queues the fog to be exported.

Fonts

A class representing a Fonts.

queue property

Queues the font to be exported.

__init__(font_name, character_size=32)

Initializes a Fonts instance.

Parameters:

Name Type Description Default
font_name str

The name of the font.

required
character_size int

The size of the character. Defaults to 32.

32

generate_font()

Generates a default8 font image

generate_numbers_particle()

Generates a numbers particle from 0 to 999.

Function

Bases: AddonObject

add_to_setup property

Adds the function to the setup function. Meaning this will run when your execute your setup function.

execute property

Returns the execute command of the function.

path property

Gets the path of the function. To use this properly, the function must be queued.

tick property

Adds the function to the tick.json file.

__init__(name)

Inintializes the Function class. The function is limited to 10000 commands. If you exceed this limit, the function will be split into multiple functions.

Parameters:

Name Type Description Default
name str

The name of the function.

required

__len__()

Returns the number of commands in the function.

add(*commands)

Adds a command to the function.

queue(directory=None)

Queues the function to be exported.

Parameters:

Name Type Description Default
directory str

The directory to queue the function to. Defaults to None.

None

LootTable

Bases: AddonObject

A class representing a LootTable.

__init__(name)

Initializes a LootTable instance.

Parameters:

Name Type Description Default
name str

The name of the LootTable.

required

SkinPack

Bases: AddonObject

__init__()

Initializes a SkinPack instance.

add_skin(filename, display_name, is_slim=False, free=False)

Adds a skin to the SkinPack.

Parameters:

Name Type Description Default
filename str

The filename of the skin.

required
display_name str

The display name of the skin.

required
is_slim bool

Whether the skin is slim. Defaults to False.

False
free bool

Whether the skin is free. Defaults to False.

False

Structure

A class representing a Structure.

identifier: Identifier property

Returns the identifier of the structure.

queue property

Queues the structure to be exported.

__init__(structure_name)

Initializes a Structure instance.

Parameters:

Name Type Description Default
structure_name str

The name of the structure.

required