Skip to content

Actors - Beta Components Module

anvil.beta.actors.components

EntityAITimerFlag1

Bases: EntityAITimerFlag1

[EXPERIMENTAL] Fires an event when this behavior starts, then waits for a duration before stopping, with the 1.26.70 options. When stopping due to that timeout or due to being interrupted by another behavior, fires another event. query.timer_flag_1 will return 1.0 on both the client and server when this behavior is running, and 0.0 otherwise. Needs the experimental flag in anvilconfig.json.

Parameters:

Name Type Description Default
priority int

Lower values run first. Game default 0.

required
control_flags list[ControlFlags]

The controls this goal takes over.

required
cooldown_range float | tuple[float, float]

Goal cooldown range in seconds. Can be a range object or a single number.

required
duration_range float | tuple[float, float]

Goal duration range in seconds. Can be a range object or a single number.

required
on_end EventTrigger | str

Event(s) to run when the goal ends.

required
on_start EventTrigger | str

Event(s) to run when the goal starts.

required
trigger_on_end_when_interrupted bool

Whether the on_end events run when another goal interrupts this goal before its duration elapses. Game default true.

required
Documentation reference

__required__ = () class-attribute

JSON keys the schema marks required although their field is optional, because __validate__ requires them.

__from_json__(data) classmethod

Builds the object from its parsed JSON, the inverse of __json__(). Each key goes to the field written under it, read through the field's annotation.

Parameters:

Name Type Description Default
data Any

The parsed JSON object.

required

Raises:

Type Description
TypeError

The data is not an object, or a value does not match its field.

ValueError

The data has a key the class does not write, or a constant field holds another value.

__json__()

The component as {identifier: payload}.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__payload_schema__(definitions) classmethod

The schema of the payload under the identifier.

__post_init__()

Side effects after construction.

__prepare_export__(owner, *, root=True)

Finishes the object for export, where its owner calls it. Components with a localized name override it. root is False for a permutation's components.

__schema__() classmethod

The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.

__schema_body__(definitions) classmethod

The schema of {identifier: payload}.

EntityAITimerFlag2

Bases: EntityAITimerFlag2

[EXPERIMENTAL] Fires an event when this behavior starts, then waits for a duration before stopping, with the 1.26.70 options. When stopping due to that timeout or due to being interrupted by another behavior, fires another event. query.timer_flag_2 will return 1.0 on both the client and server when this behavior is running, and 0.0 otherwise. Needs the experimental flag in anvilconfig.json.

Parameters:

Name Type Description Default
priority int

Lower values run first. Game default 0.

required
control_flags list[ControlFlags]

The controls this goal takes over.

required
cooldown_range float | tuple[float, float]

Goal cooldown range in seconds. Can be a range object or a single number.

required
duration_range float | tuple[float, float]

Goal duration range in seconds. Can be a range object or a single number.

required
on_end EventTrigger | str

Event(s) to run when the goal ends.

required
on_start EventTrigger | str

Event(s) to run when the goal starts.

required
trigger_on_end_when_interrupted bool

Whether the on_end events run when another goal interrupts this goal before its duration elapses. Game default true.

required
Documentation reference

__required__ = () class-attribute

JSON keys the schema marks required although their field is optional, because __validate__ requires them.

__from_json__(data) classmethod

Builds the object from its parsed JSON, the inverse of __json__(). Each key goes to the field written under it, read through the field's annotation.

Parameters:

Name Type Description Default
data Any

The parsed JSON object.

required

Raises:

Type Description
TypeError

The data is not an object, or a value does not match its field.

ValueError

The data has a key the class does not write, or a constant field holds another value.

__json__()

The component as {identifier: payload}.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__payload_schema__(definitions) classmethod

The schema of the payload under the identifier.

__post_init__()

Side effects after construction.

__prepare_export__(owner, *, root=True)

Finishes the object for export, where its owner calls it. Components with a localized name override it. root is False for a permutation's components.

__schema__() classmethod

The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.

__schema_body__(definitions) classmethod

The schema of {identifier: payload}.

EntityAITimerFlag3

Bases: EntityAITimerFlag3

