Components
src.anvil.api.components
AddRider
Bases: _component
__init__(entity_type, spawn_event=None)
Adds a rider to the entity. Requires minecraft:rideable.
.
Parameters
entity_type
: Identifier
str
.
The entity type that will be riding this entity
spawn_event
: event
str
, optional
.
The spawn event that will be used when the riding entity is created.
AdmireItem
Bases: _component
__init__(cooldown_after_being_attacked, duration=10)
Causes the mob to ignore attackable targets for a given duration.
Parameters
cooldown_after_being_attacked
: Seconds
int
.
Duration, in seconds, for which mob won't admire items if it was hurt
duration
: Seconds
int
.
Duration, in seconds, that the mob is pacified. Default: 10
Ageable
Bases: _component
__init__(duration=1200.0, grow_up_event=None, grow_up_target=FilterSubject.Self, interact_filters=None, transform_to_item=None)
Adds a timer for the entity to grow up. The timer can be accelerated by giving the entity items it likes as defined by feed_items.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
duration
|
Seconds
|
Amount of time before the entity grows up, -1 for always a baby. Defaults to 1200.0. |
1200.0
|
grow_up_event
|
str
|
Event to initiate when the entity grows up. Defaults to None. |
None
|
interact_filters
|
Filter
|
A list of conditions to meet for the entity to be fed. Defaults to None. |
None
|
transform_to_item
|
str
|
The feed item used will transform into this item upon successful interaction. Format: itemName:auxValue. Defaults to None. |
None
|
drop_item(*items)
Adds an item to the list of items the entity drops when it grows up.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item
|
str
|
The item to add to the list of items the entity drops when it grows up. |
required |
Returns
|
Ageable: Returns the Ageable component to allow for method chaining. |
required |
feed_item_growth(item, growth)
Adds an item to the list of items the entity can be fed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item
|
str
|
The item to add to the list of items the entity can be fed. |
required |
growth
|
float
|
The amount of growth to add to the entity when fed this item. |
required |
Returns
|
Ageable: Returns the Ageable component to allow for method chaining. |
required |
feed_items(*items)
Adds an item to the list of items the entity can be fed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item
|
str
|
The item to add to the list of items the entity can be fed. |
required |
Returns
|
Ageable: Returns the Ageable component to allow for method chaining. |
required |
AmbientSoundInterval
Bases: _component
__init__(event_name, range=16, value=8)
A component that will set the entity's delay between playing its ambient sound.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event_name
|
str
|
Level sound event to be played as the ambient sound. |
required |
range
|
float
|
Maximum time in seconds to randomly add to the ambient sound delay time. Defaults to 16. |
16
|
value
|
float
|
Minimum time in seconds before the entity plays its ambient sound again. Defaults to 8. |
8
|
AngerLevel
Bases: _component
__init__(anger_decrement_interval=1.0, angry_boost=20, angry_threshold=80, default_annoyingness=0, default_projectile_annoyingness=0, max_anger=100, nuisance_filter=None, on_increase_sounds=[], remove_targets_below_angry_threshold=True)
Compels the entity to track anger towards a set of nuisances.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
anger_decrement_interval
|
Seconds
|
Anger level will decay over time. Defines how often anger towards all nuisances will decrease by one. Defaults to 1.0. |
1.0
|
angry_boost
|
int
|
Anger boost applied to angry threshold when the entity gets angry. Defaults to 20. |
20
|
angry_threshold
|
int
|
Defines when the entity is considered angry at a nuisance. Defaults to 80. |
80
|
default_annoyingness
|
int
|
Specifies the amount to raise anger level with each provocation. Defaults to 0. |
0
|
default_projectile_annoyingness
|
int
|
Specifies the amount to raise anger level with each projectile hit. Defaults to 0. |
0
|
max_anger
|
int
|
The maximum anger level that can be reached. Applies to any nuisance. Defaults to 100. |
100
|
nuisance_filter
|
Filter
|
Filter that is applied to determine if a mob can be a nuisance. Defaults to None. |
None
|
on_increase_sounds
|
list[dict[str, str]]
|
Sounds to play when the entity is getting provoked. Evaluated in order; the first matching condition wins. Defaults to []. |
[]
|
remove_targets_below_angry_threshold
|
bool
|
Defines if the entity should remove target if it falls below 'angry' threshold. Defaults to True. |
True
|
Angry
Bases: _component
__init__(angry_sound=None, broadcast_anger=False, broadcast_anger_on_attack=False, broadcast_anger_on_being_attacked=False, broadcast_filters=None, broadcast_range=20, broadcast_targets=[], duration=25, duration_delta=0, filters=None, sound_interval=[0, 0])
Defines the entity's 'angry' state using a timer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
angry_sound
|
str
|
The sound event to play when the entity is angry. Defaults to None. |
None
|
broadcast_anger
|
bool
|
If true, other entities of the same entity definition within the broadcast_range will also become angry. Defaults to False. |
False
|
broadcast_anger_on_attack
|
bool
|
If true, other entities of the same entity definition within the broadcast_range will also become angry whenever this entity attacks. Defaults to False. |
False
|
broadcast_anger_on_being_attacked
|
bool
|
If true, other entities of the same entity definition within the broadcast_range will also become angry whenever this entity is attacked. Defaults to False. |
False
|
broadcast_filters
|
Filter
|
Conditions that make this entry in the list valid. Defaults to None. |
None
|
broadcast_range
|
int
|
Distance in blocks where other entities of the same entity definition will become angry. Defaults to 20. |
20
|
broadcast_targets
|
list[str]
|
A list of entity families to broadcast anger to. Defaults to []. |
[]
|
duration
|
Seconds
|
The amount of time in seconds that the entity will be angry. Defaults to 25. |
25
|
duration_delta
|
Seconds
|
Variance in seconds added to the duration [-delta, delta]. Defaults to 0. |
0
|
filters
|
Filter
|
Filter out mob types that should not be attacked while the entity is angry (other Piglins). Defaults to None. |
None
|
sound_interval
|
list[Seconds]
|
The range of time in seconds to wait before playing the angry_sound again. Defaults to [0, 0]. |
[0, 0]
|
AreaAttack
Bases: _component
__init__(cause, damage_per_tick=2, damage_range=0.2)
Is a component that does damage to entities that get within range.
Attack
Bases: _component
__init__(damage, effect_duration=None, effect_name=None)
Defines an entity's melee attack and any additional effects on it.
AvoidMobType
Bases: _ai_goal
__init__(avoid_mob_sound=None, avoid_target_xz=16, avoid_target_y=7, ignore_visibility=False, probability_per_strength=1.0, remove_target=False, sound_interval=[3.0, 8.0], check_if_outnumbered=False, cooldown=0.0)
Compels an entity to run away from other entities that meet the criteria specified.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
avoid_mob_sound
|
str
|
The sound event to play when the mob is avoiding another mob. Defaults to None. |
None
|
avoid_target_xz
|
int
|
The next target position the entity chooses to avoid another entity will be chosen within this XZ Distance. Defaults to 16. |
16
|
avoid_target_y
|
int
|
The next target position the entity chooses to avoid another entity will be chosen within this Y Distance. Defaults to 7. |
7
|
ignore_visibility
|
bool
|
Whether or not to ignore direct line of sight while this entity is running away from other specified entities. Defaults to False. |
False
|
probability_per_strength
|
float
|
Percent chance this entity will stop avoiding another entity based on that entity's strength, where 1.0 = 100%. Defaults to 1.0. |
1.0
|
remove_target
|
bool
|
Determine if we should remove target when fleeing or not. Defaults to False. |
False
|
sound_interval
|
list[float]
|
The range of time in seconds to randomly wait before playing the sound again. Defaults to [3.0, 8.0]. |
[3.0, 8.0]
|
check_if_outnumbered
|
bool
|
If true, the entity will only avoid other entities if it is outnumbered. Defaults to False. |
False
|
cooldown
|
float
|
Time in seconds the entity has to wait before using the goal again. Defaults to 0.0. |
0.0
|
add_type(filter, max_dist=3.0, max_flee=10.0, sprint_distance=7.0, sprint_speed_multiplier=1.0, walk_speed_multiplier=1.0)
Adds a new entity type to the list of conditions another entity must meet to be a valid target to avoid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter
|
Filter
|
Filter to determine which entities to avoid. |
required |
max_dist
|
float
|
Maximum distance to look for an avoid target for the entity. Defaults to 3.0. |
3.0
|
max_flee
|
float
|
How many blocks away from its avoid target the entity must be for it to stop fleeing from the avoid target. Defaults to 10.0. |
10.0
|
sprint_distance
|
float
|
How many blocks within range of its avoid target the entity must be for it to begin sprinting away from the avoid target. Defaults to 7.0. |
7.0
|
sprint_speed_multiplier
|
float
|
Multiplier for sprint speed. 1.0 means keep the regular speed, while higher numbers make the sprint speed faster. Defaults to 1.0. |
1.0
|
walk_speed_multiplier
|
float
|
Multiplier for walking speed. 1.0 means keep the regular speed, while higher numbers make the walking speed faster. Defaults to 1.0. |
1.0
|
on_escape_event(event, target=FilterSubject.Self)
Event that is triggered when escaping from a mob.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event
|
str
|
Event to trigger. |
required |
target
|
FilterSubject
|
Target of the event. Defaults to FilterSubject.Self. |
Self
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
BodyRotationBlocked
Bases: _component
__init__()
When set, the entity will no longer visually rotate their body to match their facing direction.
Boss
Bases: _component
__init__(name, hud_range=55, should_darken_sky=False)
Defines the current state of the boss for updating the boss HUD.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name that displays above the boss's health bar. |
required |
hud_range
|
int
|
The max distance from the boss at which the boss's health bar appears on the screen. Defaults to 55. |
55
|
should_darken_sky
|
bool
|
Whether the sky should darken in the presence of the boss. Defaults to False. |
False
|
Breathable
Bases: _component
__init__(breathes_air=True, breathes_lava=True, breathes_solids=False, breathes_water=False, generates_bubbles=True, inhale_time=0.0, suffocate_time=-20, total_supply=15, breathe_blocks=[], non_breathe_blocks=[])
Defines which blocks an entity can breathe in and defines the ability to suffocate in those blocks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
breathe_blocks
|
list[str]
|
List of blocks the entity can breathe in. Defaults to []. |
[]
|
breathes_air
|
bool
|
If true, the entity can breathe in air. Defaults to True. |
True
|
breathes_lava
|
bool
|
If true, the entity can breathe in lava. Defaults to True. |
True
|
breathes_solids
|
bool
|
If true, the entity can breathe in solid blocks. Defaults to False. |
False
|
breathes_water
|
bool
|
If true, the entity can breathe in water. Defaults to False. |
False
|
generates_bubbles
|
bool
|
If true, the entity will have visible bubbles while in water. Defaults to True. |
True
|
inhale_time
|
Seconds
|
Time in seconds to recover breath to maximum. Defaults to 0.0. |
0.0
|
non_breathe_blocks
|
list[str]
|
List of blocks the entity can't breathe in, in addition to the other "breathes" parameters. Defaults to []. |
[]
|
suffocate_time
|
int
|
Time in seconds between suffocation damage. Defaults to -20. |
-20
|
total_supply
|
int
|
Time in seconds the entity can hold its breath. Defaults to 15. |
15
|
Buoyant
Bases: _component
__init__(liquid_blocks, apply_gravity=True, base_buoyancy=1.0, big_wave_probability=0.03, big_wave_speed=10.0, drag_down_on_buoyancy_removed=0.0, simulate_waves=True)
Allows an entity to float on the specified liquid blocks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
liquid_blocks
|
list[str]
|
List of blocks this entity can float on. Must be a liquid block. |
required |
apply_gravity
|
bool
|
Applies gravity each tick. Causes more of a wave simulation, but will cause more gravity to be applied outside liquids. Defaults to True. |
True
|
base_buoyancy
|
float
|
Base buoyancy used to calculate how much the entity will float. Defaults to 1.0. |
1.0
|
big_wave_probability
|
float
|
Probability of a big wave hitting the entity. Only used if simulate_waves is true. Defaults to 0.03. |
0.03
|
big_wave_speed
|
float
|
Multiplier for the speed to make a big wave. Triggered depending on big_wave_probability. Defaults to 10.0. |
10.0
|
drag_down_on_buoyancy_removed
|
float
|
How much an entity will be dragged down when the buoyancy component is removed. Defaults to 0.0. |
0.0
|
simulate_waves
|
bool
|
If true, the movement simulates waves going through. Defaults to True. |
True
|
BurnsInDaylight
Bases: _component
__init__()
Compels an entity to burn when it's daylight.
CanClimb
Bases: _component
__init__()
Allows this entity to climb up ladders.
CanFly
Bases: _component
__init__()
Marks the entity as being able to fly, the pathfinder won't be restricted to paths where a solid block is required underneath it.
CanJoinRaid
Bases: _component
__init__()
Determines that a given entity can join an existing raid.
CanPowerJump
Bases: _component
__init__()
Allows the entity to power jump like the horse does in vanilla.
CannotBeAttacked
Bases: _component
__init__()
An entity with this component will NEVER be attacked by other entities.
ChargeAttack
Bases: _ai_goal
__init__(max_distance=3, min_distance=2, success_rate=0.1428, speed_multiplier=1.0)
Compels an entity to damage a target by using a running attack.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_distance
|
int
|
A charge attack cannot start if the entity is farther than this distance to the target. Defaults to 3. |
3
|
min_distance
|
int
|
A charge attack cannot start if the entity is closer than this distance to the target. Defaults to 2. |
2
|
success_rate
|
float
|
Percent chance this entity will start a charge attack, if not already attacking (1.0 = 100%). Defaults to 0.1428. |
0.1428
|
speed_multiplier
|
float
|
Modifies the entity's speed when charging toward the target. Defaults to 1.0. |
1.0
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
CollisionBox
Bases: _component
__init__(height, width)
Sets the width and height of the Entity's collision box.
Color
Bases: _component
__init__(value)
Defines the entity's main color.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
int
|
The Palette Color value of the entity. |
required |
Color2
Bases: _component
__init__(value)
Defines the entity's second texture color.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
int
|
The Palette Color value of the entity. |
required |
ConditionalBandwidthOptimization
Bases: _component
__init__(max_dropped_ticks=0, max_optimized_distance=0, use_motion_prediction_hints=False)
Defines the Conditional Spatial Update Bandwidth Optimizations of the entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_dropped_ticks
|
int
|
In relation to the optimization value, determines the maximum ticks spatial update packets can be not sent. |
0
|
max_optimized_distance
|
int
|
The maximum distance considered during bandwidth optimizations. Any value below the max is interpolated to find optimization, and any value greater than or equal to the max results in max optimization. |
0
|
use_motion_prediction_hints
|
bool
|
When set to true, smaller motion packets will be sent during drop packet intervals, resulting in the same amount of packets being sent as without optimizations but with less data being sent. This should be used to prevent visual oddities when entities are traveling quickly or teleporting. |
False
|
CustomHitTest
Bases: _component
__init__(height, width, pivot=[0, 1, 0])
List of hitboxes for melee and ranged hits against the entity.
DamageAbsorption
Bases: _component
__init__(absorbable_causes=DamageCause.Nothing)
Allows an item to absorb damage that would otherwise be dealt to its wearer. The item must be equipped in an armor slot for this to happen. The absorbed damage reduces the item's durability, with any excess damage being ignored. The item must also have a minecraft:durability component.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
absorbable_causes
|
list[str]
|
A list of damage causes that can be absorbed by the item. By default, no damage cause is absorbed. |
Nothing
|
DamageSensor
Bases: _component
__init__()
Defines what events to call when this entity is damaged by specific entities or items.
Dash
Bases: _component
__init__(cooldown_time=1.0, horizontal_momentum=1.0, vertical_momentum=1.0)
Determines a rideable entity's ability to dash.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cooldown_time
|
Seconds
|
The dash cooldown time, in seconds. Defaults to 1.0. |
1.0
|
horizontal_momentum
|
float
|
Horizontal momentum of the dash. Defaults to 1.0. |
1.0
|
vertical_momentum
|
float
|
Vertical momentum of the dash. Defaults to 1.0. |
1.0
|
DelayedAttack
Bases: _ai_goal
__init__(attack_duration=0.75, attack_once=False, cooldown_time=1, hit_delay_pct=0.5, inner_boundary_time_increase=0.25, max_path_time=0.55, melee_fov=90, min_path_time=0.2, outer_boundary_time_increase=0.5, path_fail_time_increase=0.75, path_inner_boundary=16, path_outer_boundary=32, random_stop_interval=0, reach_multiplier=2, require_complete_path=False, speed_multiplier=1, track_target=False, x_max_rotation=30, y_max_head_rotation=30, can_spread_on_fire=False)
Compels an entity to attack while also delaying the damage dealt until a specific time in the attack animation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
attack_duration
|
float
|
The entity's attack animation will play out over this duration (in seconds). Also controls attack cooldown. Defaults to 0.75. |
0.75
|
attack_once
|
bool
|
Allows the entity to use this attack behavior, only once EVER. Defaults to False. |
False
|
cooldown_time
|
int
|
Cooldown time (in seconds) between attacks. Defaults to 1. |
1
|
hit_delay_pct
|
float
|
The percentage into the attack animation to apply the damage of the attack (1.0 = 100%). Defaults to 0.5. |
0.5
|
inner_boundary_time_increase
|
float
|
Time (in seconds) to add to attack path recalculation when the target is beyond the "path_inner_boundary". Defaults to 0.25. |
0.25
|
max_path_time
|
float
|
Maximum base time (in seconds) to recalculate new attack path to target (before increases applied). Defaults to 0.55. |
0.55
|
melee_fov
|
int
|
Field of view (in degrees) when using the sensing component to detect an attack target. Defaults to 90. |
90
|
min_path_time
|
float
|
Minimum base time (in seconds) to recalculate new attack path to target (before increases applied). Defaults to 0.2. |
0.2
|
outer_boundary_time_increase
|
float
|
Time (in seconds) to add to attack path recalculation when the target is beyond the "path_outer_boundary". Defaults to 0.5. |
0.5
|
path_fail_time_increase
|
float
|
Time (in seconds) to add to attack path recalculation when this entity cannot move along the current path. Defaults to 0.75. |
0.75
|
path_inner_boundary
|
int
|
Distance at which to increase attack path recalculation by "inner_boundary_tick_increase". Defaults to 16. |
16
|
path_outer_boundary
|
int
|
Distance at which to increase attack path recalculation by "outer_boundary_tick_increase". Defaults to 32. |
32
|
random_stop_interval
|
int
|
This entity will have a 1 in N chance to stop its current attack, where N = "random_stop_interval". Defaults to 0. |
0
|
reach_multiplier
|
int
|
Used with the base size of the entity to determine minimum target-distance before trying to deal attack damage. Defaults to 2. |
2
|
require_complete_path
|
bool
|
Toggles (on/off) the need to have a full path from the entity to the target when using this melee attack behavior. Defaults to False. |
False
|
speed_multiplier
|
float
|
This multiplier modifies the attacking entity's speed when moving toward the target. Defaults to 1. |
1
|
track_target
|
bool
|
Allows the entity to track the attack target, even if the entity has no sensing. Defaults to False. |
False
|
x_max_rotation
|
int
|
Maximum rotation (in degrees), on the X-axis, this entity can rotate while trying to look at the target. Defaults to 30. |
30
|
y_max_head_rotation
|
int
|
Maximum rotation (in degrees), on the Y-axis, this entity can rotate its head while trying to look at the target. Defaults to 30. |
30
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
DimensionBound
Bases: _component
__init__()
Prevents the entity from changing dimension through portals.
EntitySensor
Bases: _component
add_sensor(event, event_filters, maximum_count=-1, minimum_count=-1, require_all=False, range=[10, 10], cooldown=-1)
A component that initiates an event when a set of conditions are met by other entities within the defined range.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event
|
str
|
Event to initiate when the conditions are met. |
required |
event_filter
|
Filter
|
The set of conditions that must be satisfied to initiate the event. |
required |
maximum_count
|
int
|
The maximum number of entities that must pass the filter conditions for the event to send. Defaults to -1. |
-1
|
minimum_count
|
int
|
The minimum number of entities that must pass the filter conditions for the event to send. Defaults to -1. |
-1
|
relative_range
|
bool
|
If true, the sensor range is additive on top of the entity's size. Defaults to True. |
required |
require_all
|
bool
|
If true, requires all nearby entities to pass the filter conditions for the event to send. Defaults to False. |
False
|
range
|
tuple[float, float]
|
The maximum horizontal and vertical distance another entity can be from this and have the filters checked against it. Defaults to (10, 10). |
[10, 10]
|
cooldown
|
int
|
How many seconds should elapse before the subsensor can once again sense for entities. The cooldown is applied on top of the base 1 tick (0.05 seconds) delay. Negative values will result in no cooldown being used. Defaults to -1. |
-1
|
EnvironmentSensor
Bases: _component
__init__()
Creates a trigger based on environment conditions.
EquipItem
Bases: _ai_goal
__init__()
Compels an entity to equip an item.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
Equipment
Bases: _component
__init__(path)
Sets the loot table for what items this entity drops upon death.
Equippable
Bases: _component
__init__()
Defines an entity's behavior for having items equipped to it.
slot(slot, item, accepted_items, interact_text=None, on_equip=None, on_unequip=None)
Adds a slot to the entity's equippable slots.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
slot
|
int
|
The slot number of this slot. |
required |
item
|
str
|
Identifier of the item that can be equipped for the slot. |
required |
accepted_items
|
list[str]
|
The list of items that can fill this slot. |
required |
interact_text
|
str
|
Text to be displayed while playing with touch-screen controls when the entity can be equipped with this item. Defaults to None. |
None
|
on_equip
|
str
|
Event to trigger when the entity is equipped with the item. Defaults to None. |
None
|
on_unequip
|
str
|
Event to trigger when the item is removed from the entity. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
Equippable |
Returns the Equippable component to allow for method chaining. |
ExperienceReward
Bases: _component
__init__()
Defines the amount of experience rewarded when the entity dies or is successfully bred.
Explode
Bases: _component
__init__(breaks_blocks=True, causes_fire=False, destroy_affected_by_griefing=False, fire_affected_by_griefing=False, fuse_length=[0.0, 0.0], fuse_lit=False, max_resistance=3.40282e+38, power=3, damage_scaling=1.0, toggles_blocks=False, knockback_scaling=1.0, particle_effect=ExplosionParticleEffect.Explosion, sound_effect='explode', negates_fall_damage=False, allow_underwater=True)
Defines how the entity explodes.
Filter
all_slots_empty(value=FilterEquipmentDomain.Any, *, subject=FilterSubject.Self, operator=FilterOperation.Equals)
classmethod
Returns true when the designated equipment location for the subject entity is completely empty.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
FilterEquipmentDomain
|
The equipment location to test. Defaults to FilterEquipmentDomain.Any. |
Any
|
subject
|
FilterSubject
|
Subject to test the value against. Defaults to FilterSubject.Self. |
Self
|
operator
|
FilterOperation
|
Operation to use in testing. Defaults to FilterOperation.Equals. |
Equals
|
any_slot_empty(value=FilterEquipmentDomain.Any, *, subject=FilterSubject.Self, operator=FilterOperation.Equals)
classmethod
Returns true when the designated equipment location for the subject entity has any empty slot.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
FilterEquipmentDomain
|
The equipment location to test. Defaults to FilterEquipmentDomain.Any. |
Any
|
subject
|
FilterSubject
|
Subject to test the value against. Defaults to FilterSubject.Self. |
Self
|
operator
|
FilterOperation
|
Operation to use in testing. Defaults to FilterOperation.Equals. |
Equals
|
FireImmune
Bases: _component
__init__()
Allows an entity to take 0 damage from fire.
Float
Bases: _ai_goal
__init__(sink_with_passengers=False)
Allows an entity to float on water. Passengers will be kicked out the moment the mob's head goes underwater, which may not happen for tall mobs.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
FloatWander
Bases: _ai_goal
__init__(float_duration=(0.0, 0.0), must_reach=False, priority=0, random_reselect=False, xz_dist=10, y_dist=7, y_offset=0.0)
Compels an entity to float around in a random direction, similar to the ghast entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
float_duration
|
tuple[Seconds, Seconds]
|
Range of time in seconds the mob will float around before landing and choosing to do something else. Defaults to (0.0, 0.0). |
(0.0, 0.0)
|
must_reach
|
bool
|
If true, the point has to be reachable to be a valid target. Defaults to False. |
False
|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. Defaults to 0. |
0
|
random_reselect
|
bool
|
If true, the mob will randomly pick a new point while moving to the previously selected one. Defaults to False. |
False
|
xz_dist
|
int
|
Distance in blocks on ground that the mob will look for a new spot to move to. Must be at least 1. Defaults to 10. |
10
|
y_dist
|
int
|
Distance in blocks that the mob will look up or down for a new spot to move to. Must be at least 1. Defaults to 7. |
7
|
y_offset
|
float
|
Height in blocks to add to the selected target position. Defaults to 0.0. |
0.0
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
FlyingSpeed
Bases: _component
__init__(value)
Sets the speed, in Blocks, at which the entity flies.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
int
|
Flying speed in blocks per tick. |
required |
FlyingSpeedMeters
Bases: _component
__init__(value, max=None)
A component that defines the entity's flying movement speed in meters per second.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
float
|
Flying movement speed of the entity in meters per second. |
required |
max
|
float
|
Maximum flying movement speed of the entity in meters per second. Defaults to None. |
None
|
FollowMob
Bases: _ai_goal
__init__(search_range=0, speed_multiplier=1.0, stop_distance=2)
Compels an entity to follow and gather around other mobs of the same type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
search_range
|
int
|
The distance in blocks it will look for a mob to follow. Defaults to 0. |
0
|
speed_multiplier
|
float
|
Movement speed multiplier of the mob when using this AI Goal. Defaults to 1.0. |
1.0
|
stop_distance
|
int
|
The distance in blocks this mob stops from the mob it is following. Defaults to 2. |
2
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
FollowOwner
Bases: _ai_goal
__init__(can_teleport=True, ignore_vibration=True, max_distance=60.0, speed_multiplier=1.0, start_distance=10.0, stop_distance=2.0, post_teleport_distance=1)
Compels an entity to follow a player marked as an owner.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
FollowParent
Bases: _ai_goal
__init__(speed_multiplier=1.0)
Compels an entity that has been tagged as a baby to follow their parent around.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
FollowRange
Bases: _component
__init__(value, max_range=None)
Defines the range of blocks that a mob will pursue a target.
FrictionModifier
Bases: _component
__init__(value)
Defines how much friction affects this entity.
Health
Bases: _component
__init__(value, min=None, max=None)
Sets the amount of health this mob has.
HorseJumpStrength
Bases: _component
__init__(range_min, range_max)
Allows this mob to jump higher when being ridden by a player.
HurtByTarget
Bases: _ai_goal
__init__(alert_same_type=False, entity_types=None, max_dist=16, must_see=False, must_see_forget_duration=3.0, reevaluate_description=False, sprint_speed_multiplier=1.0, walk_speed_multiplier=1.0, hurt_owner=False)
Compels an entity to react when hit by set target.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
IgnoreCannotBeAttacked
Bases: _component
__init__(filters=None)
When set, blocks entities from attacking the owner entity unless they have the minecraft:ignore_cannot_be_attacked component.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filters
|
Filter
|
Defines which entities are exceptions and are allowed to be attacked by the owner entity, potentially attacked entity is subject "other". If this is not specified then all attacks by the owner are allowed. |
None
|
InputGroundControlled
Bases: _component
__init__()
Allows a ridable entity the ability to be controlled using keyboard controls when ridden by a player.
InsideBlockNotifier
Bases: _component
__init__()
Verifies whether the entity is inside any of the listed blocks.
InstantDespawn
Bases: _component
__init__(remove_child_entities=False)
Interact
Bases: _component
__init__()
Defines the interactions that can be used with an entity.
add_interaction(event, filter=None, add_items=None, cooldown=0.0, cooldown_after_being_attacked=0.0, drop_item_slot=-1, equip_item_slot=-1, health_amount=0, hurt_item=0, interact_text=None, play_sounds=None, spawn_entities=None, spawn_items=None, swing=False, transform_to_item=None, use_item=False, vibration=Vibrations.EntityInteract, repair_entity_item=None)
Adds an interaction to the entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event
|
str
|
Event to trigger when the interaction occurs. |
required |
filter
|
Filter
|
Filter to determine which entities can interact with this entity. Defaults to None. |
None
|
add_items
|
str
|
File path, relative to the Behavior Pack's path, to the loot table file. Defaults to None. |
None
|
cooldown
|
float
|
Time in seconds before this entity can be interacted with again. Defaults to 0.0. |
0.0
|
cooldown_after_being_attacked
|
float
|
Time in seconds before this entity can be interacted with after being attacked. Defaults to 0.0. |
0.0
|
drop_item_slot
|
int | Slots
|
Slot from which the item will be dropped when interacting with this entity. Defaults to -1. |
-1
|
equip_item_slot
|
int | Slots
|
Slot from which the item will be equipped when interacting with this entity. Defaults to -1. |
-1
|
health_amount
|
int
|
The amount of health this entity will recover or hurt when interacting with this item. Negative values will harm the entity. Defaults to 0. |
0
|
hurt_item
|
int
|
The amount of damage the item will take when used to interact with this entity. A value of 0 means the item won't lose durability. Defaults to 0. |
0
|
interact_text
|
str
|
Text to show while playing with touch-screen controls when the player is able to interact in this way with this entity. Defaults to None. |
None
|
play_sounds
|
str
|
One or more sound identifiers to play when the interaction occurs. Defaults to None. |
None
|
spawn_entities
|
str
|
Entity to spawn when the interaction occurs. Defaults to None. |
None
|
spawn_items
|
str
|
Loot table with items to drop on the ground upon successful interaction. Defaults to None. |
None
|
swing
|
bool
|
If true, the player will do the 'swing' animation when interacting with this entity. Defaults to False. |
False
|
transform_to_item
|
str
|
The item used will transform to this item upon successful interaction. Format: itemName:auxValue. Defaults to None. |
None
|
use_item
|
bool
|
If true, the interaction will use an item. Defaults to False. |
False
|
vibration
|
str
|
Vibration to emit when the interaction occurs. Admitted values are entity_interact (used by default), shear, and none (no vibration emitted). Defaults to None. |
EntityInteract
|
repair_entity_item
|
tuple[Slots, int]
|
Slot and amount to repair the item used to interact with this entity. Defaults to None. |
None
|
particle_on_start(particle_type, particle_offset_towards_interactor=False, particle_y_offset=0.0)
Adds a particle effect when the interaction starts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
particle_type
|
str
|
Name of the particle system to run. |
required |
particle_offset_towards_interactor
|
bool
|
Whether or not the particle will appear closer to who performed the interaction. Defaults to False. |
False
|
particle_y_offset
|
float
|
Vertical offset of the particle system. Defaults to 0.0. |
0.0
|
Inventory
Bases: _component
__init__(additional_slots_per_strength=0, can_be_siphoned_from=False, container_type=ContainerType.Inventory, inventory_size=5, private=False, restrict_to_owner=False)
Defines how an entity's inventory is managed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
additional_slots_per_strength
|
int
|
Number of slots that this entity can gain per extra strength. Defaults to 0. |
0
|
can_be_siphoned_from
|
bool
|
If true, the contents of this inventory can be removed by a hopper. Defaults to False. |
False
|
container_type
|
str
|
Type of container the entity has. Can be horse, minecart_chest, chest_boat, minecart_hopper, inventory, container or hopper. Defaults to inventory. |
Inventory
|
inventory_size
|
int
|
Number of slots the container has. Defaults to 5. |
5
|
private
|
bool
|
If true, the entity will not drop its inventory on death. Defaults to False. |
False
|
restrict_to_owner
|
bool
|
If true, the entity's inventory can only be accessed by its owner or itself. Defaults to False. |
False
|
IsBaby
Bases: _component
__init__()
Sets that this entity is a baby.
IsCharged
Bases: _component
__init__()
Sets that this entity is charged.
IsChested
Bases: _component
__init__()
Sets that this entity is currently carrying a chest.
IsIgnited
Bases: _component
__init__()
Sets that this entity is currently on fire.
IsIllagerCaptain
Bases: _component
__init__()
Sets that this entity is an illager captain.
IsSaddled
Bases: _component
__init__()
Sets that this entity is currently saddled.
IsSheared
Bases: _component
__init__()
Sets that this entity is currently sheared.
IsStackable
Bases: _component
__init__()
Sets that this entity can be stacked.
IsStunned
Bases: _component
__init__()
Sets that this entity is currently stunned.
IsTamed
Bases: _component
__init__()
Sets that this entity is currently tamed.
ItemHopper
Bases: _component
__init__()
Allows an entity to function like a hopper block.
JumpStatic
Bases: _component
__init__(jump_power=0.42)
Gives the entity the ability to jump.
KnockbackResistance
Bases: _component
__init__(value)
Determines the amount of knockback resistance that the item has.
KnockbackRoar
Bases: _ai_goal
__init__(attack_time=0.5, cooldown_time=0.1, damage_filters=None, duration=1, knockback_damage=6, knockback_filters=None, knockback_height_cap=0.4, knockback_horizontal_strength=4, knockback_range=4, knockback_vertical_strength=4)
Compels an entity to emit a roar effect that knocks back other entities in a set radius from where the roar was emitted.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
LavaMovement
Bases: _component
__init__(value)
Defines the speed with which an entity can move through lava.
LayDown
Bases: _ai_goal
__init__(interval=120, random_stop_interval=120)
Compels an entity randomly lay down for a period of time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
interval
|
int
|
A random value to determine at what intervals something can occur. This has a 1/interval chance to choose this goal. Defaults to 120. |
120
|
random_stop_interval
|
int
|
A random value to determine at what interval the AI goal can stop. This has a 1/interval chance to stop this goal. Defaults to 120. |
120
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
LeapAtTarget
Bases: _ai_goal
__init__(must_be_on_ground=True, set_persistent=False, target_dist=0.3, yd=0.0)
Compels an entity to jump towards a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
must_be_on_ground
|
bool
|
If true, the mob will only jump at its target if its on the ground. Setting it to false will allow it to jump even if its already in the air. Defaults to True. |
True
|
set_persistent
|
bool
|
Allows the entity to be set to persist upon targeting a player. Defaults to False. |
False
|
target_dist
|
float
|
Distance in blocks the mob jumps when leaping at its target. Defaults to 0.3. |
0.3
|
yd
|
float
|
Height in blocks the mob jumps when leaping at its target. Defaults to 0.0. |
0.0
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
LookAtPlayer
Bases: _ai_goal
__init__(angle_of_view_horizontal=360, angle_of_view_vertical=360, look_distance=8.0, look_time=(2, 4), probability=0.02, target_distance=0.6)
Compels an entity to look at the player by rotating the head bone pose within a set limit.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
LookAtTarget
Bases: _ai_goal
__init__(angle_of_view_horizontal=360, angle_of_view_vertical=360, look_distance=8.0, look_time=(2, 4), probability=0.02, target_distance=0.6)
Compels an entity to look at the target by rotating the head bone pose within a set limit.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
LookedAt
Bases: _component
__init__(field_of_view=26, filters=None, find_players_only=False, line_of_sight_obstruction_type=LineOfSightObstructionType.Collision, look_at_locations=None, looked_at_cooldown=(0, 0), looked_at_event=None, not_looked_at_event=None, scale_fov_by_distance=True, search_radius=10, set_target=LootedAtSetTarget.OnceAndStopScanning)
Defines the behavior when another entity looks at the owner entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field_of_view
|
float
|
The field of view in degrees. Defaults to 26. |
26
|
filters
|
Filter
|
Defines which entities can trigger the looked_at_event. Defaults to None. |
None
|
find_players_only
|
bool
|
If true, only players will trigger the looked_at_event. Defaults to False. |
False
|
line_of_sight_obstruction_type
|
LineOfSightObstructionType
|
The type of obstruction to consider when checking line of sight. Defaults to LineOfSightObstructionType.Collision. |
Collision
|
look_at_locations
|
list[LookAtLocation]
|
List of locations to look at. Defaults to None. |
None
|
looked_at_cooldown
|
tuple[float, float]
|
The cooldown range in seconds. Defaults to (0, 0). |
(0, 0)
|
looked_at_event
|
str
|
Event to trigger when the entity is looked at. Defaults to None. |
None
|
not_looked_at_event
|
str
|
Event to trigger when the entity is no longer looked at. Defaults to None. |
None
|
scale_fov_by_distance
|
bool
|
If true, the field of view will be scaled based on the distance between the entities. Defaults to True. |
True
|
search_radius
|
float
|
The radius in blocks to search for entities. Defaults to 10. |
10
|
set_target
|
LootedAtSetTarget
|
The target selection strategy. Defaults to LootedAtSetTarget.OnceAndStopScanning. |
OnceAndStopScanning
|
Loot
Bases: _component
__init__(path)
Sets the loot table for what items this entity drops upon death.
MarkVariant
Bases: _component
__init__(value)
Additional variant value. Can be used to further differentiate variants.
MeleeAttack
Bases: _ai_goal
__init__(attack_once=False, cooldown_time=1, inner_boundary_time_increase=0.25, max_path_time=0.55, melee_fov=90, min_path_time=0.2, outer_boundary_time_increase=0.5, path_fail_time_increase=0.75, path_inner_boundary=16, path_outer_boundary=32, random_stop_interval=0, reach_multiplier=2, require_complete_path=False, speed_multiplier=1, track_target=False, x_max_rotation=30, y_max_head_rotation=30, can_spread_on_fire=False)
Compels entities to make close combat melee attacks.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
MeleeBoxAttack
Bases: _ai_goal
__init__(attack_once=False, attack_types=[], can_spread_on_fire=False, cooldown_time=1, horizontal_reach=0.8, inner_boundary_time_increase=0.25, max_path_time=0.55, melee_fov=90, min_path_time=0.2, outer_boundary_time_increase=0.5, path_fail_time_increase=0.75, path_inner_boundary=16, path_outer_boundary=32, random_stop_interval=0, box_increase=2, require_complete_path=False, set_persistent=False, speed_multiplier=1, track_target=False, x_max_rotation=30, y_max_head_rotation=30)
Compels an entity to attack a target by stomping on them.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
attack_once
|
bool
|
If true, the entity will only use this attack behavior once. Defaults to False. |
False
|
attack_types
|
list[str]
|
Defines the entity types this entity will attack. Defaults to []. |
[]
|
can_spread_on_fire
|
bool
|
If the entity is on fire, this allows the entity's target to catch on fire after being hit. Defaults to False. |
False
|
cooldown_time
|
Seconds
|
Cooldown time (in seconds) between attacks. Defaults to 1. |
1
|
horizontal_reach
|
float
|
The attack reach of the entity will be a box with the size of the entity's bounds increased by this value in all horizontal directions. Defaults to 0.8. |
0.8
|
inner_boundary_time_increase
|
Seconds
|
Time (in seconds) to add to attack path recalculation when the target is beyond the "path_inner_boundary". Defaults to 0.25. |
0.25
|
max_path_time
|
Seconds
|
Maximum base time (in seconds) to recalculate new attack path to target (before increases applied). Defaults to 0.55. |
0.55
|
melee_fov
|
int
|
Field of view (in degrees) when using the sensing component to detect an attack target. Defaults to 90. |
90
|
min_path_time
|
Seconds
|
Minimum base time (in seconds) to recalculate new attack path to target (before increases applied). Defaults to 0.2. |
0.2
|
outer_boundary_time_increase
|
Seconds
|
Time (in seconds) to add to attack path recalculation when the target is beyond the "path_outer_boundary". Defaults to 0.5. |
0.5
|
path_fail_time_increase
|
Seconds
|
Time (in seconds) to add to attack path recalculation when this entity cannot move along the current path. Defaults to 0.75. |
0.75
|
path_inner_boundary
|
float
|
Distance at which to increase attack path recalculation by "inner_boundary_tick_increase". Defaults to 16. |
16
|
path_outer_boundary
|
float
|
Distance at which to increase attack path recalculation by "outer_boundary_tick_increase". Defaults to 32. |
32
|
random_stop_interval
|
int
|
This entity will have a 1 in N chance to stop its current attack, where N = "random_stop_interval". Defaults to 0. |
0
|
box_increase
|
float
|
Used with the base size of the entity to determine minimum target-distance before trying to deal attack damage. Defaults to 2. |
2
|
require_complete_path
|
bool
|
Toggles (on/off) the need to have a full path from the entity to the target when using this melee attack behavior. Defaults to False. |
False
|
set_persistent
|
bool
|
Allows the entity to be set to persist upon targeting a player. Defaults to False. |
False
|
speed_multiplier
|
float
|
This multiplier modifies the attacking entity's speed when moving toward the target. Defaults to 1. |
1
|
track_target
|
bool
|
Allows the entity to track the attack target, even if the entity has no sensing. Defaults to False. |
False
|
x_max_rotation
|
int
|
Maximum rotation (in degrees), on the X-axis, this entity can rotate while trying to look at the target. Defaults to 30. |
30
|
y_max_head_rotation
|
int
|
Maximum rotation (in degrees), on the Y-axis, this entity can rotate its head while trying to look at the target. Defaults to 30. |
30
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
MobEffect
Bases: _component
__init__(mob_effect, entity_filter, cooldown_time=0, effect_range=0.2, effect_time=10)
Applies a mob effect to entities that get within range.
MoveToBlock
Bases: _ai_goal
__init__(target_blocks, goal_radius=0.5, search_height=1, search_range=0, speed_multiplier=1.0, start_chance=1.0, stay_duration=0.0, target_offset=(0, 0, 0), target_selection_method='nearest', tick_interval=20)
Compels a mob to move towards a block.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
MoveToLand
Bases: _ai_goal
__init__(goal_radius=0.5, search_count=10, search_height=1, search_range=0, speed_multiplier=1)
Compels an entity to move to land when on land.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
goal_radius
|
float
|
Distance in blocks within the mob considers it has reached the goal. This is the "wiggle room" to stop the AI from bouncing back and forth trying to reach a specific spot. Defaults to 0.5. |
0.5
|
search_count
|
int
|
The number of blocks each tick that the mob will check within its search range and height for a valid block to move to. A value of 0 will have the mob check every block within range in one tick. Defaults to 10. |
10
|
search_height
|
int
|
Height in blocks the mob will look for land to move towards. Defaults to 1. |
1
|
search_range
|
int
|
The distance in blocks it will look for land to move towards. Defaults to 0. |
0
|
speed_multiplier
|
float
|
Movement speed multiplier of the mob when using this AI Goal. Defaults to 1. |
1
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
MoveToLava
Bases: _ai_goal
__init__(goal_radius=0.5, search_count=10, search_height=1, search_range=0, speed_multiplier=1)
Compels an entity to move to lava when on lava.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
goal_radius
|
float
|
Distance in blocks within the mob considers it has reached the goal. This is the "wiggle room" to stop the AI from bouncing back and forth trying to reach a specific spot. Defaults to 0.5. |
0.5
|
search_count
|
int
|
The number of blocks each tick that the mob will check within its search range and height for a valid block to move to. A value of 0 will have the mob check every block within range in one tick. Defaults to 10. |
10
|
search_height
|
int
|
Height in blocks the mob will look for lava to move towards. Defaults to 1. |
1
|
search_range
|
int
|
The distance in blocks it will look for lava to move towards. Defaults to 0. |
0
|
speed_multiplier
|
float
|
Movement speed multiplier of the mob when using this AI Goal. Defaults to 1. |
1
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
MoveToWater
Bases: _ai_goal
__init__(goal_radius=0.5, search_count=10, search_height=1, search_range=0, speed_multiplier=1)
Compels an entity to move to water when on land.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
goal_radius
|
float
|
Distance in blocks within the mob considers it has reached the goal. This is the "wiggle room" to stop the AI from bouncing back and forth trying to reach a specific spot. Defaults to 0.5. |
0.5
|
search_count
|
int
|
The number of blocks each tick that the mob will check within its search range and height for a valid block to move to. A value of 0 will have the mob check every block within range in one tick. Defaults to 10. |
10
|
search_height
|
int
|
Height in blocks the mob will look for water to move towards. Defaults to 1. |
1
|
search_range
|
int
|
The distance in blocks it will look for water to move towards. Defaults to 0. |
0
|
speed_multiplier
|
float
|
Movement speed multiplier of the mob when using this AI Goal. Defaults to 1. |
1
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
MoveTowardsTarget
Bases: _ai_goal
__init__(within_radius=0.0, speed_multiplier=1.0)
Compels an entity to move towards a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
within_radius
|
float
|
Defines the radius in blocks that the mob tries to be from the target. A value of 0 means it tries to occupy the same block as the target. Defaults to 0.0. |
0.0
|
speed_multiplier
|
float
|
Movement speed multiplier of the mob when using this AI Goal. Defaults to 1.0. |
1.0
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
Movement
Bases: _component
__init__(value, max=None)
Defined the movement speed of the entity in block/tick.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
int
|
The movement speed of the entity in block/tick. |
required |
max
|
int
|
The maximum movement speed of the entity in block/tick. Defaults to None. |
None
|
MovementMeters
Bases: _component
__init__(value, max=None)
A component that defines the entity's movement speed in meters per second.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
float
|
Movement speed of the entity in meters per second. |
required |
max
|
float
|
Maximum movement speed of the entity in meters per second. Defaults to None. |
None
|
MovementType
Bases: _component
Amphibious(max_turn=30)
Allows the mob to swim in water and walk on land.
Basic(max_turn=30)
Defines the movement of an entity.
Dolphin()
Allows the mob to swim in water like a dolphin.
Fly(max_turn=30, start_speed=0.1, speed_when_turning=0.2)
Causes the mob to fly.
Generic(max_turn=30)
Allows a mob to fly, swim, climb, etc.
Glide(max_turn=30, start_speed=0.1, speed_when_turning=0.2)
Is the move control for a flying mob that has a gliding movement.
Hover(max_turn=30)
Causes the mob to hover.
Jump(max_turn=30, jump_delay=(0, 0))
Causes the mob to jump as it moves with a specified delay between jumps.
Skip(max_turn=30)
Causes the mob to hop as it moves.
Sway(max_turn=30, sway_amplitude=0.05, sway_frequency=0.5)
Causes the mob to sway side to side giving the impression it is swimming.
__init__()
Defines the movement of an entity.
NPC
Bases: _component
__init__(skin_list)
Allows an entity to be an NPC.
NavigationType
Bases: _component
Climb(avoid_damage_blocks=False, avoid_portals=False, avoid_sun=False, avoid_water=False, can_breach=False, can_break_doors=False, can_float=False, can_jump=True, can_open_doors=False, can_open_iron_doors=False, can_pass_doors=True, can_path_from_air=False, can_path_over_lava=False, can_path_over_water=False, can_sink=True, can_swim=False, can_walk=True, can_walk_in_lava=False, is_amphibious=False, blocks_to_avoid=[])
Allows this entity to generate paths that include vertical walls like the vanilla Spiders do.
Float(avoid_damage_blocks=False, avoid_portals=False, avoid_sun=False, avoid_water=False, can_breach=False, can_break_doors=False, can_jump=True, can_float=False, can_open_doors=False, can_open_iron_doors=False, can_pass_doors=True, can_path_from_air=False, can_path_over_lava=False, can_path_over_water=False, can_sink=True, can_swim=False, can_walk=True, can_walk_in_lava=False, is_amphibious=False, blocks_to_avoid=[])
Allows this entity to generate paths by flying around the air like the regular Ghast.
Fly(avoid_damage_blocks=False, avoid_portals=False, avoid_sun=False, avoid_water=False, can_breach=False, can_break_doors=False, can_jump=True, can_float=False, can_open_doors=False, can_open_iron_doors=False, can_pass_doors=True, can_path_from_air=False, can_path_over_lava=False, can_path_over_water=False, can_sink=True, can_swim=False, can_walk=True, can_walk_in_lava=False, is_amphibious=False, blocks_to_avoid=[])
Allows this entity to generate paths in the air like the vanilla Parrots do.
Generic(avoid_damage_blocks=False, avoid_portals=False, avoid_sun=False, avoid_water=False, can_breach=False, can_break_doors=False, can_jump=True, can_float=False, can_open_doors=False, can_open_iron_doors=False, can_pass_doors=True, can_path_from_air=False, can_path_over_lava=False, can_path_over_water=False, can_sink=True, can_swim=False, can_walk=True, can_walk_in_lava=False, is_amphibious=False, blocks_to_avoid=[])
Allows this entity to generate paths by walking, swimming, flying and/or climbing around and jumping up and down a block.
Hover(avoid_damage_blocks=False, avoid_portals=False, avoid_sun=False, avoid_water=False, can_breach=False, can_break_doors=False, can_jump=True, can_float=False, can_open_doors=False, can_open_iron_doors=False, can_pass_doors=True, can_path_from_air=False, can_path_over_lava=False, can_path_over_water=False, can_sink=True, can_swim=False, can_walk=True, can_walk_in_lava=False, is_amphibious=False, blocks_to_avoid=[])
Allows this entity to generate paths in the air like the vanilla Bees do. Keeps them from falling out of the skies and doing predictive movement.
Swim(avoid_damage_blocks=False, avoid_portals=False, avoid_sun=False, avoid_water=False, can_breach=False, can_break_doors=False, can_jump=True, can_float=False, can_open_doors=False, can_open_iron_doors=False, can_pass_doors=True, can_path_from_air=False, can_path_over_lava=False, can_path_over_water=False, can_sink=True, can_swim=False, can_walk=True, can_walk_in_lava=False, is_amphibious=False, blocks_to_avoid=[])
Allows this entity to generate paths that include water.
Walk(avoid_damage_blocks=False, avoid_portals=False, avoid_sun=False, avoid_water=False, can_breach=False, can_break_doors=False, can_jump=True, can_float=False, can_open_doors=False, can_open_iron_doors=False, can_pass_doors=True, can_path_from_air=False, can_path_over_lava=False, can_path_over_water=False, can_sink=True, can_swim=False, can_walk=True, can_walk_in_lava=False, is_amphibious=False, blocks_to_avoid=[])
llows this entity to generate paths by walking around and jumping up and down a block like regular mobs.
__init__()
Allows this entity to generate paths by walking, swimming, flying and/or climbing around and jumping up and down a block.
NearestAttackableTarget
Bases: _ai_goal
__init__(attack_interval=0, attack_interval_min=0, attack_owner=False, must_reach=False, must_see=False, must_see_forget_duration=3.0, persist_time=0.0, reselect_targets=False, scan_interval=10, set_persistent=False, target_invisible_multiplier=0.7, target_search_height=-0.1, target_sneak_visibility_multiplier=0.8, within_radius=0.0)
Allows an entity to attack the closest target within a given subset of specific target types.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
NearestPrioritizedAttackableTarget
Bases: _ai_goal
__init__(attack_interval=0, attack_interval_min=0, attack_owner=False, must_reach=False, must_see=False, must_see_forget_duration=3.0, persist_time=0.0, reevaluate_description=False, reselect_targets=False, scan_interval=10, set_persistent=False, target_invisible_multiplier=0.7, target_search_height=-0.1, target_sneak_visibility_multiplier=0.8, within_radius=0.0)
Allows an entity to attack the closest target within a given subset of specific target types.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
OcelotAttack
Bases: _ai_goal
__init__(cooldown_time=1, max_distance=15, max_sneak_range=15, max_sprint_range=4, reach_multiplier=2, sneak_speed_multiplier=0.6, sprint_speed_multiplier=1.33, walk_speed_multiplier=0.8, x_max_rotation=30, y_max_head_rotation=30)
Allows an entity to attack by sneaking and pouncing.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cooldown_time
|
int
|
Time (in seconds) between attacks. Defaults to 1. |
1
|
max_distance
|
int
|
Max distance from the target, this entity will use this attack behavior. Defaults to 15. |
15
|
max_sneak_range
|
int
|
Max distance from the target, this entity starts sneaking. Defaults to 15. |
15
|
max_sprint_range
|
int
|
Max distance from the target, this entity starts sprinting (sprinting takes priority over sneaking). Defaults to 4. |
4
|
reach_multiplier
|
int
|
Used with the base size of the entity to determine minimum target-distance before trying to deal attack damage. Defaults to 2. |
2
|
sneak_speed_multiplier
|
float
|
Modifies the attacking entity's movement speed while sneaking. Defaults to 0.6. |
0.6
|
sprint_speed_multiplier
|
float
|
Modifies the attacking entity's movement speed while sprinting. Defaults to 1.33. |
1.33
|
walk_speed_multiplier
|
float
|
Modifies the attacking entity's movement speed when not sneaking or sprinting, but still within attack range. Defaults to 0.8. |
0.8
|
x_max_rotation
|
int
|
Maximum rotation (in degrees), on the X-axis, this entity can rotate while trying to look at the target. Defaults to 30. |
30
|
y_max_head_rotation
|
int
|
Maximum rotation (in degrees), on the Y-axis, this entity can rotate its head while trying to look at the target. Defaults to 30. |
30
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
OutOfControl
Bases: _component
__init__()
Defines the entity's 'out of control' state.
OwnerHurtByTarget
Bases: _ai_goal
__init__(entity_types=None, cooldown=0, filters=None, max_dist=16, must_see=False, must_see_forget_duration=3.0, reevaluate_description=False, sprint_speed_multiplier=1.0, walk_speed_multiplier=1.0)
Compels an entity to react when the owner is hit by a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entity_types
|
Filter
|
List of entity types that this mob can target if they hurt their owner. Defaults to None. |
None
|
cooldown
|
Seconds
|
The amount of time in seconds that the mob has to wait before selecting a target of the same type again. Defaults to 0. |
0
|
filters
|
Filter
|
Conditions that make this entry in the list valid. Defaults to None. |
None
|
max_dist
|
int
|
Maximum distance this mob can be away to be a valid choice. Defaults to 16. |
16
|
must_see
|
bool
|
If true, the mob has to be visible to be a valid choice. Defaults to False. |
False
|
must_see_forget_duration
|
float
|
Determines the amount of time in seconds that this mob will look for a target before forgetting about it and looking for a new one when the target isn't visible any more. Defaults to 3.0. |
3.0
|
reevaluate_description
|
bool
|
If true, the mob will stop being targeted if it stops meeting any conditions. Defaults to False. |
False
|
sprint_speed_multiplier
|
float
|
Multiplier for the running speed. A value of 1.0 means the speed is unchanged. Defaults to 1.0. |
1.0
|
walk_speed_multiplier
|
float
|
Multiplier for the walking speed. A value of 1.0 means the speed is unchanged. Defaults to 1.0. |
1.0
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
OwnerHurtTarget
Bases: _ai_goal
__init__(entity_types=None, cooldown=0, filters=None, max_dist=16, must_see=False, must_see_forget_duration=3.0, reevaluate_description=False, sprint_speed_multiplier=1.0, walk_speed_multiplier=1.0)
Compels an entity to react when the owner hits a target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entity_types
|
Filter
|
List of entity types that this mob can target if they hurt their owner. Defaults to None. |
None
|
cooldown
|
Seconds
|
The amount of time in seconds that the mob has to wait before selecting a target of the same type again. Defaults to 0. |
0
|
filters
|
Filter
|
Conditions that make this entry in the list valid. Defaults to None. |
None
|
max_dist
|
int
|
Maximum distance this mob can be away to be a valid choice. Defaults to 16. |
16
|
must_see
|
bool
|
If true, the mob has to be visible to be a valid choice. Defaults to False. |
False
|
must_see_forget_duration
|
float
|
Determines the amount of time in seconds that this mob will look for a target before forgetting about it and looking for a new one when the target isn't visible any more. Defaults to 3.0. |
3.0
|
reevaluate_description
|
bool
|
If true, the mob will stop being targeted if it stops meeting any conditions. Defaults to False. |
False
|
sprint_speed_multiplier
|
float
|
Multiplier for the running speed. A value of 1.0 means the speed is unchanged. Defaults to 1.0. |
1.0
|
walk_speed_multiplier
|
float
|
Multiplier for the walking speed. A value of 1.0 means the speed is unchanged. Defaults to 1.0. |
1.0
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
Panic
Bases: _ai_goal
__init__(damage_sources=DamageCause.All, force=False, ignore_mob_damage=False, panic_sound=None, prefer_water=False, sound_interval=0, speed_multiplier=1.0)
Compels an entity to react when it receives damage.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
Physics
Bases: _component
__init__(has_collision=True, has_gravity=True, push_towards_closest_space=False)
Defines physics properties of an actor, including if it is affected by gravity or if it collides with objects.
PlayerRideTamed
Bases: _ai_goal
__init__()
Allows an entity to be rideable after being tamed by a player.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
PreferredPath
Bases: _component
__init__(default_block_cost=0, jump_cost=0, max_fall_blocks=3)
Specifies costing information for mobs that prefer to walk on preferred paths.
Projectile
Bases: _component
__init__(anchor=0, angle_offset=0, catch_fire=False, crit_particle_on_hurt=False, destroy_on_hurt=False, fire_affected_by_griefing=False, gravity=0.05, hit_sound='', hit_ground_sound='', homing=False, inertia=0.09, is_dangerous=False, knockback=True, lightning=False, liquid_inertia=0.6, multiple_targets=True, offset=(0, 0, 0), on_fire_timer=0.0, power=1.3, reflect_on_hurt=False, shoot_sound='', shoot_target=True, should_bounce=False, splash_potion=False, splash_range=4, stop_on_hurt=False, uncertainty_base=0, uncertainty_multiplier=0)
Allows the entity to be a thrown entity.
on_hit(catch_fire=False, douse_fire=False, ignite=False, on_fire_time=0, potion_effect=-1, spawn_aoe_cloud=False, teleport_owner=False)
summary
Parameters:
Name | Type | Description | Default |
---|---|---|---|
catch_fire
|
bool
|
Determines if the struck object is set on fire. Defaults to False. |
False
|
douse_fire
|
bool
|
If the target is on fire, then douse the fire. Defaults to False. |
False
|
ignite
|
bool
|
Determines if a fire may be started on a flammable target. Defaults to False. |
False
|
on_fire_time
|
float
|
The amount of time a target will remain on fire. Defaults to 0. |
0
|
potion_effect
|
int
|
Defines the effect the arrow will apply to the entity it hits. Defaults to -1. |
-1
|
spawn_aoe_cloud
|
bool
|
Potion spawns an area of effect cloud. See the table below for all spawn_aoe_cloud parameters. Defaults to False. |
False
|
teleport_owner
|
bool
|
Determines if the owner is transported on hit. Defaults to False. |
False
|
PushThrough
Bases: _component
__init__(value)
Sets the distance through which the entity can push through.
This component sets the distance through which an entity can exert force to move through other entities or blocks.
Parameters
value : float, optional The distance in blocks that the entity can push through. It can be thought of as a "buffer zone" that the entity creates around itself to navigate through crowded spaces. The default value is 0.0, which means the entity follows the standard collision rules of the game and cannot move through solid entities or blocks. Positive values increase the entity's ability to move through crowds, while negative values are rounded to 0.
Pushable
Bases: _component
__init__(is_pushable=True, is_pushable_by_piston=True)
Defines what can push an entity between other entities and pistons.
RamAttack
Bases: _ai_goal
__init__(baby_knockback_modifier=0.333333, cooldown_range=[10, 20], knockback_force=5, knockback_height=0.1, min_ram_distance=0.0, pre_ram_sound=None, ram_distance=0.0, ram_impact_sound=None, ram_speed=2.0, run_speed=1.0)
Compels an entity to search for a random target and, if a direct path exists between the entity and the target, it will perform a charge. If the attack hits, the target will be knocked back based on the entity's speed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
baby_knockback_modifier
|
float
|
The modifier to knockback that babies have. Defaults to 0.333333. |
0.333333
|
cooldown_range
|
list[int, int]
|
Minimum and maximum cooldown time-range (positive, in seconds) between each attempted ram attack. Defaults to [10, 20]. |
[10, 20]
|
knockback_force
|
float
|
The force of the ram attack knockback. Defaults to 5. |
5
|
knockback_height
|
float
|
The height of the ram attack knockback. Defaults to 0.1. |
0.1
|
min_ram_distance
|
float
|
The minimum distance the entity can start a ram attack. Defaults to 0.0. |
0.0
|
pre_ram_sound
|
str
|
The sound to play when an entity is about to perform a ram attack. Defaults to None. |
None
|
ram_distance
|
float
|
The distance the mob start to run with ram speed. Defaults to 0.0. |
0.0
|
ram_impact_sound
|
str
|
The sound to play when an entity is impacting on a ram attack. Defaults to None. |
None
|
ram_speed
|
float
|
The entity's speed when charging toward the target. Defaults to 2.0. |
2.0
|
run_speed
|
float
|
The entity's speed when running toward the target. Defaults to 1.0. |
1.0
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
RandomBreach
Bases: _ai_goal
__init__(interval=120, speed_multiplier=1.0, xz_dist=10, y_dist=7, cooldown_time=10)
Compels an entity to breach the surface of the water at a random interval.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
interval
|
int
|
A random value to determine when to randomly move somewhere. This has a 1/interval chance to choose this goal. Defaults to 120. |
120
|
speed_multiplier
|
float
|
Movement speed multiplier of the entity when using this AI Goal. Defaults to 1.0. |
1.0
|
xz_dist
|
int
|
Distance in blocks on ground that the entity will look for a new spot to move to. Must be at least 1. Defaults to 10. |
10
|
y_dist
|
int
|
Distance in blocks that the entity will look up or down for a new spot to move to. Must be at least 1. Defaults to 7. |
7
|
cooldown_time
|
Seconds
|
The amount of time in seconds that the mob has to wait before selecting a target of the same type again. Defaults to 10. |
10
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
RandomHover
Bases: _ai_goal
__init__(hover_height=(0.0, 0.0), interval=120, speed_multiplier=1.0, xz_dist=10, y_dist=7, y_offset=0.0)
Compels an entity to hover around randomly, close to the surface.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hover_height
|
tuple[float, float]
|
The height above the surface which the entity will try to maintain. Defaults to (0.0, 0.0). |
(0.0, 0.0)
|
interval
|
int
|
A random value to determine when to randomly move somewhere. This has a 1/interval chance to choose this goal. Defaults to 120. |
120
|
speed_multiplier
|
float
|
Movement speed multiplier of the entity when using this AI Goal. Defaults to 1.0. |
1.0
|
xz_dist
|
int
|
Distance in blocks on ground that the entity will look for a new spot to move to. Must be at least 1. Defaults to 10. |
10
|
y_dist
|
int
|
Distance in blocks that the entity will look up or down for a new spot to move to. Must be at least 1. Defaults to 7. |
7
|
y_offset
|
float
|
Height in blocks to add to the selected target position. Defaults to 0.0. |
0.0
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
RandomLookAround
Bases: _ai_goal
__init__(angle_of_view_horizontal=360, angle_of_view_vertical=360, look_distance=8.0, look_time=(2, 4), probability=0.02, target_distance=0.6)
Compels an entity to choose a random direction to look in for a random duration within a range.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
RandomSearchAndDig
Bases: _ai_goal
__init__(cooldown_range=(0, 0), digging_duration_range=(0, 0), find_valid_position_retries=0, goal_radius=1.5, item_table=None, search_range_xz=0, search_range_y=0, spawn_item_after_seconds=0, spawn_item_pos_offset=0, speed_multiplier=0, target_blocks=[], target_dig_position_offset=2.25)
Compels an entity to locate a random target block that it can find a path towards. Once found, the entity will move towards the target block and dig up an item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cooldown_range
|
tuple[Seconds, Seconds]
|
Goal cooldown range in seconds. Defaults to (0, 0). |
(0, 0)
|
digging_duration_range
|
tuple[Seconds, Seconds]
|
Digging duration in seconds. Defaults to (0, 0). |
(0, 0)
|
find_valid_position_retries
|
int
|
Amount of retries to find a valid target position within search range. Defaults to 0. |
0
|
goal_radius
|
float
|
Distance in blocks within the entity to consider it has reached the target position. Defaults to 1.5. |
1.5
|
item_table
|
str
|
File path relative to the resource pack root for items to spawn list (loot table format). Defaults to None. |
None
|
search_range_xz
|
float
|
Width and length of the volume around the entity used to find a valid target position. Defaults to 0. |
0
|
search_range_y
|
float
|
Height of the volume around the entity used to find a valid target position. Defaults to 0. |
0
|
spawn_item_after_seconds
|
Seconds
|
Digging duration before spawning item in seconds. Defaults to 0. |
0
|
spawn_item_pos_offset
|
float
|
Distance to offset the item's spawn location in the direction the mob is facing. Defaults to 0. |
0
|
speed_multiplier
|
float
|
Search movement speed multiplier. Defaults to 0. |
0
|
target_blocks
|
list[str]
|
List of target block types on which the goal will look to dig. Overrides the default list. Defaults to []. |
[]
|
target_dig_position_offset
|
float
|
Dig target position offset from the feet position of the entity in their facing direction. Defaults to 2.25. |
2.25
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
RandomSitting
Bases: _ai_goal
__init__(cooldown_time=0, min_sit_time=10, start_chance=0.1, stop_chance=0.3)
Compels an entity to stop and sit for a random duration of time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cooldown_time
|
float
|
Time in seconds the entity has to wait before using the goal again. Defaults to 0. |
0
|
min_sit_time
|
float
|
The minimum amount of time in seconds before the entity can stand back up. Defaults to 10. |
10
|
start_chance
|
float
|
This is the chance that the entity will start this goal, from 0 to 1. Defaults to 0.1. |
0.1
|
stop_chance
|
float
|
This is the chance that the entity will stop this goal, from 0 to 1. Defaults to 0.3. |
0.3
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
RandomStroll
Bases: _ai_goal
__init__(interval=120, speed_multiplier=1.0, xz_dist=10, y_dist=7)
Compels an entity to choose a random direction to walk towards.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
interval
|
int
|
A random value to determine when to randomly move somewhere. This has a 1/interval chance to choose this goal. Defaults to 120. |
120
|
speed_multiplier
|
float
|
Movement speed multiplier of the entity when using this AI Goal. Defaults to 1.0. |
1.0
|
xz_dist
|
int
|
Distance in blocks on ground that the entity will look for a new spot to move to. Must be at least 1. Defaults to 10. |
10
|
y_dist
|
int
|
Distance in blocks that the entity will look up or down for a new spot to move to. Must be at least 1. Defaults to 7. |
7
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
RandomSwim
Bases: _ai_goal
__init__(avoid_surface=True, interval=120, speed_multiplier=1.0, xz_dist=10, y_dist=7)
Compels an entity to swim in a random point in water.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
avoid_surface
|
bool
|
If true, the entity will avoid surface water blocks by swimming below them. Defaults to True. |
True
|
interval
|
int
|
A random value to determine when to randomly move somewhere. This has a 1/interval chance to choose this goal. Defaults to 120. |
120
|
speed_multiplier
|
float
|
Movement speed multiplier of the entity when using this AI Goal. Defaults to 1.0. |
1.0
|
xz_dist
|
int
|
Distance in blocks on ground that the entity will look for a new spot to move to. Must be at least 1. Defaults to 10. |
10
|
y_dist
|
int
|
Distance in blocks that the entity will look up or down for a new spot to move to. Must be at least 1. Defaults to 7. |
7
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
RangedAttack
Bases: _ai_goal
__init__(attack_interval=0, attack_interval_max=0, attack_interval_min=0, attack_radius=0, attack_radius_min=0, burst_interval=0, burst_shots=1, charge_charged_trigger=0, charge_shoot_trigger=0, ranged_fov=90, set_persistent=False, speed_multiplier=1, swing=False, target_in_sight_time=1, x_max_rotation=30, y_max_head_rotation=30)
Allows an entity to attack by using ranged shots. charge_shoot_trigger must be greater than 0 to enable charged up burst-shot attacks. Requires minecraft:shooter to define projectile behavior.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
Rideable
Bases: _component
__init__(interact_text='Mount', controlling_seat=0, crouching_skip_interact=True, pull_in_entities=False, rider_can_interact=False)
Determines whether this entity can be ridden. Allows specifying the different seat positions and quantity.
RiseToLiquidLevel
Bases: _ai_goal
__init__(liquid_y_offset=0.0, rise_delta=0.0, sink_delta=0.0)
Compels an entity to rise to the top of a liquid block if they are located in one or have spawned under a liquid block.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
liquid_y_offset
|
float
|
Vertical offset from the liquid. Defaults to 0.0. |
0.0
|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. Defaults to 0. |
required |
rise_delta
|
float
|
Displacement for how much the entity will move up in the vertical axis. Defaults to 0.0. |
0.0
|
sink_delta
|
float
|
Displacement for how much the entity will move down in the vertical axis. Defaults to 0.0. |
0.0
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
Roar
Bases: _ai_goal
__init__(duration=0.0)
Compels the entity to roar at another entity based on data in minecraft:anger_level. When the anger threshold specified in minecraft:anger_level has been reached, this entity will roar for the specified amount of time, look at the other entity, apply anger boost towards it, and finally target it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
duration
|
Seconds
|
The amount of time to roar for. Defaults to 0.0. |
0.0
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
RunAroundLikeCrazy
Bases: _ai_goal
__init__(speed_multiplier=1.0)
Compels an entity to run around without a set goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. Defaults to 0. |
required |
speed_multiplier
|
float
|
Movement speed multiplier of the mob when using this AI Goal. Defaults to 1.0. |
1.0
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
Scale
Bases: _component
__init__(value)
Sets the entity's visual size.
ScaleByAge
Bases: _component
__init__(start_scale, end_scale)
Defines the entity's size interpolation based on the entity's age.
SendEvent
Bases: _ai_goal
__init__()
Compels an entity to send an event to another entity.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
Shooter
Bases: _component
__init__(identifier, magic=False, power=0.0, aux_value=-1)
Defines the entity's ranged attack behavior. The "minecraft:behavior.ranged_attack" goal uses this component to determine which projectiles to shoot.
Sittable
Bases: _component
__init__(sit_event=None, stand_event=None)
Defines the entity's 'sit' state.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sit_event
|
str
|
Event to run when the entity enters the 'sit' state. Defaults to None. |
None
|
stand_event
|
str
|
Event to run when the entity exits the 'sit' state. Defaults to None. |
None
|
SkinID
Bases: _component
__init__(value)
Skin ID value. Can be used to differentiate skins, such as base skins for villagers.
SlimeKeepOnJumping
Bases: _ai_goal
__init__(speed_multiplier=1.0)
Compels an entity to continuously jump around like a slime.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
speed_multiplier
|
float
|
Movement speed multiplier of the mob when using this AI Goal. Defaults to 1.0. |
1.0
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
SpawnEntity
Bases: _component
__init__()
Adds a timer after which this entity will spawn another entity or item (similar to vanilla's chicken's egg-laying behavior).
SpellEffects
Bases: _component
__init__()
Defines what mob effects to add and remove to the entity when adding this component.
StayWhileSitting
Bases: _ai_goal
__init__()
Compels an entity to stay in place while sitting.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
StompAttack
Bases: _ai_goal
__init__(attack_once=False, attack_types=[], cooldown_time=1, inner_boundary_time_increase=0.25, max_path_time=0.55, melee_fov=90, min_path_time=0.2, no_damage_range_multiplier=2, outer_boundary_time_increase=0.5, path_fail_time_increase=0.75, path_inner_boundary=16, path_outer_boundary=32, random_stop_interval=0, reach_multiplier=2, require_complete_path=False, set_persistent=False, speed_multiplier=1, stomp_range_multiplier=2, track_target=False, x_max_rotation=30, y_max_head_rotation=30)
Compels an entity to attack a target by stomping on them.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
attack_once
|
bool
|
If true, the entity will only use this attack behavior once. Defaults to False. |
False
|
attack_types
|
list[str]
|
Defines the entity types this entity will attack. Defaults to []. |
[]
|
cooldown_time
|
Seconds
|
Cooldown time (in seconds) between attacks. Defaults to 1. |
1
|
inner_boundary_time_increase
|
Seconds
|
Time (in seconds) to add to attack path recalculation when the target is beyond the "path_inner_boundary". Defaults to 0.25. |
0.25
|
max_path_time
|
Seconds
|
Maximum base time (in seconds) to recalculate new attack path to target (before increases applied). Defaults to 0.55. |
0.55
|
melee_fov
|
int
|
Field of view (in degrees) when using the sensing component to detect an attack target. Defaults to 90. |
90
|
min_path_time
|
Seconds
|
Minimum base time (in seconds) to recalculate new attack path to target (before increases applied). Defaults to 0.2. |
0.2
|
no_damage_range_multiplier
|
float
|
Multiplied with the final AoE damage range to determine a no damage range. The stomp attack will go on cooldown if target is in this no damage range. Defaults to 2. |
2
|
outer_boundary_time_increase
|
Seconds
|
Time (in seconds) to add to attack path recalculation when the target is beyond the "path_outer_boundary". Defaults to 0.5. |
0.5
|
path_fail_time_increase
|
Seconds
|
Time (in seconds) to add to attack path recalculation when this entity cannot move along the current path. Defaults to 0.75. |
0.75
|
path_inner_boundary
|
float
|
Distance at which to increase attack path recalculation by "inner_boundary_tick_increase". Defaults to 16. |
16
|
path_outer_boundary
|
float
|
Distance at which to increase attack path recalculation by "outer_boundary_tick_increase". Defaults to 32. |
32
|
random_stop_interval
|
int
|
This entity will have a 1 in N chance to stop its current attack, where N = "random_stop_interval". Defaults to 0. |
0
|
reach_multiplier
|
float
|
Used with the base size of the entity to determine minimum target-distance before trying to deal attack damage. Defaults to 2. |
2
|
require_complete_path
|
bool
|
Toggles (on/off) the need to have a full path from the entity to the target when using this melee attack behavior. Defaults to False. |
False
|
set_persistent
|
bool
|
Allows the entity to be set to persist upon targeting a player. Defaults to False. |
False
|
speed_multiplier
|
float
|
This multiplier modifies the attacking entity's speed when moving toward the target. Defaults to 1. |
1
|
stomp_range_multiplier
|
float
|
Multiplied with the base size of the entity to determine stomp AoE damage range. Defaults to 2. |
2
|
track_target
|
bool
|
Allows the entity to track the attack target, even if the entity has no sensing. Defaults to False. |
False
|
x_max_rotation
|
int
|
Maximum rotation (in degrees), on the X-axis, this entity can rotate while trying to look at the target. Defaults to 30. |
30
|
y_max_head_rotation
|
int
|
Maximum rotation (in degrees), on the Y-axis, this entity can rotate its head while trying to look at the target. Defaults to 30. |
30
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
SummonEntity
Bases: _ai_goal
__init__()
compels an entity to attack other entities by summoning new entities.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
Tameable
Bases: _component
__init__(probability=1.0, tame_event=None, tame_subject=FilterSubject.Self, *tame_items)
Defines the rules for an entity to be tamed by the player.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
probability
|
float
|
The chance of taming the entity with each item use between 0.0 and 1.0, where 1.0 is 100%. Defaults to 1.0. |
1.0
|
tame_event
|
dict[str, str]
|
Event to initiate when the entity becomes tamed. Defaults to None. |
None
|
tame_items
|
str
|
The list of items that can be used to tame the entity. Defaults to None. |
()
|
TargetNearbySensor
Bases: _component
__init__(inside_range=1, outside_range=5, must_see=False)
Defines the entity's range within which it can see or sense other entities to target them.
TickWorld
Bases: _component
__init__(never_despawn=True, radius=None, distance_to_players=None)
Defines if the entity ticks the world and the radius around it to tick.
Timer
Bases: _ai_goal
__init__(event, target=FilterSubject.Self, looping=True, randomInterval=True, time=0)
Adds a timer after which an event will fire.
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
TimerFlag1
Bases: _ai_goal
__init__(cooldown_range=(10.0, 10.0), duration_range=(2.0, 2.0), *control_flags)
Fires an event when this behavior starts, then waits for a duration before stopping. When stopping to due the timeout or due to being interrupted by another behavior, the goal 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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cooldown_range
|
tuple[Seconds, Seconds]
|
The goal cooldown range, in seconds. Defaults to (10.0, 10.0). |
(10.0, 10.0)
|
duration_range
|
tuple[Seconds, Seconds]
|
The goal duration range, in seconds. Defaults to (2.0, 2.0). |
(2.0, 2.0)
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
TimerFlag2
Bases: _ai_goal
__init__(cooldown_range=(10.0, 10.0), duration_range=(2.0, 2.0), *control_flags)
Fires an event when this behavior starts, then waits for a duration before stopping. When stopping to due the timeout or due to being interrupted by another behavior, the goal 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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cooldown_range
|
tuple[Seconds, Seconds]
|
The goal cooldown range, in seconds. Defaults to (10.0, 10.0). |
(10.0, 10.0)
|
duration_range
|
tuple[Seconds, Seconds]
|
The goal duration range, in seconds. Defaults to (2.0, 2.0). |
(2.0, 2.0)
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
TimerFlag3
Bases: _ai_goal
__init__(cooldown_range=(10.0, 10.0), duration_range=(2.0, 2.0), *control_flags)
Fires an event when this behavior starts, then waits for a duration before stopping. When stopping to due the timeout or due to being interrupted by another behavior, the goal 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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cooldown_range
|
tuple[Seconds, Seconds]
|
The goal cooldown range, in seconds. Defaults to (10.0, 10.0). |
(10.0, 10.0)
|
duration_range
|
tuple[Seconds, Seconds]
|
The goal duration range, in seconds. Defaults to (2.0, 2.0). |
(2.0, 2.0)
|
priority(priority)
The higher the priority, the sooner this behavior will be executed as a goal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
priority
|
int
|
The higher the priority, the sooner this behavior will be executed as a goal. |
required |
Transformation
Bases: _component
__init__(into, transform_event=None, drop_equipment=False, drop_inventory=False, keep_level=False, keep_owner=False, preserve_equipment=False)
Defines an entity's transformation from the current definition into another.
Transient
Bases: _component
__init__()
An entity with this component will NEVER persist, and will forever disappear when unloaded.
TypeFamily
Bases: _component
__init__(*family)
Defines the families this entity belongs to.
UnderwaterMovement
Bases: _component
__init__(value)
A component that defines the entity's movement speed while underwater in block/tick
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
int
|
Movement speed of the entity while underwater in block/tick. |
required |
VariableMaxAutoStep
Bases: _component
__init__(base_value=0.5625, controlled_value=0.5625, jump_prevented_value=0.5625)
Allows entities have a maximum auto step height that is different depending on whether they are on a block that prevents jumping.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_value
|
float
|
The maximum auto step height when on any other block. Defaults to 0.5625. |
0.5625
|
controlled_value
|
float
|
The maximum auto step height when on any other block and controlled by the player. Defaults to 0.5625. |
0.5625
|
jump_prevented_value
|
float
|
The maximum auto step height when on a block that prevents jumping. Defaults to 0.5625. |
0.5625
|
Variant
Bases: _component
__init__(value)
Used to differentiate the component group of a variant of an entity from others. (e.g. ocelot, villager).
WaterMovement
Bases: _component
__init__(drag_factor=0.8)
Defines the speed with which an entity can move through water.