Skip to content

src.anvil.api.actors._ActorDescription

Bases: MinecraftDescription

Base class for all actor descriptions.

__init__(name, is_vanilla=False)

Base class for all actor descriptions.

Parameters:

Name Type Description Default
name str

The name of the actor.

required
is_vanilla bool

Whether or not the actor is a vanilla actor. Defaults to False.

False

src.anvil.api.actors._ActorClientDescription

Bases: _ActorDescription

__init__(name, is_vanilla=False)

Base class for all client actor descriptions.

Parameters:

Name Type Description Default
name str

The name of the actor.

required
is_vanilla bool

Whether or not the actor is a vanilla actor. Defaults to False.

False
type str

The type of the actor. Defaults to "entity".

required

animation(blockbench_name, animation_name, animate=False, condition=None)

Sets the mapping of internal animation references to actual animations.

Parameters:

Name Type Description Default
animation_name str

The name of the animation.

required
animate bool

Whether or not to animate the animation. Defaults to False.

False
condition str | Molang

The condition to animate the animation. Defaults to None.

None

animation_controller(controller_shortname, animate=False, condition=None)

Sets the mapping of internal animation controller references to actual animations.

Parameters:

Name Type Description Default
controller_shortname str

The name of the animation controller.

required
animate bool

Whether or not to animate the animation controller. Defaults to False.

False
condition str | Molang

The condition to animate the animation controller. Defaults to None.

None

dummy()

This method manages the dummy for an entity.

geometry(geometry_name)

This method manages the geometry for an entity.

Parameters:

Name Type Description Default
geometry_name str

The name of the geometry.

required

Returns:

Name Type Description
self

Returns an instance of the class.

init_vars(**vars)

Initializes variables for an entity.

Examples:

>>> Entity("example").init_vars(x=0, y=5, z=8)

material(material_id, material_name)

This method manages the materials for an entity.

Parameters:

Name Type Description Default
material_id str

The id of the material.

required
material_name str

The name of the material.

required

particle_effect(particle_name)

This method manages the particle effects for an entity.

Parameters:

Name Type Description Default
particle_name str

The name of the particle effect.

required

queryable_geometry(geometry_shortname)

This method manages the queryable geometry for an entity.

Parameters:

Name Type Description Default
geometry_shortname str

The shortname of the geometry.

required

render_controller(controller_name, condition=None)

This method manages the render controllers for an entity.

Parameters:

Name Type Description Default
controller_name str

The name of the render controller.

required
condition str

The condition to render the render controller. Defaults to None.

None

scale(scale='1')

Sets the scale of the entity.

Parameters:

Name Type Description Default
scale str | Molang

The scale of the entity. Defaults to "1".

'1'

scaleXYZ(x='1', y='1', z='1')

Sets the scale of the entity.

Parameters:

Name Type Description Default
x str | Molang

The x scale of the entity. Defaults to "1".

'1'
y str | Molang

The y scale of the entity. Defaults to "1".

'1'
z str | Molang

The z scale of the entity. Defaults to "1".

'1'

script(variable, script)

This method manages the scripts for an entity.

should_update_bones_and_effects_offscreen(bool=False)

Sets whether or not the entity should update bones and effects offscreen.

Parameters:

Name Type Description Default
bool bool

Whether or not the entity should update bones and effects offscreen. Defaults to False.

False

should_update_effects_offscreen(bool=False)

Sets whether or not the entity should update effects offscreen.

Parameters:

Name Type Description Default
bool bool

Whether or not the entity should update effects offscreen. Defaults to False.

False

sound_effect(sound_name, sound_reference, category=SoundCategory.Neutral, max_distance=0, min_distance=9999)

This method manages the sound effects for an entity.

Parameters:

Name Type Description Default
sound_shortname str

The shortname of the sound effect.

required
sound_reference str

The identifier of the sound effect.

required
category SoundCategory

The category of the sound effect. Defaults to SoundCategory.Neutral.

Neutral

sound_event(sound_reference, sound_event, category=SoundCategory.Neutral, volume=1.0, pitch=(0.8, 1.2), max_distance=0, min_distance=9999)

This method manages the sound events for an entity.