[EXPERIMENTAL] Fires an event when this behavior starts, then waits for a duration before stopping, with the 1.26.70 options. When stopping due to that timeout or due to being interrupted by another behavior, fires another event. query.timer_flag_3 will return 1.0 on both the client and server when this behavior is running, and 0.0 otherwise. Needs the experimental flag in anvilconfig.json.

Parameters:

Name Type Description Default
priority int

Lower values run first. Game default 0.

required
control_flags list[ControlFlags]

The controls this goal takes over.

required
cooldown_range float | tuple[float, float]

Goal cooldown range in seconds. Can be a range object or a single number.

required
duration_range float | tuple[float, float]

Goal duration range in seconds. Can be a range object or a single number.

required
on_end EventTrigger | str

Event(s) to run when the goal ends.

required
on_start EventTrigger | str

Event(s) to run when the goal starts.

required
trigger_on_end_when_interrupted bool

Whether the on_end events run when another goal interrupts this goal before its duration elapses. Game default true.

required
Documentation reference

__required__ = () class-attribute

JSON keys the schema marks required although their field is optional, because __validate__ requires them.

__from_json__(data) classmethod

Builds the object from its parsed JSON, the inverse of __json__(). Each key goes to the field written under it, read through the field's annotation.

Parameters:

Name Type Description Default
data Any

The parsed JSON object.

required

Raises:

Type Description
TypeError

The data is not an object, or a value does not match its field.

ValueError

The data has a key the class does not write, or a constant field holds another value.

__json__()

The component as {identifier: payload}.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__payload_schema__(definitions) classmethod

The schema of the payload under the identifier.

__post_init__()

Side effects after construction.

__prepare_export__(owner, *, root=True)

Finishes the object for export, where its owner calls it. Components with a localized name override it. root is False for a permutation's components.

__schema__() classmethod

The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.

__schema_body__(definitions) classmethod

The schema of {identifier: payload}.

EntityCanStandOnBrittleIce

Bases: JsonComponent

[EXPERIMENTAL] Allows an entity to stand on brittle ice. Needs the experimental flag in anvilconfig.json.

Documentation reference

__required__ = () class-attribute

JSON keys the schema marks required although their field is optional, because __validate__ requires them.

__from_json__(data) classmethod

Builds the object from its parsed JSON, the inverse of __json__(). Each key goes to the field written under it, read through the field's annotation.

Parameters:

Name Type Description Default
data Any

The parsed JSON object.

required

Raises:

Type Description
TypeError

The data is not an object, or a value does not match its field.

ValueError

The data has a key the class does not write, or a constant field holds another value.

__json__()

The component as {identifier: payload}.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__payload_schema__(definitions) classmethod

The schema of the payload under the identifier.

__post_init__()

Side effects after construction.

__prepare_export__(owner, *, root=True)

Finishes the object for export, where its owner calls it. Components with a localized name override it. root is False for a permutation's components.

__schema__() classmethod

The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.

__schema_body__(definitions) classmethod

The schema of {identifier: payload}.

EntityProjectile

Bases: EntityProjectile

[EXPERIMENTAL] Turns the entity into a projectile, with the 1.26.70 on_hit options. Needs the experimental flag in anvilconfig.json. Takes the same arguments as the public EntityProjectile; set_on_hit takes this module's ProjectileImpactDamage.

Documentation reference

__required__ = () class-attribute

JSON keys the schema marks required although their field is optional, because __validate__ requires them.

__from_json__(data) classmethod

Builds the object from its parsed JSON, the inverse of __json__(). Each key goes to the field written under it, read through the field's annotation.

Parameters:

Name Type Description Default
data Any

The parsed JSON object.

required

Raises:

Type Description
TypeError

The data is not an object, or a value does not match its field.

ValueError

The data has a key the class does not write, or a constant field holds another value.

__json__()

The component as {identifier: payload}.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__payload_schema__(definitions) classmethod

The schema of the payload under the identifier.

__post_init__()

Side effects after construction.

__prepare_export__(owner, *, root=True)

Finishes the object for export, where its owner calls it. Components with a localized name override it. root is False for a permutation's components.

__schema__() classmethod

The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.

__schema_body__(definitions) classmethod

The schema of {identifier: payload}.

