Skip to content

Actors API

anvil.api.actors

BPAnimationControllers

Bases: _AnimationControllers[_BPAnimationControllersFile]

The behavior pack animation controllers of an entity.

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__(source)

Creates the behavior pack animation controllers file of an entity, at export.

Parameters:

Name Type Description Default
source _EntityServerDescription

The entity's description, which holds the controllers.

required

__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.

queue(directory=None)

Queues the controllers for export, when the actor has any.

BPAnimations

Bases: JsonFile[_BPAnimationsFile]

The behavior pack animations of an entity, written when it has any. The entity's description holds them (entity.server.description.animation() adds them); the file writes them.

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__(source)

Creates the animations file of an entity.

Parameters:

Name Type Description Default
source _EntityServerDescription

The entity's description, which holds the animations.

required

__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.

queue(directory=None)

Queues the animations for export, when the entity has any.

RPAnimationControllers

Bases: _AnimationControllers[_RPAnimationControllersFile]

The resource pack animation controllers of an entity or attachable.

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__(source)

Creates the resource pack animation controllers file of an actor, at export.

Parameters:

Name Type Description Default
source _ActorClientDescription

The actor's client description, which holds the controllers.

required

__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.

queue(directory=None)

Queues the controllers for export, when the actor has any.

RenderControllers

Bases: JsonFile[_RenderControllersFile]

The render controllers of an entity or attachable, built at export from its client description, which holds them (render_controller() adds them).

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__(source)

Creates the render controllers file of an actor, at export.

Parameters:

Name Type Description Default
source _ActorClientDescription

The actor's client description, which holds the render controllers.

required

__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.

queue(directory='')

Queues the render controllers for export, when the actor has any.

SpawnRule

Bases: JsonFile[_SpawnRulesFile]

An entity's spawn rules: its population pool and the conditions it spawns under. Written only when it has conditions.

Documentation reference

add_condition property

Adds a set of conditions the entity spawns under, and returns it. Each set is another way to spawn, such as on the surface or underground.

description property

The description builders, such as set_population_control.

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__(identifier, is_vanilla=False)

Creates the spawn rules of an entity.

Parameters:

Name Type Description Default
identifier str

The entity identifier, such as mypack:custom_mob.

required
is_vanilla bool

If the entity is a vanilla one.

False

__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.

queue(directory=None)

Queues the spawn rules for export, when they have conditions.

Parameters:

Name Type Description Default
directory str

The folder inside spawn_rules.

None