Parameters:

Name Type Description Default
sound_reference _type_

The identifier of the sound effect.

required
sound_event EntitySoundEvent

The sound event.

required
category SoundCategory

The category of the sound effect. Defaults to SoundCategory.Neutral.

Neutral
volume float

The volume of the sound effect. Defaults to 1.0.

1.0
pitch tuple[float, float]

The pitch of the sound effect. Defaults to (0.8, 1.2).

(0.8, 1.2)

texture(blockbench_name, texture_name)

This method manages the textures for an entity.

Parameters:

Name Type Description Default
blockbench_name str

The name of the texture.

required
texture_name str

The name of the texture.

required

to_dict(directory=None)

Queues the entity for export.

Parameters:

Name Type Description Default
directory str

The directory to export the entity to. Defaults to None.

None

Raises:

Type Description
RuntimeError

If the entity does not have a geometry, texture, or render controller.

Exception

If a geometry is reused but the entity it is reused from has not been queued yet.

src.anvil.api.actors._RenderController

src.anvil.api.actors._RenderControllers

Bases: AddonObject

src.anvil.api.actors._RP_ControllerState

blend_via_shortest_path property

When blending a transition to another state, animate each euler axis through the shortest rotation, instead of by value.

Returns
This state.

animation(animation, condition=None)

Animation short name to play during this state.

Parameters

animation : str The name of the animation to play. condition : str , optional The condition on which this animation plays.

Returns
This state.

blend_transition(blend_value)

Sets the amount of time to fade out if the animation is interrupted.

Parameters

blend_value : float Blend out time.

Returns
This state.

on_entry(*commands)

Molang to preform on entry of this state.

Parameters

commands : str param commands: Molang to preform on entry of this state.

Returns
This state.

on_exit(*commands)

Molang to preform on exit of this state.

Parameters

commands : str param commands: Molang to preform on exit of this state.

Returns
This state.

particle(effect, locator='root', pre_anim_script=None, bind_to_actor=True)

The effect to be emitted during this state.

Parameters

effect : str The shortname of the particle effect to be played, defined in the Client Entity. locator : str The name of a locator on the actor where the effect should be located. pre_anim_script : str , optional A molang script that will be run when the particle emitter is initialized. bind_to_actor : bool , optional Set to false to have the effect spawned in the world without being bound to an actor.

Returns
This state.

sound_effect(effect)

Collection of sounds to trigger on entry to this animation state.

Parameters

effect : str The shortname of the sound effect to be played, defined in the Client Entity.

Returns
This state.

transition(state, condition)

Target state to switch to and the condition to do so.

Parameters

state : str The name of the state to transition to. condition : str The condition that must be met for the transition to occur.

Returns
This state.

src.anvil.api.actors._RP_Controller

src.anvil.api.actors._RP_AnimationControllers

Bases: AddonObject

add_controller(controller_shortname)

Adds a new animation controller to the current actor with default as the initial_state.

Parameters

controller_shortname : str The shortname of the controller you want to add.

Returns
Animation controller.

Entities

src.anvil.api.actors._BP_ControllerState

animation(animation, condition=None)

Animation short name to play during this state.

Parameters

animation : str The name of the animation to play. condition : str , optional The condition on which this animation plays.

Returns
This state.

on_entry(*commands)

Events, commands or molang to preform on entry of this state.

Parameters

commands : str param commands: The Events, commands or molang to preform on entry of this state.

Returns
This state.

on_exit(*commands)

Events, commands or molang to preform on exit of this state.

Parameters

commands : str param commands: The Events, commands or molang to preform on exit of this state.

Returns
This state.

transition(state, condition)

Target state to switch to and the condition to do so.

Parameters

state : str The name of the state to transition to. condition : str The condition that must be met for the transition to occur.

Returns
This state.

src.anvil.api.actors._BP_Controller

src.anvil.api.actors._BP_AnimationControllers

Bases: AddonObject

add_controller(controller_shortname)

Adds a new animation controller to the current actor with default as the initial_state.

Parameters

controller_shortname : str The shortname of the controller you want to add.

Returns
Animation controller.

src.anvil.api.actors._BPAnimation