set_on_hit(*, arrow_effect=None, catch_fire=None, definition_event=None, douse_fire=None, freeze_on_hit=None, grant_xp=None, hurt_owner=None, ignite=None, impact_damage=None, mob_effect=None, particle_on_hit=None, remove_on_hit=None, spawn_aoe_cloud=None, spawn_chance=None, stick_in_ground=None, teleport_owner=None, thrown_potion_effect=None, wind_burst_on_hit=None)

Sets what happens when the projectile hits a block, a fluid or an entity.

A part set to an object with no options, or a switch set to True, is written as {}, which turns that behavior on with the game's defaults.

Parameters:

Name Type Description Default
arrow_effect ProjectileArrowEffect

Applies the arrow's tipped-potion effects.

None
catch_fire ProjectileCatchFire

Sets the entity or block hit on fire.

None
definition_event ProjectileDefinitionEvent

Runs an event.

None
douse_fire bool

A water potion puts out fires around the hit block.

None
freeze_on_hit ProjectileFreezeOnHit

Freezes nearby water.

None
grant_xp int | tuple[float, float]

Experience dropped, or a (min, max) range. Written as {"minXP", "maxXP"}.

None
hurt_owner ProjectileHurtOwner

Damages the owner.

None
ignite bool

Runs the entity's on_ignite trigger.

None
impact_damage ProjectileImpactDamage

Damages the entity hit, with the 1.26.70 options: scale_damage_with_difficulty, and death_message_override, a plain-text death message that Anvil adds to the language file.

None
mob_effect list[ProjectileMobEffect]

Effects applied to the entity hit. Written as {"effects": [...]}.

None
particle_on_hit ProjectileParticleOnHit

A particle effect at the impact.

None
remove_on_hit bool

Removes the projectile.

None
spawn_aoe_cloud ProjectileSpawnAoeCloud

Spawns an area effect cloud.

None
spawn_chance ProjectileSpawnChance

Spawns entities.

None
stick_in_ground ProjectileStickInGround

The projectile sticks in the block it hits.

None
teleport_owner bool

Teleports the owner to the impact.

None
thrown_potion_effect ProjectileThrownPotionEffect

Applies a thrown potion's effects.

None
wind_burst_on_hit bool

Releases a wind burst that pushes entities away.

None

EntityReflectProjectiles

Bases: JsonComponent

[EXPERIMENTAL] Allows an entity to reflect projectiles. Needs the experimental flag in anvilconfig.json.

Parameters:

Name Type Description Default
azimuth_angle Molang | str | float

Angle in degrees added to the projectile's y axis rotation. Game default 0.

required
elevation_angle Molang | str | float

Angle in degrees added to the projectile's x axis rotation. Game default 0.

required
reflected_projectiles list[str | Entity]

Projectiles that are reflected when they hit the entity.

required
reflection_scale Molang | str | float

Velocity scale of the reflected projectile. Below 1 slows it, above 1 speeds it up. Game default 1.

required
reflection_sound str

Sound event played when a projectile is reflected. Game default reflect.

required
Documentation reference

__required__ = () class-attribute

JSON keys the schema marks required although their field is optional, because __validate__ requires them.

__from_json__(data) classmethod

Builds the object from its parsed JSON, the inverse of __json__(). Each key goes to the field written under it, read through the field's annotation.

Parameters:

Name Type Description Default
data Any

The parsed JSON object.

required

Raises:

Type Description
TypeError

The data is not an object, or a value does not match its field.

ValueError

The data has a key the class does not write, or a constant field holds another value.

__json__()

The component as {identifier: payload}.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__payload_schema__(definitions) classmethod

The schema of the payload under the identifier.

__post_init__()

Side effects after construction.

__prepare_export__(owner, *, root=True)

Finishes the object for export, where its owner calls it. Components with a localized name override it. root is False for a permutation's components.

__schema__() classmethod

The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.

__schema_body__(definitions) classmethod

The schema of {identifier: payload}.

EntityRotationAlwaysFollowsHead

Bases: JsonComponent

[EXPERIMENTAL] Keeps the entity's rotation aligned with its head after look behaviors run. This overrides the yaw set by movement components, so it is intended for entities that turn in place.

Documentation reference

__required__ = () class-attribute

JSON keys the schema marks required although their field is optional, because __validate__ requires them.

__from_json__(data) classmethod

Builds the object from its parsed JSON, the inverse of __json__(). Each key goes to the field written under it, read through the field's annotation.

Parameters:

Name Type Description Default
data Any

The parsed JSON object.

required

Raises:

Type Description
TypeError

The data is not an object, or a value does not match its field.

ValueError

The data has a key the class does not write, or a constant field holds another value.

__json__()

The component as {identifier: payload}.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__payload_schema__(definitions) classmethod

The schema of the payload under the identifier.

__post_init__()

Side effects after construction.

__prepare_export__(owner, *, root=True)

Finishes the object for export, where its owner calls it. Components with a localized name override it. root is False for a permutation's components.

__schema__() classmethod

The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.

__schema_body__(definitions) classmethod

The schema of {identifier: payload}.

EntitySphericalLookControl

Bases: JsonComponent

[EXPERIMENTAL] Turns the entity's head toward targets set by look behaviors along the shortest arc in 3D, combining upward or downward rotation (pitch) with side-to-side rotation (yaw) in a single turn. Needs the experimental flag in anvilconfig.json.

Look requests turn at the average of the pitch and yaw speeds supplied by the look behavior, optionally scaled by distance. With no look request, the head keeps its current direction unless its pitch is outside pitch_limits, in which case it returns toward the nearest limit at pitch_recovery_speed.

Parameters:

Name Type Description Default
pitch_recovery_speed float

The speed in degrees per second used to return the head's pitch within pitch_limits when no look request is present, from 0 to 3600. 0 disables pitch recovery. It does not limit turning toward requested targets. Game default 60.

required
reference_distance float

The distance in blocks, above 0, at or below which the look behavior's average pitch and yaw speed applies unchanged. Beyond it, the turn speed is multiplied by reference_distance divided by the target distance, so doubling the distance halves the speed. The distance is measured from the entity's breathing point to the requested look position, and applies only to position targets. Without it, the turn speed is not scaled by distance.

required
pitch_limits tuple[float, float]

The (min, max) pitch in degrees, each from -90 (straight up) to 90 (straight down), min not above max. Set both to the same value for a fixed pitch. Written as {"min", "max"}. Game default (-90, 90).

required
Documentation reference

__required__ = () class-attribute

JSON keys the schema marks required although their field is optional, because __validate__ requires them.

__from_json__(data) classmethod

Builds the object from its parsed JSON, the inverse of __json__(). Each key goes to the field written under it, read through the field's annotation.

Parameters:

Name Type Description Default
data Any

The parsed JSON object.

required

Raises:

Type Description
TypeError

The data is not an object, or a value does not match its field.

ValueError

The data has a key the class does not write, or a constant field holds another value.

__json__()

The component as {identifier: payload}.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__payload_schema__(definitions) classmethod

The schema of the payload under the identifier.

__post_init__()

Side effects after construction.

__prepare_export__(owner, *, root=True)

Finishes the object for export, where its owner calls it. Components with a localized name override it. root is False for a permutation's components.

__schema__() classmethod

The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.

__schema_body__(definitions) classmethod

The schema of {identifier: payload}.

EntityTeleport

Bases: EntityTeleport

[EXPERIMENTAL] Defines an entity's teleporting behavior, with the 1.26.70 options. Needs the experimental flag in anvilconfig.json.

Parameters:

Name Type Description Default
can_teleport_into_liquid bool

Whether the entity can teleport into blocks that hold a liquid, such as water. Game default false.

required
dark_teleport_chance float

Chance to teleport in darkness. Game default 0.01.

required
light_teleport_chance float

Chance to teleport in daylight. Game default 0.01.

required
max_random_teleport_time float

Maximum seconds between random teleports. Game default 20.

required
min_random_teleport_time float

Minimum seconds between random teleports. Game default 0.

required
on_teleport_sound str

Level sound event played after a successful teleport. An entity with no sound bound to it plays the default teleport sound; "undefined" teleports silently. Game default teleport.

required
projectile_filter Filter