anim_time_update(anim_time_update)

Parameters

anim_time_update : int The length of the animation in seconds.

Returns
This animation.

animation_length(animation_length)

This function sets the length of the animation.

Parameters

animation_length : int The length of the animation in seconds.

Returns
This animation.

timeline(timestamp, *commands)

Takes a timestamp and a list of events, command or molang to run at that time.

Parameters

timestamp : int The timestamp of the event. commands : str param commands: The Events, commands or molang to run on exit of this state.

Returns
This animation.

src.anvil.api.actors._BPAnimations

Bases: AddonObject

add_animation(animation_short_name, loop=False)

Adds a new animation to the current actor.

Parameters

animation_short_name : str The shortname of the animation you want to add. loop : bool, optional If the animation should loop or not.

Returns
Animation.

src.anvil.api.actors._SpawnRuleDescription

Bases: MinecraftDescription

population_control(population)

Setting an entity to a pool it will spawn as long as that pool hasn't reached the spawn limit.

Parameters

population : Population Population Control Animal, UnderwaterAnimal, Monster, Ambient

Returns
Spawn Rule

src.anvil.api.actors._Condition

DisallowSpawnsInBubble property

Prevents this mob from spawning in water bubbles.

Returns
Spawn rule condition.

SpawnInLava property

Sets the actor to spawn in lava.

Returns
Spawn rule condition.

SpawnOnSurface property

Sets the actor to spawn on surfaces.

Returns
Spawn rule condition.

SpawnUnderground property

Sets the actor to spawn underground.

Returns
Spawn rule condition.

SpawnUnderwater property

Sets the actor to spawn underwater.

Returns
Spawn rule condition.

BiomeFilter(filter)

Specifies which biomes the mob spawns in.

Parameters

filter : dict Filter dict

Returns
Spawn rule condition.

BrightnessFilter(min_brightness=0, max_brightness=15, adjust_for_weather=True)

This function filters the image by brightness

Parameters

min_brightness : int The minimum light level value that allows the mob to spawn. Allowed range is (0,15) max_brightness : int The maximum light level value that allows the mob to spawn. Allowed range is (0,15) adjust_for_weather : bool, optional This determines if weather can affect the light level conditions that cause the mob to spawn (e.g. Allowing hostile mobs to spawn during the day when it rains.)

Returns
Spawn rule condition.

DelayFilter(minimum, maximum, identifier, spawn_chance)

Unknown behavior.

Parameters

minimum : int The minimum time required to use. maximum : int The maximum time required to use identifier : str The * identifier. spawn_chance : int This is spawn chance. range of (0-100)

Returns
Spawn rule condition.

DensityLimit(surface=-1, underground=-1)

Sets the density limit number of this mob type to spawn.

Parameters

surface : int The maximum number of mob of this mob type spawnable on the surface. -1 for an unlimited number. underground : int The maximum number of mob of this mob type spawnable underground. -1 for an unlimited number.

Returns
Spawn rule condition.

DifficultyFilter(min_difficulty=Difficulty.Easy, max_difficulty=Difficulty.Hard)

Sets the range of difficulties this mob type should spawn in.

Parameters

min_difficulty : Difficulty The minimum difficulty level that this mob spawns in. max_difficulty : Difficulty The maximum difficulty level that this mob spawns in.

Returns
Spawn rule condition.

DistanceFilter(min, max)

Specifies the distance range from a player this mob spawn in.

Parameters

min : int The minimum distance from a player that allows the mob to spawn. max : int The maximum distance from a player that allows the mob to spawn.

Returns
Spawn rule condition.

HeightFilter(min, max)

Specifies the height range this mob spawn in.

Parameters

min : int The minimum height that allows the mob to spawn. max : int The maximum height that allows the mob to spawn.

Returns
Spawn rule condition.

Herd(min_size=1, max_size=4, spawn_event=None, event_skip_count=0)

Determines the herd size of this mob.

Parameters

min_size : int The minimum number of mobs of this type that can spawn in the herd. max_size : int The maximum number of mobs of this type that can spawn in the herd. spawn_event : str, optional This is an event that can be triggered from spawning. event_skip_count : int, optional This is the number of mobs spawned before the Specifies event is triggered.