Projectiles that make the entity try to teleport. Without it, every projectile.

required
random_teleport_cube tuple[float, float, float]

The area of random teleports. Game default (32, 16, 32).

required
random_teleports bool

Whether the entity teleports randomly. Game default true.

required
target_distance float

Minimum distance from the target before the entity starts teleporting towards it. Game default 16.

required
target_teleport_chance float

Chance to teleport, from 0 to 1. Game default 1.

required
target_teleport_distance float | tuple[float, float]

Distance teleported towards the target, or a (min, max) range, from -32 to 32. Negative values teleport away from the target. Written as {"min", "max"}. Game default (16, 16).

required
target_teleport_offset tuple[float, float, float]

Maximum random offset on each axis, in either direction, added to the teleport direction, from 0 to 32. The y offset is rounded down to whole blocks. Game default (4, 8, 4).

required
teleports_on_projectile_hit bool

Whether the entity teleports away from projectiles about to hit it. Game default false.

required
Documentation reference

__required__ = () class-attribute

JSON keys the schema marks required although their field is optional, because __validate__ requires them.

__from_json__(data) classmethod

Builds the object from its parsed JSON, the inverse of __json__(). Each key goes to the field written under it, read through the field's annotation.

Parameters:

Name Type Description Default
data Any

The parsed JSON object.

required

Raises:

Type Description
TypeError

The data is not an object, or a value does not match its field.

ValueError

The data has a key the class does not write, or a constant field holds another value.

__json__()

The component as {identifier: payload}.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__payload_schema__(definitions) classmethod

The schema of the payload under the identifier.

__post_init__()

Side effects after construction.

__prepare_export__(owner, *, root=True)

Finishes the object for export, where its owner calls it. Components with a localized name override it. root is False for a permutation's components.

__schema__() classmethod

The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.

__schema_body__(definitions) classmethod

The schema of {identifier: payload}.

EntityTimeMarkerSensor

Bases: JsonComponent

[EXPERIMENTAL] Runs events on this entity when named time markers fire on named world clocks. Needs the experimental flag in anvilconfig.json.

Parameters:

Name Type Description Default
triggers list[TimeMarkerSensorTrigger]

The world clock time markers to listen for, at least one. Entries identical to an earlier one are ignored by the game. Add them with add_trigger.

required

__required__ = () class-attribute

JSON keys the schema marks required although their field is optional, because __validate__ requires them.

__from_json__(data) classmethod

Builds the object from its parsed JSON, the inverse of __json__(). Each key goes to the field written under it, read through the field's annotation.

Parameters:

Name Type Description Default
data Any

The parsed JSON object.

required

Raises:

Type Description
TypeError

The data is not an object, or a value does not match its field.

ValueError

The data has a key the class does not write, or a constant field holds another value.

__json__()

The component as {identifier: payload}.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__payload_schema__(definitions) classmethod

The schema of the payload under the identifier.

__post_init__()

Side effects after construction.

__prepare_export__(owner, *, root=True)

Finishes the object for export, where its owner calls it. Components with a localized name override it. root is False for a permutation's components.

__schema__() classmethod

The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.

__schema_body__(definitions) classmethod

The schema of {identifier: payload}.

add_trigger(*, clock, time_marker, event, filters=None, target=None)

Adds a world clock time marker to listen for, and the event to run when it fires.

Parameters:

Name Type Description Default
clock str

The name of the world clock to listen to.

required
time_marker str

The name of the time marker on the clock to listen for.

required
event str

The event to run when the time marker fires.

required
filters Filter

The conditions for the event to run.

None
target FilterSubject

The entity the event runs on. Game default self.

None

EntityTrail

Bases: JsonComponent

[EXPERIMENTAL] Makes the entity leave a trail of blocks as it moves, in the 1.26.70 form. Obeys Mob Griefing rules. Needs the experimental flag in anvilconfig.json. It writes minecraft:trail like the public EntityTrail, which keeps the older options, and clashes with it: an entity cannot use both.

Parameters:

Name Type Description Default
block_type str | Block | BlockDescriptor

The block placed. A solid block cannot be placed at the entity's position when offset is (0, 0, 0). Game default air.

required
extent int

Maximum horizontal distance from the center at which blocks are placed, from 0 to 16. Game default 0.

required
offset tuple[float, float, float]

Offset from the entity where blocks are placed and checked, capped at 16 blocks. X and Z follow the entity's nearest cardinal facing; Y is vertical. Game default (0, 0, 0).

required
place_only_on_block_position_change bool

Places blocks only on ticks where the bottom of the entity moves into another block position, or where it lands. Game default false.

required
placement_checks Literal['none', 'block', 'standard']

The checks at each placement position: "none" skips them, "block" applies the block placement conditions, "standard" applies the standard block placement rules, including clearance from entities in the way. Game default "block".

required
placement_conditions list[TrailPlacementCondition]

Block requirements around each placement position, at least one. Add them with add_placement_condition. Game default one condition, air at y offset 0.

required
placement_filter Filter

Conditions on the entity for blocks to be placed.

required
shape Literal['corners', 'square', 'circle']

The horizontal placement pattern: four corner blocks, a filled square or a filled disk. Game default "corners".

required
Documentation reference

__required__ = () class-attribute

JSON keys the schema marks required although their field is optional, because __validate__ requires them.

__from_json__(data) classmethod

Builds the object from its parsed JSON, the inverse of __json__(). Each key goes to the field written under it, read through the field's annotation.

Parameters:

Name Type Description Default
data Any

The parsed JSON object.

required

Raises:

Type Description
TypeError

The data is not an object, or a value does not match its field.

ValueError

The data has a key the class does not write, or a constant field holds another value.

__json__()

The component as {identifier: payload}.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__payload_schema__(definitions) classmethod

The schema of the payload under the identifier.

__post_init__()

Side effects after construction.

__prepare_export__(owner, *, root=True)

Finishes the object for export, where its owner calls it. Components with a localized name override it. root is False for a permutation's components.

__schema__() classmethod

The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.

__schema_body__(definitions) classmethod

The schema of {identifier: payload}.

add_placement_condition(*, block_types, y_offset=None)

Adds a block requirement checked at a vertical offset from each placement position.

Parameters:

Name Type Description Default
block_types list[str | Block | BlockDescriptor]

Blocks that satisfy the condition, at least one. Any of them passes.

required
y_offset int

Vertical offset from the placement position, from -16 to 16. Game default 0.

None

ProjectileImpactDamage

Bases: ProjectileImpactDamage

[EXPERIMENTAL] Damages the entity hit, with the 1.26.70 options. Needs the experimental flag in anvilconfig.json.

Parameters:

Name Type Description Default
apply_knockback_to_blocking_targets bool

Knocks back targets that blocked. Game default false.

required
catch_fire bool

Sets the entity hit on fire for the projectile's on_fire_time. Game default false.

required
ceil_pre_critical_damage bool

Rounds the damage up before the critical multiplier. Game default false.

required
channeling bool

Calls down lightning on the entity hit during a thunderstorm. Game default false.

required
damage float | tuple[float, float]

Damage dealt, or a (min, max) range rolled per hit. Written as {"min", "max"}. Game default 0.

required
death_message_override str

The death message shown when the impact damage kills an entity, as plain text. It is added to the language file under death.attack.<namespace>:<project>.<text>, and that key is written. In the text, %1$s is the name of the killed entity and %2$s is the name of the projectile's owner, or of the projectile itself if it has no owner. Entity format 1.26.70 and later. Without it, the default projectile death message.

required
destroy_on_hit bool

Removes the projectile when it deals damage. Game default false.

required
destroy_on_hit_requires_damage bool

destroy_on_hit needs at least one point of damage dealt. Game default true.

required
difficulty_randomization Literal['none', 'additive', 'multiplicative']

How the world difficulty changes the damage. Game default none.

required
filter str

The entity family or type the projectile can damage.

required
knockback bool

Knocks the entity hit back. Game default false.

required
max_critical_damage int

Maximum damage of a critical hit. Game default 2147483647.

required
min_critical_damage int

Minimum damage of a critical hit. Game default 0.

required
power_multiplier float

Multiplied by the projectile's speed and added to the damage. Game default 0.

required
scale_damage_with_difficulty bool