Returns
Spawn rule condition.

MobEventFilter(event)

Specifies the event to call on spawn.

Parameters

event : str The event to call.

Returns
Spawn rule condition.

PermuteType(entity_type, weight=10, spawn_event=None)

Sets a chance to mutate the spawned entity into another.

Parameters

entity_type : str The entity identifier. weight : str The weight of permutation. spawn_event : str, optional The event to call on the entity spawning.

Returns
Spawn rule condition.

PlayerInVillageFilter(distance, village_border_tolerance)

Specifies the distance range the player must be from a village for this entity to spawn.

Parameters

distance : int The distance from the village. village_border_tolerance : int The distance tolerance from the village borders.

Returns
Spawn rule condition.

SpawnEvent(event='minecraft:entity_spawned')

Sets the event to call when the entity spawn in the world. By default the event called is minecraft:entity_spawned event without using this component.

Parameters

event : str the event to call on entity spawn.

Returns
Spawn rule condition.

SpawnsAboveBlockFilter(distance, *block)

Sets the list of blocks the actor can spawn above.

Parameters

distance : int The vertical distance to check for valid blocks. block : str Valid blocks to activate this component.

Returns
Spawn rule condition.

SpawnsOnBlockFilter(*block)

Sets the list of blocks the actor can spawn on top of.

Parameters

block : str Valid blocks to activate this component.

Returns
Spawn rule condition.

SpawnsOnBlockPreventedFilter(*block)

Sets the list of blocks the actor should not spawn on.

Returns
Spawn rule condition.

Weight(weight=0)

The weight on how likely the spawn rule chooses this condition over other valid conditions. The higher the value the more likely it will be chosen.

Parameters

weight : int The weight of the item.

Returns
Spawn rule condition.

WorldAgeFilter(min)

Specifies the minimum age of the world before this mob can spawn.

Parameters

min : int The minimum age of the world.

Returns
Spawn rule condition.

src.anvil.api.actors._SpawnRule

Bases: AddonObject

src.anvil.api.actors._BaseEvent

src.anvil.api.actors._Randomize

Bases: _BaseEvent

src.anvil.api.actors._Sequence

Bases: _BaseEvent

src.anvil.api.actors._Event

Bases: _BaseEvent

src.anvil.api.actors._Components

src.anvil.api.actors._ComponentGroup

Bases: _Components

src.anvil.api.actors._Properties

src.anvil.api.actors._EntityClientDescription

Bases: _ActorClientDescription

Base class for all client entity descriptions.

EnableAttachables property

This determines if the entity should render attachables such as armor.

HeldItemIgnoresLighting property

This determines if the held item should ignore lighting.

HideArmor property

This determines if the armor should be hidden.

__init__(name, is_vanilla=False)

Base class for all client entity descriptions.

Parameters:

Name Type Description Default
name str

The name of the entity.

required
is_vanilla bool

Whether or not the entity is a vanilla entity. Defaults to False.

False

animation(blockbench_name, animation_name, animate=False, condition=None)

Sets the mapping of internal animation references to actual animations.

Parameters:

Name Type Description Default
animation_name str

The name of the animation.

required
animate bool

Whether or not to animate the animation. Defaults to False.

False
condition str | Molang

The condition to animate the animation. Defaults to None.

None

animation_controller(controller_shortname, animate=False, condition=None)

Sets the mapping of internal animation controller references to actual animations.

Parameters:

Name Type Description Default
controller_shortname str

The name of the animation controller.

required
animate bool

Whether or not to animate the animation controller. Defaults to False.

False
condition str | Molang

The condition to animate the animation controller. Defaults to None.

None

dummy()

This method manages the dummy for an entity.

geometry(geometry_name)

This method manages the geometry for an entity.

Parameters:

Name Type Description Default
geometry_name str

The name of the geometry.

required

Returns:

Name Type Description
self

Returns an instance of the class.

init_vars(**vars)

Initializes variables for an entity.

Examples:

>>> Entity("example").init_vars(x=0, y=5, z=8)

material(material_id, material_name)

This method manages the materials for an entity.

Parameters:

Name Type Description Default
material_id str