Whether impact damage dealt to players by mob-fired projectiles scales with the world difficulty. Entity format 1.26.70 and later; earlier formats never scale it. Game default true.

required
set_last_hurt_requires_damage bool

The projectile counts as the last attacker only when it deals damage. Game default true.

required

__required__ = () class-attribute

JSON keys the schema marks required although their field is optional, because __validate__ requires them.

__from_json__(data) classmethod

Builds the object from its parsed JSON, the inverse of __json__(). Each key goes to the field written under it, read through the field's annotation.

Parameters:

Name Type Description Default
data Any

The parsed JSON object.

required

Raises:

Type Description
TypeError

The data is not an object, or a value does not match its field.

ValueError

The data has a key the class does not write, or a constant field holds another value.

__json__()

The JSON payload of this object, built from its fields after checking them.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__prepare_export__(owner, *, root=True)

Finishes the object for export, where its owner calls it. Components with a localized name override it. root is False for a permutation's components.

__schema__() classmethod

The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.

__schema_body__(definitions) classmethod

The schema of this object's JSON, adding the parts it uses to definitions.

Parameters:

Name Type Description Default
definitions dict[str, JsonSchema]

The $defs of the schema being built.

required

TimeMarkerSensorTrigger

Bases: JsonObject

A world clock time marker minecraft:time_marker_sensor listens for, and the event it runs.

Parameters:

Name Type Description Default
clock str

The name of the world clock to listen to.

required
time_marker str

The name of the time marker on the clock to listen for.

required
on_time_marker EventTrigger

Event to run when the time marker fires, with its conditions and target.

required

__required__ = () class-attribute

JSON keys the schema marks required although their field is optional, because __validate__ requires them.

__from_json__(data) classmethod

Builds the object from its parsed JSON, the inverse of __json__(). Each key goes to the field written under it, read through the field's annotation.

Parameters:

Name Type Description Default
data Any

The parsed JSON object.

required

Raises:

Type Description
TypeError

The data is not an object, or a value does not match its field.

ValueError

The data has a key the class does not write, or a constant field holds another value.

__json__()

The JSON payload of this object, built from its fields after checking them.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__post_init__()

Side effects after construction.

__prepare_export__(owner, *, root=True)

Finishes the object for export, where its owner calls it. Components with a localized name override it. root is False for a permutation's components.

__schema__() classmethod

The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.

__schema_body__(definitions) classmethod

The schema of this object's JSON, adding the parts it uses to definitions.

Parameters:

Name Type Description Default
definitions dict[str, JsonSchema]

The $defs of the schema being built.

required

__validate__()

Cross-field checks, run on export after the fields are checked.

TrailPlacementCondition

Bases: JsonObject

A block requirement of minecraft:trail, checked at a vertical offset from each placement position. All conditions must pass; the block types of one condition are alternatives.

Parameters:

Name Type Description Default
block_types list[str | Block | BlockDescriptor]

Blocks that satisfy the condition, at least one.

required
y_offset int

Vertical offset from the placement position, from -16 to 16. Game default 0.

required

__required__ = () class-attribute

JSON keys the schema marks required although their field is optional, because __validate__ requires them.

__from_json__(data) classmethod

Builds the object from its parsed JSON, the inverse of __json__(). Each key goes to the field written under it, read through the field's annotation.

Parameters:

Name Type Description Default
data Any

The parsed JSON object.

required

Raises:

Type Description
TypeError

The data is not an object, or a value does not match its field.

ValueError

The data has a key the class does not write, or a constant field holds another value.

__json__()

The JSON payload of this object, built from its fields after checking them.

__json_fields__() classmethod

The compiled fields of this class, compiled on first use.

__post_init__()

Side effects after construction.

__prepare_export__(owner, *, root=True)

Finishes the object for export, where its owner calls it. Components with a localized name override it. root is False for a permutation's components.

__schema__() classmethod

The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.

__schema_body__(definitions) classmethod

The schema of this object's JSON, adding the parts it uses to definitions.

Parameters:

Name Type Description Default
definitions dict[str, JsonSchema]

The $defs of the schema being built.

required

__validate__()

Cross-field checks, run on export after the fields are checked.