The id of the material.

required
material_name str

The name of the material.

required

particle_effect(particle_name)

This method manages the particle effects for an entity.

Parameters:

Name Type Description Default
particle_name str

The name of the particle effect.

required

queryable_geometry(geometry_shortname)

This method manages the queryable geometry for an entity.

Parameters:

Name Type Description Default
geometry_shortname str

The shortname of the geometry.

required

render_controller(controller_name, condition=None)

This method manages the render controllers for an entity.

Parameters:

Name Type Description Default
controller_name str

The name of the render controller.

required
condition str

The condition to render the render controller. Defaults to None.

None

scale(scale='1')

Sets the scale of the entity.

Parameters:

Name Type Description Default
scale str | Molang

The scale of the entity. Defaults to "1".

'1'

scaleXYZ(x='1', y='1', z='1')

Sets the scale of the entity.

Parameters:

Name Type Description Default
x str | Molang

The x scale of the entity. Defaults to "1".

'1'
y str | Molang

The y scale of the entity. Defaults to "1".

'1'
z str | Molang

The z scale of the entity. Defaults to "1".

'1'

script(variable, script)

This method manages the scripts for an entity.

should_update_bones_and_effects_offscreen(bool=False)

Sets whether or not the entity should update bones and effects offscreen.

Parameters:

Name Type Description Default
bool bool

Whether or not the entity should update bones and effects offscreen. Defaults to False.

False

should_update_effects_offscreen(bool=False)

Sets whether or not the entity should update effects offscreen.

Parameters:

Name Type Description Default
bool bool

Whether or not the entity should update effects offscreen. Defaults to False.

False

sound_effect(sound_name, sound_reference, category=SoundCategory.Neutral, max_distance=0, min_distance=9999)

This method manages the sound effects for an entity.

Parameters:

Name Type Description Default
sound_shortname str

The shortname of the sound effect.

required
sound_reference str

The identifier of the sound effect.

required
category SoundCategory

The category of the sound effect. Defaults to SoundCategory.Neutral.

Neutral

sound_event(sound_reference, sound_event, category=SoundCategory.Neutral, volume=1.0, pitch=(0.8, 1.2), max_distance=0, min_distance=9999)

This method manages the sound events for an entity.

Parameters:

Name Type Description Default
sound_reference _type_

The identifier of the sound effect.

required
sound_event EntitySoundEvent

The sound event.

required
category SoundCategory

The category of the sound effect. Defaults to SoundCategory.Neutral.

Neutral
volume float

The volume of the sound effect. Defaults to 1.0.

1.0
pitch tuple[float, float]

The pitch of the sound effect. Defaults to (0.8, 1.2).

(0.8, 1.2)

spawn_egg(item_sprite, texture_index=0)

This method adds a spawn egg texture to the entity.

Parameters:

Name Type Description Default
item_sprite str

The name of the item sprite.

required

spawn_egg_color(base_color, overlay_color)

This method adds a spawn egg color to the entity.

Parameters:

Name Type Description Default
base_color str

The base color of the spawn egg.

required
overlay_color str

The overlay color of the spawn egg.

required

texture(blockbench_name, texture_name)

This method manages the textures for an entity.

Parameters:

Name Type Description Default
blockbench_name str

The name of the texture.

required
texture_name str

The name of the texture.

required

to_dict(directory)

Queues the entity for export.

Parameters:

Name Type Description Default
directory str

The directory to export the entity to.

required

src.anvil.api.actors._EntityServerDescription

Bases: _ActorDescription

Base class for all server entity descriptions.

Experimental property

Sets whether or not this entity is experimental. Experimental entities are only enabled when the experimental toggle is enabled.

Returns
Entity description object.

Spawnable property

Sets whether or not this entity has a spawn egg in the creative ui.

Returns
Entity description object.

Summonable property

Sets whether or not we can summon this entity using commands such as /summon.

Returns
Entity description object.

add_property property

Adds a property to the entity.

RuntimeIdentifier(entity)

Sets the runtime identifier of the entity.

Parameters:

Name Type Description Default
entity VanillaEntity

The vanilla entity to get the runtime identifier from.

required

__init__(name, is_vanilla=False)

Base class for all server entity descriptions.

Parameters:

Name Type Description Default
name str

The name of the entity.

required
is_vanilla bool

Whether or not the entity is a vanilla entity. Defaults to False.

False

spawn_category()

Sets the spawn category of the entity.

src.anvil.api.actors._EntityServer

Bases: AddonObject

Base class for all server entities.

components property

Returns the components of the entity.

description property

Returns the entity description.

spawn_rule property

Returns the spawn rule of the entity.

__init__(name, is_vanilla=False)

Base class for all server entities.

Parameters:

Name Type Description Default
name str

The name of the entity.

required
is_vanilla bool

Whether or not the entity is a vanilla entity. Defaults to False.

False

animation(animation_name, loop=False, animate=False, condition=None)

Sets the mapping of internal animation references to actual animations.

Parameters:

Name Type Description Default
animation_name str

The name of the animation.

required
loop bool

Whether or not the animation should loop. Defaults to False.

False
animate bool

Whether or not to animate the animation. Defaults to False.

False
condition str | Molang

The condition to animate the animation. Defaults to None.

None

animation_controller(controller_shortname, animate=False, condition=None)

Sets the mapping of internal animation controller references to actual animations.

Parameters:

Name Type Description Default
controller_shortname str

The name of the animation controller.

required
animate bool

Whether or not to animate the animation controller. Defaults to False.

False
condition str | Molang

The condition to animate the animation controller. Defaults to None.

None

component_group(component_group_name)

Adds a component group to the entity.

Parameters:

Name Type Description Default
component_group_name str

The name of the component group.

required

event(event_name)

Adds an event to the entity.

Parameters:

Name Type Description Default
event_name str

The name of the event.

required

init_vars(**vars)

Initializes variables for an entity.

queue(directory=None)

Queues the entity for export.

Parameters:

Name Type Description Default
directory str

The directory to export the entity to. Defaults to None.

None

src.anvil.api.actors._EntityClient

Bases: AddonObject

Base class for all client entities.

description property

Returns the entity description.

reuse_assets property

Whether or not the actor should reuse assets from another actor.

__init__(name, is_vanilla=False)

Base class for all client entities.

Parameters:

Name Type Description Default
name str

The name of the entity.

required
is_vanilla bool

Whether or not the entity is a vanilla entity. Defaults to False.

False

queue(directory=None)

Queues the entity for export.

Parameters:

Name Type Description Default
directory str

The directory to export the entity to. Defaults to None.

None

src.anvil.api.actors.Entity

Client: _EntityClient property

Client-side.

Returns
Client Entity.

Server property

Server-side logic.

Returns
Server Entity.

identifier: Identifier property

Returns the identifier of the Entity.

name: str property

Returns the name of the Entity.

add_basic_components()

Adds basic server components to the entity.

This includes
  • JumpStatic
  • MovementType
  • NavigationType
  • Movement
  • Physics
  • KnockbackResistance
  • Health
  • CollisionBox
  • Breathable
  • DamageSensor
  • Pushable
  • PushThrough

Attachable

src.anvil.api.actors._AttachableClientDescription

Bases: _ActorClientDescription

Base class for all client attachable descriptions.

reuse_assets property

Whether or not the actor should reuse assets from another actor.

__init__(name, is_vanilla=False)

Base class for all client attachable descriptions.

Parameters:

Name Type Description Default
name str

The name of the attachable.

required
is_vanilla bool

Whether or not the attachable is a vanilla attachable. Defaults to False.

False

animation(blockbench_name, animation_name, animate=False, condition=None)

Sets the mapping of internal animation references to actual animations.

Parameters:

Name Type Description Default
animation_name str

The name of the animation.

required
animate bool

Whether or not to animate the animation. Defaults to False.

False
condition str | Molang

The condition to animate the animation. Defaults to None.

None

animation_controller(controller_shortname, animate=False, condition=None)

Sets the mapping of internal animation controller references to actual animations.

Parameters:

Name Type Description Default
controller_shortname str

The name of the animation controller.

required
animate bool

Whether or not to animate the animation controller. Defaults to False.

False
condition str | Molang

The condition to animate the animation controller. Defaults to None.

None

dummy()

This method manages the dummy for an entity.

geometry(geometry_name)

This method manages the geometry for an entity.

Parameters:

Name Type Description Default
geometry_name str

The name of the geometry.

required

Returns:

Name Type Description
self

Returns an instance of the class.

init_vars(**vars)

Initializes variables for an entity.

Examples:

>>> Entity("example").init_vars(x=0, y=5, z=8)

material(material_id, material_name)

This method manages the materials for an entity.

Parameters:

Name Type Description Default
material_id str

The id of the material.

required
material_name str

The name of the material.

required

particle_effect(particle_name)

This method manages the particle effects for an entity.

Parameters:

Name Type Description Default
particle_name str

The name of the particle effect.

required

queryable_geometry(geometry_shortname)

This method manages the queryable geometry for an entity.

Parameters:

Name Type Description Default
geometry_shortname str

The shortname of the geometry.

required

render_controller(controller_name, condition=None)

This method manages the render controllers for an entity.

Parameters:

Name Type Description Default
controller_name str

The name of the render controller.

required
condition str

The condition to render the render controller. Defaults to None.

None

scale(scale='1')

Sets the scale of the entity.

Parameters:

Name Type Description Default
scale str | Molang

The scale of the entity. Defaults to "1".

'1'

scaleXYZ(x='1', y='1', z='1')

Sets the scale of the entity.

Parameters:

Name Type Description Default
x str | Molang

The x scale of the entity. Defaults to "1".

'1'
y str | Molang

The y scale of the entity. Defaults to "1".

'1'
z str | Molang

The z scale of the entity. Defaults to "1".

'1'

script(variable, script)

This method manages the scripts for an entity.

should_update_bones_and_effects_offscreen(bool=False)

Sets whether or not the entity should update bones and effects offscreen.

Parameters:

Name Type Description Default
bool bool

Whether or not the entity should update bones and effects offscreen. Defaults to False.

False

should_update_effects_offscreen(bool=False)

Sets whether or not the entity should update effects offscreen.

Parameters:

Name Type Description Default
bool bool

Whether or not the entity should update effects offscreen. Defaults to False.

False

sound_effect(sound_name, sound_reference, category=SoundCategory.Neutral, max_distance=0, min_distance=9999)

This method manages the sound effects for an entity.

Parameters:

Name Type Description Default
sound_shortname str

The shortname of the sound effect.

required
sound_reference str

The identifier of the sound effect.

required
category SoundCategory

The category of the sound effect. Defaults to SoundCategory.Neutral.

Neutral

sound_event(sound_reference, sound_event, category=SoundCategory.Neutral, volume=1.0, pitch=(0.8, 1.2), max_distance=0, min_distance=9999)

This method manages the sound events for an entity.

Parameters:

Name Type Description Default
sound_reference _type_

The identifier of the sound effect.

required
sound_event EntitySoundEvent

The sound event.

required
category SoundCategory

The category of the sound effect. Defaults to SoundCategory.Neutral.

Neutral
volume float

The volume of the sound effect. Defaults to 1.0.

1.0
pitch tuple[float, float]

The pitch of the sound effect. Defaults to (0.8, 1.2).

(0.8, 1.2)

texture(blockbench_name, texture_name)

This method manages the textures for an entity.

Parameters:

Name Type Description Default
blockbench_name str

The name of the texture.

required
texture_name str

The name of the texture.

required

to_dict(directory=None)

Queues the entity for export.

Parameters:

Name Type Description Default
directory str

The directory to export the entity to. Defaults to None.

None

Raises:

Type Description
RuntimeError

If the entity does not have a geometry, texture, or render controller.

Exception

If a geometry is reused but the entity it is reused from has not been queued yet.

src.anvil.api.actors.Attachable

Bases: AddonObject

description property

Returns the description of the attachable.

identifier: Identifier property

Returns the identifier of the attachable.

name: str property

Returns the name of the attachable.

queue property

Queues the attachable.

__init__(name)

Initializes the attachable.

Parameters:

Name Type Description Default
name str

The name of the attachable.

required

__str__()

Returns the identifier of the attachable.