pub trait LivingEntity: Entity {
Show 261 methods
// Required methods
fn living_base(&self) -> &LivingEntityBase;
fn get_health(&self) -> f32;
fn set_health(&self, health: f32);
// Provided methods
fn living_rotation_state(&self) -> LivingRotationState { ... }
fn y_body_rot(&self) -> f32 { ... }
fn set_y_body_rot(&self, y_body_rot: f32) { ... }
fn y_head_rot(&self) -> f32 { ... }
fn set_y_head_rot(&self, y_head_rot: f32) { ... }
fn advance_living_rotation_for_base_tick(&self) { ... }
fn base_tick_living_entity(&self) { ... }
fn living_swing_state(&self) -> LivingSwingState { ... }
fn modified_swing_duration(&self, animation: SwingAnimation) -> i32 { ... }
fn attack_animation(&self, hand: InteractionHand) -> SwingAnimation { ... }
fn interact_animation(&self, hand: InteractionHand) -> SwingAnimation { ... }
fn held_swing_animation(
&self,
hand: InteractionHand,
component: DataComponentType<SwingAnimation>,
) -> SwingAnimation { ... }
fn swing(
&self,
hand: InteractionHand,
animation: SwingAnimation,
update_self: bool,
) -> bool { ... }
fn swing_for_attack(&self, hand: InteractionHand) { ... }
fn attributes(&self) -> &SyncMutex<AttributeMap> { ... }
fn get_luck(&self) -> f32 { ... }
fn pack_syncable_attributes(&self) -> Vec<AttributeSnapshot> { ... }
fn drain_dirty_syncable_attributes(&self) -> Vec<AttributeSnapshot> { ... }
fn drain_dirty_mob_effects(&self) -> Vec<MobEffectSyncChange> { ... }
fn pack_all_equipment(&self) -> Vec<EquipmentSlotItem> { ... }
fn drain_dirty_equipment(&self) -> Vec<EquipmentSlotItem> { ... }
fn save_equipment(&self, nbt: &mut NbtCompound) { ... }
fn load_equipment(&self, nbt: BorrowedNbtCompoundView<'_, '_>) { ... }
fn save_command_nbt(&self, nbt: &mut NbtCompound) { ... }
fn get_max_health(&self) -> f32 { ... }
fn no_action_time(&self) -> i32 { ... }
fn set_no_action_time(&self, no_action_time: i32) { ... }
fn increment_no_action_time(&self) { ... }
fn heal(&self, amount: f32) { ... }
fn is_dead_or_dying(&self) -> bool { ... }
fn is_baby(&self) -> bool { ... }
fn sheep_loot_state(&self) -> Option<(DyeColor, bool)> { ... }
fn chicken_loot_variant(&self) -> Option<&Identifier> { ... }
fn sound_volume(&self) -> f32 { ... }
fn voice_pitch(&self) -> f32 { ... }
fn default_voice_pitch(&self) -> f32 { ... }
fn hurt_sound(&self, _source: &DamageSource) -> Option<SoundEventRef> { ... }
fn death_sound(&self) -> Option<SoundEventRef> { ... }
fn make_sound(&self, sound: Option<SoundEventRef>) { ... }
fn play_hurt_sound(&self, source: &DamageSource) { ... }
fn play_death_sound(&self) { ... }
fn get_age_scale(&self) -> f32 { ... }
fn get_scale(&self) -> f32 { ... }
fn is_alive(&self) -> bool { ... }
fn get_armor_cover_percentage(&self) -> f32 { ... }
fn get_visibility_percent(
&self,
targeting_entity: Option<&dyn Entity>,
) -> f64 { ... }
fn disguise_head_matches_targeting_entity(
&self,
targeting_entity: Option<&dyn Entity>,
) -> bool { ... }
fn can_be_seen_by_anyone(&self) -> bool { ... }
fn can_be_seen_as_enemy(&self) -> bool { ... }
fn can_attack(&self, target: &dyn LivingEntity) -> bool { ... }
fn last_damage_source(&self) -> Option<RecentDamageSource> { ... }
fn record_last_damage_source(&self, source: &DamageSource) { ... }
fn set_last_hurt_by_player(&self, player_uuid: Uuid, time_to_remember: i32) { ... }
fn invulnerable_time(&self) -> i32 { ... }
fn set_invulnerable_time(&self, invulnerable_time: i32) { ... }
fn set_last_hurt_by_player_memory_time(&self, time_to_remember: i32) { ... }
fn last_hurt_by_player_memory_time(&self) -> i32 { ... }
fn last_hurt_by_player_uuid(&self) -> Option<Uuid> { ... }
fn last_hurt_by_mob(&self) -> Option<SharedEntity> { ... }
fn last_hurt_by_mob_timestamp(&self) -> i32 { ... }
fn set_last_hurt_by_mob(&self, target: Option<&SharedEntity>) { ... }
fn last_hurt_mob(&self) -> Option<SharedEntity> { ... }
fn last_hurt_mob_timestamp(&self) -> i32 { ... }
fn set_last_hurt_mob(&self, target: Option<&SharedEntity>) { ... }
fn resolve_mob_responsible_for_damage(&self, source: &DamageSource) { ... }
fn resolve_player_responsible_for_damage(&self, source: &DamageSource) { ... }
fn has_line_of_sight(&self, target: &dyn Entity) -> bool { ... }
fn has_line_of_sight_with(
&self,
target: &dyn Entity,
block_shape: ClipBlockShape,
fluid: ClipFluid,
target_eye_y: f64,
) -> bool { ... }
fn default_is_invulnerable_to(&self, source: &DamageSource) -> bool { ... }
fn is_invulnerable_to(&self, _world: &World, source: &DamageSource) -> bool { ... }
fn hurt_server(
&self,
world: &World,
source: &DamageSource,
amount: f32,
) -> bool { ... }
fn default_hurt_server(
&self,
world: &World,
source: &DamageSource,
amount: f32,
) -> bool { ... }
fn before_actually_hurt(&self, _source: &DamageSource, _amount: f32) { ... }
fn hurt_armor(&self, _source: &DamageSource, _damage: f32) { ... }
fn do_hurt_equipment(
&self,
source: &DamageSource,
damage: f32,
slots: &[EquipmentSlot],
) { ... }
fn get_damage_after_armor_absorb(
&self,
source: &DamageSource,
damage: f32,
) -> f32 { ... }
fn get_damage_after_magic_absorb(
&self,
source: &DamageSource,
damage: f32,
) -> f32 { ... }
fn actually_hurt(&self, world: &World, source: &DamageSource, amount: f32) { ... }
fn apply_damage_knockback(&self, source: &DamageSource) { ... }
fn damage_knockback_direction(&self, source: &DamageSource) -> (f64, f64) { ... }
fn knockback(&self, power: f64, xd: f64, zd: f64) { ... }
fn knockback_resistance(&self) -> f64 { ... }
fn indicate_damage(&self, _xd: f64, _zd: f64) { ... }
fn hurt_broadcast_chunk(&self) -> ChunkPos { ... }
fn broadcast_damage_event(&self, world: &World, source: &DamageSource) { ... }
fn check_totem_death_protection(&self, source: &DamageSource) -> bool { ... }
fn die(&self, source: &DamageSource) { ... }
fn handle_killing_blow(&self) { ... }
fn should_drop_loot(&self, world: &World) -> bool { ... }
fn should_drop_experience(&self) -> bool { ... }
fn is_always_experience_dropper(&self) -> bool { ... }
fn skip_drop_experience(&self) { ... }
fn was_experience_consumed(&self) -> bool { ... }
fn base_experience_reward(&self) -> i32 { ... }
fn experience_reward(
&self,
_world: &World,
_killer_entity: Option<&dyn Entity>,
) -> i32 { ... }
fn drop_all_death_loot(&self, source: &DamageSource) { ... }
fn drop_experience(
&self,
world: &Arc<World>,
killer_entity: Option<&dyn Entity>,
) { ... }
fn death_loot_table(&self) -> Option<LootTableRef> { ... }
fn death_loot_table_seed(&self) -> i64 { ... }
fn drop_from_loot_table(
&self,
source: &DamageSource,
killed_by_player: bool,
) { ... }
fn drop_custom_death_loot(
&self,
_source: &DamageSource,
_killed_by_player: bool,
) { ... }
fn tick_death(&self) { ... }
fn get_absorption_amount(&self) -> f32 { ... }
fn set_absorption_amount(&self, amount: f32) { ... }
fn fall_damage_sound(&self, damage: i32) -> SoundEventRef { ... }
fn play_block_fall_sound(&self) { ... }
fn cause_living_fall_damage(
&self,
fall_distance: f64,
damage_modifier: f32,
source: &DamageSource,
) -> bool { ... }
fn get_armor_value(&self) -> i32 { ... }
fn get_attribute_gravity(&self) -> f64 { ... }
fn get_effective_gravity(&self) -> f64 { ... }
fn is_affected_by_potions(&self) -> bool { ... }
fn is_inverted_heal_and_harm(&self) -> bool { ... }
fn default_can_be_affected(&self, effect: &MobEffectInstance) -> bool { ... }
fn can_be_affected(&self, effect: &MobEffectInstance) -> bool { ... }
fn has_mob_effect(&self, effect: MobEffectRef) -> bool { ... }
fn mob_effect(&self, effect: MobEffectRef) -> Option<ActiveMobEffect> { ... }
fn active_mob_effects(&self) -> Vec<ActiveMobEffect> ⓘ { ... }
fn set_mob_effect(&self, effect: MobEffectRef, amplifier: i32) { ... }
fn add_mob_effect(&self, effect: MobEffectInstance) -> bool { ... }
fn add_mob_effect_with_source(
&self,
effect: MobEffectInstance,
source: Option<&dyn Entity>,
) -> bool { ... }
fn set_mob_effect_active(&self, effect: MobEffectRef, active: bool) { ... }
fn remove_mob_effect(&self, effect: MobEffectRef) -> bool { ... }
fn tick_mob_effects(&self) { ... }
fn has_water_breathing(&self) -> bool { ... }
fn should_effects_refill_air_supply(&self) -> bool { ... }
fn can_breathe_underwater(&self) -> bool { ... }
fn can_drown_in_water(&self) -> bool { ... }
fn is_eye_in_bubble_column(&self) -> bool { ... }
fn decrease_air_supply(&self, current_supply: i32) -> i32 { ... }
fn increase_air_supply(&self, current_supply: i32) -> i32 { ... }
fn should_take_drowning_damage(&self) -> bool { ... }
fn tick_living_air_supply(&self) { ... }
fn is_in_wall(&self) -> bool { ... }
fn tick_in_wall_damage(&self) { ... }
fn tick_living_environmental_damage(&self) { ... }
fn is_affected_by_fluids(&self) -> bool { ... }
fn can_stand_on_fluid(&self, _fluid_state: FluidState) -> bool { ... }
fn is_using_item(&self) -> bool { ... }
fn is_blocking(&self) -> bool { ... }
fn is_fall_flying(&self) -> bool { ... }
fn set_fall_flying(&self, fall_flying: bool) { ... }
fn fall_flying_ticks(&self) -> i32 { ... }
fn with_equipment_slot(
&self,
slot: EquipmentSlot,
visitor: &mut dyn FnMut(&ItemStack),
) { ... }
fn is_holding(&self, predicate: &mut dyn FnMut(&ItemStack) -> bool) -> bool { ... }
fn tick_equipment(&self) { ... }
fn with_equipment_slot_mut(
&self,
slot: EquipmentSlot,
visitor: &mut dyn FnMut(&mut ItemStack),
) { ... }
fn has_item_in_slot(&self, slot: EquipmentSlot) -> bool { ... }
fn can_use_slot(&self, _slot: EquipmentSlot) -> bool { ... }
fn can_dispenser_equip_into_slot(&self, _slot: EquipmentSlot) -> bool { ... }
fn can_equip_with_dispenser(&self, item_stack: &ItemStack) -> bool { ... }
fn is_equippable_in_slot(
&self,
item_stack: &ItemStack,
slot: EquipmentSlot,
) -> bool { ... }
fn equip_sound(
&self,
slot: EquipmentSlot,
stack: &ItemStack,
) -> Option<SoundEventRef> { ... }
fn on_equip_item(
&self,
slot: EquipmentSlot,
previous: &ItemStack,
stack: &ItemStack,
) { ... }
fn interact_living_entity_with_equippable(
&self,
player: &Player,
hand: InteractionHand,
) -> InteractionResult { ... }
fn refresh_equipment_attribute_modifiers(&self, slot: EquipmentSlot) { ... }
fn detect_equipment_updates(&self) { ... }
fn pack_living_equipment(&self) -> Vec<EquipmentSlotItem> { ... }
fn drain_dirty_living_equipment(&self) -> Vec<EquipmentSlotItem> { ... }
fn has_infinite_materials(&self) -> bool { ... }
fn handle_extra_items_created_on_use(&self, _extra: ItemStack) { ... }
fn on_equipped_item_broken(&self, _item: ItemRef, slot: EquipmentSlot) { ... }
fn default_living_can_freeze(&self) -> bool { ... }
fn is_on_non_air_block_for_frost(&self) -> bool { ... }
fn remove_frost(&self) { ... }
fn try_add_frost(&self) { ... }
fn tick_freezing(&self) { ... }
fn tick_living_entity(&self, entity: &SharedEntity) { ... }
fn tick_living_state(&self) { ... }
fn can_glide_using(
&self,
item_stack: &ItemStack,
slot: EquipmentSlot,
) -> bool { ... }
fn can_glide_using_equipment_slot(&self, slot: EquipmentSlot) -> bool { ... }
fn damage_random_glider(&self) { ... }
fn default_can_glide(&self) -> bool { ... }
fn can_glide(&self) -> bool { ... }
fn start_fall_flying(&self) { ... }
fn try_to_start_fall_flying(&self) -> bool { ... }
fn last_climbable_pos(&self) -> Option<BlockPos> { ... }
fn set_last_climbable_pos(&self, pos: BlockPos) { ... }
fn default_living_on_climbable(&self) -> bool { ... }
fn should_discard_friction(&self) -> bool { ... }
fn set_discard_friction(&self, discard_friction: bool) { ... }
fn is_jumping(&self) -> bool { ... }
fn set_jumping(&self, jumping: bool) { ... }
fn travel_input(&self) -> LivingTravelInput { ... }
fn set_travel_input(&self, input: LivingTravelInput) { ... }
fn apply_input(&self) { ... }
fn no_jump_delay(&self) -> i32 { ... }
fn set_no_jump_delay(&self, ticks: i32) { ... }
fn tick_no_jump_delay(&self) { ... }
fn hurt_time(&self) -> i32 { ... }
fn default_is_immobile(&self) -> bool { ... }
fn is_immobile(&self) -> bool { ... }
fn apply_living_velocity_thresholds(&self) { ... }
fn server_ai_step(&self, _entity: &SharedEntity) { ... }
fn get_jump_boost_power(&self) -> f32 { ... }
fn get_jump_power_with_multiplier(&self, multiplier: f32) -> f32 { ... }
fn get_jump_power(&self) -> f32 { ... }
fn default_jump_from_ground(&self) { ... }
fn jump_from_ground(&self) { ... }
fn go_down_in_water(&self) { ... }
fn jump_in_liquid(&self, _fluid_tag: &Identifier) { ... }
fn handle_living_jump(&self) { ... }
fn tick_ridden(&self, _controller: &Player, _ridden_input: DVec3) { ... }
fn ridden_input(&self, _controller: &Player, self_input: DVec3) -> DVec3 { ... }
fn ridden_speed(&self, _controller: &Player) -> f32 { ... }
fn travel_ridden(
&self,
entity: &SharedEntity,
controller: &Player,
self_input: DVec3,
) -> Option<MoveResult> { ... }
fn default_ai_step(&self, entity: &SharedEntity) -> Option<MoveResult> { ... }
fn ai_step(&self, entity: &SharedEntity) -> Option<MoveResult> { ... }
fn push_entities(&self) { ... }
fn push_entities_in_order(&self, entities: &[SharedEntity]) { ... }
fn apply_entity_cramming_damage(
&self,
world: &World,
pushable_entities: &[SharedEntity],
) { ... }
fn is_suppressing_sliding_down_ladder(&self) -> bool { ... }
fn levitation_travel_y_delta(&self, movement_y: f64) -> Option<f64> { ... }
fn should_travel_in_fluid(&self, fluid_state: FluidState) -> bool { ... }
fn get_water_slow_down(&self) -> f32 { ... }
fn water_movement_efficiency(&self) -> f32 { ... }
fn has_dolphins_grace(&self) -> bool { ... }
fn get_flying_speed(&self) -> f32 { ... }
fn get_friction_influenced_speed(&self, block_friction: f32) -> f32 { ... }
fn air_travel_vertical_friction(&self, _horizontal_friction: f32) -> f32 { ... }
fn handle_on_climbable(&self, movement: DVec3) -> DVec3 { ... }
fn apply_living_travel_gravity(&self) { ... }
fn handle_relative_friction_and_calculate_movement(
&self,
entity: &SharedEntity,
input: DVec3,
block_friction: f32,
) -> Option<(DVec3, MoveResult)> { ... }
fn travel_in_air(
&self,
entity: &SharedEntity,
input: DVec3,
) -> Option<MoveResult> { ... }
fn get_fluid_falling_adjusted_movement(
&self,
base_gravity: f64,
is_falling: bool,
movement: DVec3,
) -> DVec3 { ... }
fn jump_out_of_fluid(&self, old_y: f64) { ... }
fn float_in_water_while_ridden(&self) { ... }
fn travel_in_water(
&self,
entity: &SharedEntity,
input: DVec3,
base_gravity: f64,
is_falling: bool,
old_y: f64,
) -> Option<MoveResult> { ... }
fn travel_in_lava(
&self,
entity: &SharedEntity,
input: DVec3,
base_gravity: f64,
is_falling: bool,
old_y: f64,
) -> Option<MoveResult> { ... }
fn travel_in_fluid(
&self,
entity: &SharedEntity,
input: DVec3,
) -> Option<MoveResult> { ... }
fn update_fall_flying(&self) { ... }
fn update_fall_flying_movement(&self, movement: DVec3) -> DVec3 { ... }
fn stop_fall_flying(&self) { ... }
fn handle_fall_flying_collisions(
&self,
previous_horizontal_speed: f64,
new_horizontal_speed: f64,
) { ... }
fn travel_fall_flying(
&self,
entity: &SharedEntity,
input: DVec3,
) -> Option<MoveResult> { ... }
fn default_travel(
&self,
entity: &SharedEntity,
input: DVec3,
) -> Option<MoveResult> { ... }
fn travel(&self, entity: &SharedEntity, input: DVec3) -> Option<MoveResult> { ... }
fn sleeping_pos(&self) -> Option<BlockPos> { ... }
fn set_sleeping_pos(&self, bed_position: BlockPos) { ... }
fn clear_sleeping_pos(&self) { ... }
fn is_sleeping(&self) -> bool { ... }
fn living_synced_data(&self) -> Option<&dyn LivingEntitySyncedData> { ... }
fn start_sleeping(
&self,
bed_position: BlockPos,
) -> Result<(), EntityMoveError> { ... }
fn default_stop_sleeping(&self) { ... }
fn stop_sleeping(&self) { ... }
fn is_sprinting(&self) -> bool { ... }
fn set_sprinting(&self, sprinting: bool) { ... }
fn get_speed(&self) -> f32 { ... }
fn set_speed(&self, speed: f32) { ... }
fn apply_post_impulse_grace_time(&self, ticks: i32) { ... }
fn set_ignore_fall_damage_from_current_impulse(
&self,
ignore_fall_damage: bool,
new_impulse_impact_pos: DVec3,
) { ... }
fn is_ignoring_fall_damage_from_current_impulse(&self) -> bool { ... }
fn current_impulse_impact_pos(&self) -> Option<DVec3> { ... }
fn try_reset_current_impulse_context(&self) { ... }
fn reset_current_impulse_context(&self) { ... }
fn is_in_post_impulse_grace_time(&self) -> bool { ... }
fn tick_post_impulse_grace_time(&self) { ... }
fn refresh_dirty_attributes(&self) { ... }
fn random_teleport(
&self,
world: &Arc<World>,
x: f64,
y: f64,
z: f64,
broadcast: bool,
) -> bool { ... }
}Expand description
A trait for living entities that can take damage, heal, and die.
This trait provides the core functionality for entities that have health,
can be damaged, and can die. It’s based on Minecraft’s LivingEntity class.
Note: All methods take &self (not &mut self) because living entities
are shared via Arc and use interior mutability (SyncMutex, etc.).
Required Methods§
Sourcefn living_base(&self) -> &LivingEntityBase
fn living_base(&self) -> &LivingEntityBase
Returns a reference to the shared LivingEntityBase that holds
living runtime state such as attributes, cached movement speed,
damage cooldown, and death animation counters.
Sourcefn get_health(&self) -> f32
fn get_health(&self) -> f32
Gets the current health of the entity.
Sourcefn set_health(&self, health: f32)
fn set_health(&self, health: f32)
Sets the health of the entity, clamped between 0 and max health.
Provided Methods§
Sourcefn living_rotation_state(&self) -> LivingRotationState
fn living_rotation_state(&self) -> LivingRotationState
Returns vanilla living body/head rotation state.
Sourcefn y_body_rot(&self) -> f32
fn y_body_rot(&self) -> f32
Returns the entity’s body yaw, used for turning smoothing separate from head yaw.
Sourcefn set_y_body_rot(&self, y_body_rot: f32)
fn set_y_body_rot(&self, y_body_rot: f32)
Sets the entity’s body yaw.
Sourcefn y_head_rot(&self) -> f32
fn y_head_rot(&self) -> f32
Returns the entity’s head yaw.
Sourcefn set_y_head_rot(&self, y_head_rot: f32)
fn set_y_head_rot(&self, y_head_rot: f32)
Sets the entity’s head yaw.
Sourcefn advance_living_rotation_for_base_tick(&self)
fn advance_living_rotation_for_base_tick(&self)
Copies current living body/head rotations to vanilla old-rotation state.
Sourcefn base_tick_living_entity(&self)
fn base_tick_living_entity(&self)
Runs the shared per-tick living-entity behavior: rotation/animation snapshots, base entity tick, environmental damage, the hurt timer, and combat memory expiry. Memory must expire before mob effects tick, so a lethal effect tick sees the same kill credit as vanilla.
Sourcefn living_swing_state(&self) -> LivingSwingState
fn living_swing_state(&self) -> LivingSwingState
Returns vanilla arm-swing animation state.
Sourcefn modified_swing_duration(&self, animation: SwingAnimation) -> i32
fn modified_swing_duration(&self, animation: SwingAnimation) -> i32
Returns the animation duration adjusted by Haste or Mining Fatigue.
Sourcefn attack_animation(&self, hand: InteractionHand) -> SwingAnimation
fn attack_animation(&self, hand: InteractionHand) -> SwingAnimation
Returns the held item’s attack animation.
Sourcefn interact_animation(&self, hand: InteractionHand) -> SwingAnimation
fn interact_animation(&self, hand: InteractionHand) -> SwingAnimation
Returns the held item’s interaction animation.
Sourcefn held_swing_animation(
&self,
hand: InteractionHand,
component: DataComponentType<SwingAnimation>,
) -> SwingAnimation
fn held_swing_animation( &self, hand: InteractionHand, component: DataComponentType<SwingAnimation>, ) -> SwingAnimation
Reads a swing animation component off the item held in hand, falling
back to the vanilla default when the item does not carry one.
Sourcefn swing(
&self,
hand: InteractionHand,
animation: SwingAnimation,
update_self: bool,
) -> bool
fn swing( &self, hand: InteractionHand, animation: SwingAnimation, update_self: bool, ) -> bool
Sends the animation to tracking players and returns whether a swing started
Sourcefn swing_for_attack(&self, hand: InteractionHand)
fn swing_for_attack(&self, hand: InteractionHand)
Swings with the held item’s attack animation.
Sourcefn attributes(&self) -> &SyncMutex<AttributeMap>
fn attributes(&self) -> &SyncMutex<AttributeMap>
Returns a reference to this entity’s attribute map.
Sourcefn get_luck(&self) -> f32
fn get_luck(&self) -> f32
Vanilla LivingEntity.getLuck - non-players contribute no luck to loot.
Sourcefn pack_syncable_attributes(&self) -> Vec<AttributeSnapshot>
fn pack_syncable_attributes(&self) -> Vec<AttributeSnapshot>
Packs syncable attributes for initial spawn pairing.
Mirrors vanilla ServerEntity.sendPairingData, which sends all syncable
living attributes after the add-entity and metadata packets.
Sourcefn drain_dirty_syncable_attributes(&self) -> Vec<AttributeSnapshot>
fn drain_dirty_syncable_attributes(&self) -> Vec<AttributeSnapshot>
Drains syncable dirty attributes for per-tick tracking updates.
Mirrors vanilla ServerEntity.sendDirtyEntityData, which sends dirty
living attributes after dirty entity data.
Sourcefn drain_dirty_mob_effects(&self) -> Vec<MobEffectSyncChange>
fn drain_dirty_mob_effects(&self) -> Vec<MobEffectSyncChange>
Drains dirty mob-effect packet changes for vanilla recipients.
Sourcefn pack_all_equipment(&self) -> Vec<EquipmentSlotItem>
fn pack_all_equipment(&self) -> Vec<EquipmentSlotItem>
Packs non-empty equipment slots for initial spawn pairing.
Sourcefn drain_dirty_equipment(&self) -> Vec<EquipmentSlotItem>
fn drain_dirty_equipment(&self) -> Vec<EquipmentSlotItem>
Drains equipment slots that changed since the last tracker sync.
Sourcefn save_equipment(&self, nbt: &mut NbtCompound)
fn save_equipment(&self, nbt: &mut NbtCompound)
Saves equipment slots to NBT.
Sourcefn load_equipment(&self, nbt: BorrowedNbtCompoundView<'_, '_>)
fn load_equipment(&self, nbt: BorrowedNbtCompoundView<'_, '_>)
Loads equipment slots from NBT.
Sourcefn save_command_nbt(&self, nbt: &mut NbtCompound)
fn save_command_nbt(&self, nbt: &mut NbtCompound)
Appends vanilla-shaped living state used by command NBT predicates.
Sourcefn get_max_health(&self) -> f32
fn get_max_health(&self) -> f32
Gets the maximum health from the attribute system.
Sourcefn no_action_time(&self) -> i32
fn no_action_time(&self) -> i32
Returns ticks this entity has gone without taking a noteworthy action.
Sourcefn set_no_action_time(&self, no_action_time: i32)
fn set_no_action_time(&self, no_action_time: i32)
Sets ticks this entity has gone without taking a noteworthy action.
Sourcefn increment_no_action_time(&self)
fn increment_no_action_time(&self)
Increments the no-action-time counter by one tick.
Sourcefn is_dead_or_dying(&self) -> bool
fn is_dead_or_dying(&self) -> bool
Returns true if the entity is dead or dying (health <= 0).
Sourcefn sheep_loot_state(&self) -> Option<(DyeColor, bool)>
fn sheep_loot_state(&self) -> Option<(DyeColor, bool)>
Returns the vanilla sheep loot predicate state (minecraft:components.sheep/color
together with minecraft:type_specific/sheep.sheared), when this entity is a sheep.
Mirrors Sheep.get(DataComponents.SHEEP_COLOR) + Sheep.isSheared() for the
entity loot context.
Sourcefn chicken_loot_variant(&self) -> Option<&Identifier>
fn chicken_loot_variant(&self) -> Option<&Identifier>
Returns this entity’s minecraft:components.chicken/variant key for the
entity loot context, when it is a chicken.
Mirrors Chicken.get(DataComponents.CHICKEN_VARIANT) for the loot predicate.
Sourcefn sound_volume(&self) -> f32
fn sound_volume(&self) -> f32
Returns the volume used for this entity’s sounds.
Sourcefn voice_pitch(&self) -> f32
fn voice_pitch(&self) -> f32
Returns the pitch used for this entity’s sounds; babies get a randomized higher pitch.
Sourcefn default_voice_pitch(&self) -> f32
fn default_voice_pitch(&self) -> f32
Returns the base voice pitch before entity-specific adjustments.
Sourcefn hurt_sound(&self, _source: &DamageSource) -> Option<SoundEventRef>
fn hurt_sound(&self, _source: &DamageSource) -> Option<SoundEventRef>
Returns the sound played when this entity is hurt.
Sourcefn death_sound(&self) -> Option<SoundEventRef>
fn death_sound(&self) -> Option<SoundEventRef>
Returns the sound played when this entity dies.
Sourcefn make_sound(&self, sound: Option<SoundEventRef>)
fn make_sound(&self, sound: Option<SoundEventRef>)
Plays sound at this entity’s current volume and pitch, if any.
Sourcefn play_hurt_sound(&self, source: &DamageSource)
fn play_hurt_sound(&self, source: &DamageSource)
Plays this entity’s hurt sound and resets its ambient-sound timer if it’s a mob.
Sourcefn play_death_sound(&self)
fn play_death_sound(&self)
Plays vanilla’s death sound for this living entity.
Sourcefn get_age_scale(&self) -> f32
fn get_age_scale(&self) -> f32
Returns the render scale from age: 0.5 for babies, 1.0 for adults.
Sourcefn get_scale(&self) -> f32
fn get_scale(&self) -> f32
Returns this entity’s overall render scale, from the scale attribute.
Sourcefn get_armor_cover_percentage(&self) -> f32
fn get_armor_cover_percentage(&self) -> f32
Returns the fraction of armor slots that currently have equipment, used for armor-tint rendering.
Sourcefn get_visibility_percent(&self, targeting_entity: Option<&dyn Entity>) -> f64
fn get_visibility_percent(&self, targeting_entity: Option<&dyn Entity>) -> f64
Returns how visible this entity is, from 0.0 to 1.0: reduced while sneaking, invisible, or disguised with a matching mob head.
Sourcefn disguise_head_matches_targeting_entity(
&self,
targeting_entity: Option<&dyn Entity>,
) -> bool
fn disguise_head_matches_targeting_entity( &self, targeting_entity: Option<&dyn Entity>, ) -> bool
Returns whether the equipped head item reduces visibility to targeting_entity.
Sourcefn can_be_seen_by_anyone(&self) -> bool
fn can_be_seen_by_anyone(&self) -> bool
Returns whether this entity is currently visible to anything: alive and not a spectator.
Sourcefn can_be_seen_as_enemy(&self) -> bool
fn can_be_seen_as_enemy(&self) -> bool
Returns whether this entity can be targeted as an enemy: visible and not invulnerable.
Sourcefn can_attack(&self, target: &dyn LivingEntity) -> bool
fn can_attack(&self, target: &dyn LivingEntity) -> bool
Returns whether this entity may attack target: never a player on
peaceful difficulty, and only visible, non-invulnerable targets otherwise.
Sourcefn last_damage_source(&self) -> Option<RecentDamageSource>
fn last_damage_source(&self) -> Option<RecentDamageSource>
Returns the last damage source, unless it’s older than the timeout window, with
RecentDamageSource retention semantics.
Sourcefn record_last_damage_source(&self, source: &DamageSource)
fn record_last_damage_source(&self, source: &DamageSource)
Records a successful hit using the victim’s own level clock.
Sourcefn set_last_hurt_by_player(&self, player_uuid: Uuid, time_to_remember: i32)
fn set_last_hurt_by_player(&self, player_uuid: Uuid, time_to_remember: i32)
Records the player that last hurt this entity.
Sourcefn invulnerable_time(&self) -> i32
fn invulnerable_time(&self) -> i32
Returns the remaining hurt-cooldown ticks (vanilla Entity.invulnerableTime).
Sourcefn set_invulnerable_time(&self, invulnerable_time: i32)
fn set_invulnerable_time(&self, invulnerable_time: i32)
Sets the remaining hurt-cooldown ticks.
Sourcefn set_last_hurt_by_player_memory_time(&self, time_to_remember: i32)
fn set_last_hurt_by_player_memory_time(&self, time_to_remember: i32)
Sets the remaining memory time without touching the remembered player.
Sourcefn last_hurt_by_player_memory_time(&self) -> i32
fn last_hurt_by_player_memory_time(&self) -> i32
Returns ticks remaining that this entity will remember the player who last hurt it.
Sourcefn last_hurt_by_player_uuid(&self) -> Option<Uuid>
fn last_hurt_by_player_uuid(&self) -> Option<Uuid>
Returns vanilla LivingEntity.lastHurtByPlayer, if still remembered.
Sourcefn last_hurt_by_mob(&self) -> Option<SharedEntity>
fn last_hurt_by_mob(&self) -> Option<SharedEntity>
Returns the mob that last hurt this entity, if still resolvable.
Sourcefn last_hurt_by_mob_timestamp(&self) -> i32
fn last_hurt_by_mob_timestamp(&self) -> i32
Returns the tick timestamp this entity was last hurt by a mob.
Sourcefn set_last_hurt_by_mob(&self, target: Option<&SharedEntity>)
fn set_last_hurt_by_mob(&self, target: Option<&SharedEntity>)
Records the mob that last hurt this entity.
Sourcefn last_hurt_mob(&self) -> Option<SharedEntity>
fn last_hurt_mob(&self) -> Option<SharedEntity>
Returns the mob this entity last hurt, if still resolvable.
Sourcefn last_hurt_mob_timestamp(&self) -> i32
fn last_hurt_mob_timestamp(&self) -> i32
Returns the tick timestamp this entity last hurt a mob.
Sourcefn set_last_hurt_mob(&self, target: Option<&SharedEntity>)
fn set_last_hurt_mob(&self, target: Option<&SharedEntity>)
Records the mob this entity last hurt.
Sourcefn resolve_mob_responsible_for_damage(&self, source: &DamageSource)
fn resolve_mob_responsible_for_damage(&self, source: &DamageSource)
Records the causing entity as this entity’s last-hurt-by mob, skipping
damage types that shouldn’t provoke anger (e.g. no_anger, or wind
charges when this mob is immune to their anger).
Sourcefn resolve_player_responsible_for_damage(&self, source: &DamageSource)
fn resolve_player_responsible_for_damage(&self, source: &DamageSource)
Records the causing entity as this entity’s last-hurt-by player, if the causing entity is a player.
Sourcefn has_line_of_sight(&self, target: &dyn Entity) -> bool
fn has_line_of_sight(&self, target: &dyn Entity) -> bool
Returns whether this entity has an unobstructed line of sight to target’s eyes.
Sourcefn has_line_of_sight_with(
&self,
target: &dyn Entity,
block_shape: ClipBlockShape,
fluid: ClipFluid,
target_eye_y: f64,
) -> bool
fn has_line_of_sight_with( &self, target: &dyn Entity, block_shape: ClipBlockShape, fluid: ClipFluid, target_eye_y: f64, ) -> bool
Returns vanilla line-of-sight with explicit clip options.
Sourcefn default_is_invulnerable_to(&self, source: &DamageSource) -> bool
fn default_is_invulnerable_to(&self, source: &DamageSource) -> bool
Returns vanilla base living-entity invulnerability.
Sourcefn is_invulnerable_to(&self, _world: &World, source: &DamageSource) -> bool
fn is_invulnerable_to(&self, _world: &World, source: &DamageSource) -> bool
Returns whether this living entity ignores a damage source.
Sourcefn hurt_server(&self, world: &World, source: &DamageSource, amount: f32) -> bool
fn hurt_server(&self, world: &World, source: &DamageSource, amount: f32) -> bool
Main vanilla living-entity damage entry point.
world is the ServerLevel supplied by the vanilla caller. It may
intentionally differ from the entity’s attached world.
Sourcefn default_hurt_server(
&self,
world: &World,
source: &DamageSource,
amount: f32,
) -> bool
fn default_hurt_server( &self, world: &World, source: &DamageSource, amount: f32, ) -> bool
Runs the base LivingEntity.hurtServer body.
Overrides of Self::hurt_server call this where vanilla calls
super.hurtServer; the Ender Dragon routes its per-part damage scaling
through here.
Sourcefn before_actually_hurt(&self, _source: &DamageSource, _amount: f32)
fn before_actually_hurt(&self, _source: &DamageSource, _amount: f32)
Hook before applying damage after vanilla reductions.
Sourcefn hurt_armor(&self, _source: &DamageSource, _damage: f32)
fn hurt_armor(&self, _source: &DamageSource, _damage: f32)
Damages equipment that participates in vanilla armor absorption.
Sourcefn do_hurt_equipment(
&self,
source: &DamageSource,
damage: f32,
slots: &[EquipmentSlot],
)
fn do_hurt_equipment( &self, source: &DamageSource, damage: f32, slots: &[EquipmentSlot], )
Damages equipped items in the given slots that are eligible to absorb this damage source.
Sourcefn get_damage_after_armor_absorb(
&self,
source: &DamageSource,
damage: f32,
) -> f32
fn get_damage_after_armor_absorb( &self, source: &DamageSource, damage: f32, ) -> f32
Reduces damage by the entity’s armor value and toughness, unless the source bypasses armor.
Sourcefn get_damage_after_magic_absorb(
&self,
source: &DamageSource,
damage: f32,
) -> f32
fn get_damage_after_magic_absorb( &self, source: &DamageSource, damage: f32, ) -> f32
Reduces damage based on the resistance effect, unless the source bypasses it or effects entirely.
Sourcefn actually_hurt(&self, world: &World, source: &DamageSource, amount: f32)
fn actually_hurt(&self, world: &World, source: &DamageSource, amount: f32)
Applies damage after vanilla reductions.
Sourcefn apply_damage_knockback(&self, source: &DamageSource)
fn apply_damage_knockback(&self, source: &DamageSource)
Applies vanilla hurt knockback for a damage source.
Sourcefn damage_knockback_direction(&self, source: &DamageSource) -> (f64, f64)
fn damage_knockback_direction(&self, source: &DamageSource) -> (f64, f64)
Returns the horizontal direction used by vanilla damage knockback.
Sourcefn knockback(&self, power: f64, xd: f64, zd: f64)
fn knockback(&self, power: f64, xd: f64, zd: f64)
Applies knockback velocity in the direction (xd, zd), scaled by
power and reduced by knockback resistance.
Sourcefn knockback_resistance(&self) -> f64
fn knockback_resistance(&self) -> f64
Returns vanilla knockback resistance.
Sourcefn indicate_damage(&self, _xd: f64, _zd: f64)
fn indicate_damage(&self, _xd: f64, _zd: f64)
Applies a client-visible damage knockback indication in the given direction.
Sourcefn hurt_broadcast_chunk(&self) -> ChunkPos
fn hurt_broadcast_chunk(&self) -> ChunkPos
Returns the chunk used for vanilla nearby hurt broadcasts.
Sourcefn broadcast_damage_event(&self, world: &World, source: &DamageSource)
fn broadcast_damage_event(&self, world: &World, source: &DamageSource)
Broadcasts vanilla damage-event metadata near this entity.
Sourcefn check_totem_death_protection(&self, source: &DamageSource) -> bool
fn check_totem_death_protection(&self, source: &DamageSource) -> bool
Uses a held death-protection item to survive lethal damage. Returns whether one was used.
Sourcefn die(&self, source: &DamageSource)
fn die(&self, source: &DamageSource)
Processes vanilla living death side effects.
Sourcefn handle_killing_blow(&self)
fn handle_killing_blow(&self)
Runs vanilla LivingEntity.handleKillingBlow.
Vanilla’s body is this.dead = true, which Self::die has already done
atomically by the time this runs. The hook exists for the subclasses that
replace it: bosses playing a death animation clamp their health and enter a
dying state here instead of falling over.
Sourcefn should_drop_loot(&self, world: &World) -> bool
fn should_drop_loot(&self, world: &World) -> bool
Returns vanilla LivingEntity.shouldDropLoot.
Returns whether this entity should drop loot on death: not a baby,
and the mob-drops game rule allows it.
Sourcefn should_drop_experience(&self) -> bool
fn should_drop_experience(&self) -> bool
Returns whether this entity should drop experience on death: not a baby.
Sourcefn is_always_experience_dropper(&self) -> bool
fn is_always_experience_dropper(&self) -> bool
Returns whether this entity always drops experience regardless of the player-kill requirement; false by default.
Sourcefn skip_drop_experience(&self)
fn skip_drop_experience(&self)
Marks this entity to skip dropping experience on death.
Sourcefn was_experience_consumed(&self) -> bool
fn was_experience_consumed(&self) -> bool
Returns whether this entity has been marked to skip dropping experience.
Sourcefn base_experience_reward(&self) -> i32
fn base_experience_reward(&self) -> i32
Returns the base experience reward for killing this entity, using the animal-specific reward when applicable.
Sourcefn experience_reward(
&self,
_world: &World,
_killer_entity: Option<&dyn Entity>,
) -> i32
fn experience_reward( &self, _world: &World, _killer_entity: Option<&dyn Entity>, ) -> i32
Returns the experience reward for this entity’s death; currently equal to the base reward (see TODO).
Sourcefn drop_all_death_loot(&self, source: &DamageSource)
fn drop_all_death_loot(&self, source: &DamageSource)
Runs the currently implemented subset of vanilla LivingEntity.dropAllDeathLoot.
Sourcefn drop_experience(
&self,
world: &Arc<World>,
killer_entity: Option<&dyn Entity>,
)
fn drop_experience( &self, world: &Arc<World>, killer_entity: Option<&dyn Entity>, )
Awards experience for this entity’s death when eligible, spawning an experience orb.
Sourcefn death_loot_table(&self) -> Option<LootTableRef>
fn death_loot_table(&self) -> Option<LootTableRef>
Returns this entity’s death loot table: a mob’s custom override if set, otherwise the default table for its entity type.
Sourcefn death_loot_table_seed(&self) -> i64
fn death_loot_table_seed(&self) -> i64
Returns the loot-table seed for this entity’s death loot, if it’s a mob.
Sourcefn drop_from_loot_table(&self, source: &DamageSource, killed_by_player: bool)
fn drop_from_loot_table(&self, source: &DamageSource, killed_by_player: bool)
Rolls and spawns this entity’s death-loot drops from its loot table, seeded deterministically when a loot-table seed is set.
Sourcefn drop_custom_death_loot(
&self,
_source: &DamageSource,
_killed_by_player: bool,
)
fn drop_custom_death_loot( &self, _source: &DamageSource, _killed_by_player: bool, )
Hook for non-mob custom death loot.
Sourcefn tick_death(&self)
fn tick_death(&self)
Ticks the vanilla living death animation and removes the entity at completion.
Sourcefn get_absorption_amount(&self) -> f32
fn get_absorption_amount(&self) -> f32
Gets the absorption amount (extra health from effects like absorption).
Sourcefn set_absorption_amount(&self, amount: f32)
fn set_absorption_amount(&self, amount: f32)
Sets the absorption amount.
Sourcefn fall_damage_sound(&self, damage: i32) -> SoundEventRef
fn fall_damage_sound(&self, damage: i32) -> SoundEventRef
Returns the small or big fall sound based on damage.
Sourcefn play_block_fall_sound(&self)
fn play_block_fall_sound(&self)
Plays the sound of the block this entity is standing in/on after a fall.
Sourcefn cause_living_fall_damage(
&self,
fall_distance: f64,
damage_modifier: f32,
source: &DamageSource,
) -> bool
fn cause_living_fall_damage( &self, fall_distance: f64, damage_modifier: f32, source: &DamageSource, ) -> bool
Applies fall damage to a living entity, factoring in effects that reduce or negate it.
Sourcefn get_armor_value(&self) -> i32
fn get_armor_value(&self) -> i32
Gets the entity’s armor value from the attribute system.
Sourcefn get_attribute_gravity(&self) -> f64
fn get_attribute_gravity(&self) -> f64
Gets the gravity value from the attribute system.
Sourcefn get_effective_gravity(&self) -> f64
fn get_effective_gravity(&self) -> f64
Returns this entity’s gravity, reduced while falling under Slow Falling.
Sourcefn is_affected_by_potions(&self) -> bool
fn is_affected_by_potions(&self) -> bool
Checks if the entity can be affected by potions.
Sourcefn is_inverted_heal_and_harm(&self) -> bool
fn is_inverted_heal_and_harm(&self) -> bool
Returns whether healing and harm effects are inverted for this entity (e.g. undead mobs).
Sourcefn default_can_be_affected(&self, effect: &MobEffectInstance) -> bool
fn default_can_be_affected(&self, effect: &MobEffectInstance) -> bool
Returns vanilla base LivingEntity.canBeAffected eligibility.
Sourcefn can_be_affected(&self, effect: &MobEffectInstance) -> bool
fn can_be_affected(&self, effect: &MobEffectInstance) -> bool
Returns whether this entity accepts a mob-effect instance.
Concrete entities override this for vanilla class-specific immunities.
Sourcefn has_mob_effect(&self, effect: MobEffectRef) -> bool
fn has_mob_effect(&self, effect: MobEffectRef) -> bool
Returns whether this entity currently has effect active.
Sourcefn mob_effect(&self, effect: MobEffectRef) -> Option<ActiveMobEffect>
fn mob_effect(&self, effect: MobEffectRef) -> Option<ActiveMobEffect>
Returns this entity’s active instance of effect, if any.
Sourcefn active_mob_effects(&self) -> Vec<ActiveMobEffect> ⓘ
fn active_mob_effects(&self) -> Vec<ActiveMobEffect> ⓘ
Returns all active vanilla mob effects.
Sourcefn set_mob_effect(&self, effect: MobEffectRef, amplifier: i32)
fn set_mob_effect(&self, effect: MobEffectRef, amplifier: i32)
Sets active vanilla mob-effect state.
Sourcefn add_mob_effect(&self, effect: MobEffectInstance) -> bool
fn add_mob_effect(&self, effect: MobEffectInstance) -> bool
Adds or updates active vanilla mob-effect state.
Sourcefn add_mob_effect_with_source(
&self,
effect: MobEffectInstance,
source: Option<&dyn Entity>,
) -> bool
fn add_mob_effect_with_source( &self, effect: MobEffectInstance, source: Option<&dyn Entity>, ) -> bool
Adds or updates active vanilla mob-effect state, attributing it to
source.
Sourcefn set_mob_effect_active(&self, effect: MobEffectRef, active: bool)
fn set_mob_effect_active(&self, effect: MobEffectRef, active: bool)
Sets the presence of a vanilla mob effect.
Sourcefn remove_mob_effect(&self, effect: MobEffectRef) -> bool
fn remove_mob_effect(&self, effect: MobEffectRef) -> bool
Removes active vanilla mob-effect state.
Sourcefn tick_mob_effects(&self)
fn tick_mob_effects(&self)
Ticks vanilla server-side mob-effect behavior and durations.
Sourcefn has_water_breathing(&self) -> bool
fn has_water_breathing(&self) -> bool
Returns whether vanilla effects keep this entity from drowning.
Sourcefn should_effects_refill_air_supply(&self) -> bool
fn should_effects_refill_air_supply(&self) -> bool
Returns whether active vanilla effects refill this entity’s air supply.
Sourcefn can_breathe_underwater(&self) -> bool
fn can_breathe_underwater(&self) -> bool
Returns whether this entity’s type can breathe underwater.
Sourcefn can_drown_in_water(&self) -> bool
fn can_drown_in_water(&self) -> bool
Returns whether this entity can lose air and take drowning damage.
Sourcefn is_eye_in_bubble_column(&self) -> bool
fn is_eye_in_bubble_column(&self) -> bool
Returns whether the entity’s eye block is a bubble column.
Sourcefn decrease_air_supply(&self, current_supply: i32) -> i32
fn decrease_air_supply(&self, current_supply: i32) -> i32
Decreases air supply while drowning, occasionally skipped when the oxygen bonus effect applies.
Sourcefn increase_air_supply(&self, current_supply: i32) -> i32
fn increase_air_supply(&self, current_supply: i32) -> i32
Refills air supply while out of water, capped at the entity’s maximum.
Sourcefn should_take_drowning_damage(&self) -> bool
fn should_take_drowning_damage(&self) -> bool
Returns whether air supply has dropped low enough to start dealing drowning damage.
Sourcefn tick_living_air_supply(&self)
fn tick_living_air_supply(&self)
Ticks vanilla living air-supply and drowning behavior from baseTick.
Sourcefn is_in_wall(&self) -> bool
fn is_in_wall(&self) -> bool
Returns whether the entity is suffocating in a wall, ignoring the check while sleeping.
Sourcefn tick_in_wall_damage(&self)
fn tick_in_wall_damage(&self)
Applies vanilla living in-wall damage from baseTick.
Sourcefn tick_living_environmental_damage(&self)
fn tick_living_environmental_damage(&self)
Applies vanilla living environmental damage in LivingEntity.baseTick order.
Sourcefn is_affected_by_fluids(&self) -> bool
fn is_affected_by_fluids(&self) -> bool
Returns whether this entity is affected by fluid physics; true by default.
Sourcefn can_stand_on_fluid(&self, _fluid_state: FluidState) -> bool
fn can_stand_on_fluid(&self, _fluid_state: FluidState) -> bool
Returns whether this entity can stand on the given fluid’s surface; false by default.
Sourcefn is_using_item(&self) -> bool
fn is_using_item(&self) -> bool
Checks if the entity is currently using an item.
Sourcefn is_blocking(&self) -> bool
fn is_blocking(&self) -> bool
Checks if the entity is blocking with a shield or similar item.
Sourcefn is_fall_flying(&self) -> bool
fn is_fall_flying(&self) -> bool
Checks if the entity is fall flying (using elytra).
Sourcefn set_fall_flying(&self, fall_flying: bool)
fn set_fall_flying(&self, fall_flying: bool)
Sets whether this entity is fall flying.
Sourcefn fall_flying_ticks(&self) -> i32
fn fall_flying_ticks(&self) -> i32
Returns ticks this entity has been fall-flying.
Sourcefn with_equipment_slot(
&self,
slot: EquipmentSlot,
visitor: &mut dyn FnMut(&ItemStack),
)
fn with_equipment_slot( &self, slot: EquipmentSlot, visitor: &mut dyn FnMut(&ItemStack), )
Visits the item in a vanilla living-entity equipment slot.
Sourcefn is_holding(&self, predicate: &mut dyn FnMut(&ItemStack) -> bool) -> bool
fn is_holding(&self, predicate: &mut dyn FnMut(&ItemStack) -> bool) -> bool
Returns whether the item in this entity’s main hand matches predicate.
Sourcefn tick_equipment(&self)
fn tick_equipment(&self)
Ticks every equipped item.
Sourcefn with_equipment_slot_mut(
&self,
slot: EquipmentSlot,
visitor: &mut dyn FnMut(&mut ItemStack),
)
fn with_equipment_slot_mut( &self, slot: EquipmentSlot, visitor: &mut dyn FnMut(&mut ItemStack), )
Mutates the item in a vanilla living-entity equipment slot.
Sourcefn has_item_in_slot(&self, slot: EquipmentSlot) -> bool
fn has_item_in_slot(&self, slot: EquipmentSlot) -> bool
Returns whether this entity currently has an item in slot.
Sourcefn can_use_slot(&self, _slot: EquipmentSlot) -> bool
fn can_use_slot(&self, _slot: EquipmentSlot) -> bool
Returns whether vanilla allows this entity to use slot.
Sourcefn can_dispenser_equip_into_slot(&self, _slot: EquipmentSlot) -> bool
fn can_dispenser_equip_into_slot(&self, _slot: EquipmentSlot) -> bool
Returns the effective vanilla dispenser slot gate for living entities and mobs.
Sourcefn can_equip_with_dispenser(&self, item_stack: &ItemStack) -> bool
fn can_equip_with_dispenser(&self, item_stack: &ItemStack) -> bool
Returns whether a dispenser may auto-equip this item onto this entity: alive, not a spectator, and the item is dispensable equipment for an open, usable slot this entity’s type accepts.
Sourcefn is_equippable_in_slot(
&self,
item_stack: &ItemStack,
slot: EquipmentSlot,
) -> bool
fn is_equippable_in_slot( &self, item_stack: &ItemStack, slot: EquipmentSlot, ) -> bool
Returns whether item_stack may be worn in slot, defaulting to
holdable-in-main-hand items with no equippable component.
Sourcefn equip_sound(
&self,
slot: EquipmentSlot,
stack: &ItemStack,
) -> Option<SoundEventRef>
fn equip_sound( &self, slot: EquipmentSlot, stack: &ItemStack, ) -> Option<SoundEventRef>
Returns the equip sound Steel can currently resolve for this entity.
Sourcefn on_equip_item(
&self,
slot: EquipmentSlot,
previous: &ItemStack,
stack: &ItemStack,
)
fn on_equip_item( &self, slot: EquipmentSlot, previous: &ItemStack, stack: &ItemStack, )
Applies the sound portion of vanilla’s equipment-change hook.
Sourcefn interact_living_entity_with_equippable(
&self,
player: &Player,
hand: InteractionHand,
) -> InteractionResult
fn interact_living_entity_with_equippable( &self, player: &Player, hand: InteractionHand, ) -> InteractionResult
Runs vanilla’s equippable ItemStack.interactLivingEntity branch.
Sourcefn refresh_equipment_attribute_modifiers(&self, slot: EquipmentSlot)
fn refresh_equipment_attribute_modifiers(&self, slot: EquipmentSlot)
Refreshes transient item attribute modifiers for one equipment slot.
Sourcefn detect_equipment_updates(&self)
fn detect_equipment_updates(&self)
Detects and applies Vanilla living-equipment changes once per tick.
Sourcefn pack_living_equipment(&self) -> Vec<EquipmentSlotItem>
fn pack_living_equipment(&self) -> Vec<EquipmentSlotItem>
Packs non-empty living equipment slots for initial spawn pairing.
Sourcefn drain_dirty_living_equipment(&self) -> Vec<EquipmentSlotItem>
fn drain_dirty_living_equipment(&self) -> Vec<EquipmentSlotItem>
Drains dirty living equipment slots for tracker sync.
Sourcefn has_infinite_materials(&self) -> bool
fn has_infinite_materials(&self) -> bool
Returns whether equipment durability should be skipped for this entity.
Sourcefn handle_extra_items_created_on_use(&self, _extra: ItemStack)
fn handle_extra_items_created_on_use(&self, _extra: ItemStack)
Mirrors vanilla LivingEntity.handleExtraItemsCreatedOnUse,
which is a no-op for non-player mobs.
Sourcefn on_equipped_item_broken(&self, _item: ItemRef, slot: EquipmentSlot)
fn on_equipped_item_broken(&self, _item: ItemRef, slot: EquipmentSlot)
Called after an equipped item breaks.
Sourcefn default_living_can_freeze(&self) -> bool
fn default_living_can_freeze(&self) -> bool
Returns vanilla LivingEntity.canFreeze() after concrete entity exemptions.
Vanilla keeps the entity-type freeze immunity on Entity and the equipment
immunity on LivingEntity. Steel keeps this helper separate so concrete
Entity::can_freeze implementations can delegate without downcasting.
Sourcefn is_on_non_air_block_for_frost(&self) -> bool
fn is_on_non_air_block_for_frost(&self) -> bool
Returns whether the block this entity is standing on is non-air, required for the powder-snow speed penalty to apply.
Sourcefn remove_frost(&self)
fn remove_frost(&self)
Removes the powder snow speed penalty modifier.
Sourcefn try_add_frost(&self)
fn try_add_frost(&self)
Applies the powder snow speed penalty modifier if the entity is frozen and can freeze.
Sourcefn tick_freezing(&self)
fn tick_freezing(&self)
Ticks freeze-related state each AI step: cools ticks_frozen when not
in powder snow (or unable to freeze), then refreshes the powder-snow
speed penalty.
Sourcefn tick_living_entity(&self, entity: &SharedEntity)
fn tick_living_entity(&self, entity: &SharedEntity)
Runs vanilla LivingEntity.tick.
The default Entity::tick dispatches living entities here.
Sourcefn tick_living_state(&self)
fn tick_living_state(&self)
Ticks living-entity counters after movement.
Sourcefn can_glide_using(&self, item_stack: &ItemStack, slot: EquipmentSlot) -> bool
fn can_glide_using(&self, item_stack: &ItemStack, slot: EquipmentSlot) -> bool
Returns whether the given item in the given slot allows elytra-style gliding.
Sourcefn can_glide_using_equipment_slot(&self, slot: EquipmentSlot) -> bool
fn can_glide_using_equipment_slot(&self, slot: EquipmentSlot) -> bool
Returns whether the item in slot can be used for vanilla gliding.
Sourcefn damage_random_glider(&self)
fn damage_random_glider(&self)
Damages a random equipped item slot that’s currently enabling this entity to glide, breaking it if durability runs out.
Sourcefn default_can_glide(&self) -> bool
fn default_can_glide(&self) -> bool
Returns whether this entity meets the base conditions to glide: not grounded, not a passenger, not levitating, and wearing something that allows gliding.
Sourcefn can_glide(&self) -> bool
fn can_glide(&self) -> bool
Returns whether the entity currently meets the conditions to glide with an elytra.
Sourcefn start_fall_flying(&self)
fn start_fall_flying(&self)
Puts the entity into the fall-flying (elytra gliding) state.
Sourcefn try_to_start_fall_flying(&self) -> bool
fn try_to_start_fall_flying(&self) -> bool
Attempts to start fall flying if the entity isn’t already gliding, can glide, and isn’t in water.
Sourcefn last_climbable_pos(&self) -> Option<BlockPos>
fn last_climbable_pos(&self) -> Option<BlockPos>
Returns the last climbable block position this living entity touched.
Sourcefn set_last_climbable_pos(&self, pos: BlockPos)
fn set_last_climbable_pos(&self, pos: BlockPos)
Records the last climbable block position this living entity touched.
Sourcefn default_living_on_climbable(&self) -> bool
fn default_living_on_climbable(&self) -> bool
Returns whether this entity is currently touching a climbable block; always false for spectators.
Sourcefn should_discard_friction(&self) -> bool
fn should_discard_friction(&self) -> bool
Returns whether vanilla living travel should skip friction damping.
Sourcefn set_discard_friction(&self, discard_friction: bool)
fn set_discard_friction(&self, discard_friction: bool)
Sets whether vanilla living travel should skip friction damping.
Sourcefn is_jumping(&self) -> bool
fn is_jumping(&self) -> bool
Returns whether this living entity is currently applying jump input.
Sourcefn set_jumping(&self, jumping: bool)
fn set_jumping(&self, jumping: bool)
Sets whether this living entity is currently applying jump input.
Sourcefn travel_input(&self) -> LivingTravelInput
fn travel_input(&self) -> LivingTravelInput
Returns vanilla living travel input.
Sourcefn set_travel_input(&self, input: LivingTravelInput)
fn set_travel_input(&self, input: LivingTravelInput)
Sets vanilla living travel input.
Sourcefn apply_input(&self)
fn apply_input(&self)
Applies horizontal damping to the entity’s stored travel input for this tick.
Sourcefn no_jump_delay(&self) -> i32
fn no_jump_delay(&self) -> i32
Returns vanilla jump cooldown ticks.
Sourcefn set_no_jump_delay(&self, ticks: i32)
fn set_no_jump_delay(&self, ticks: i32)
Sets vanilla jump cooldown ticks.
Sourcefn tick_no_jump_delay(&self)
fn tick_no_jump_delay(&self)
Decrements vanilla jump cooldown once per living AI step.
Sourcefn default_is_immobile(&self) -> bool
fn default_is_immobile(&self) -> bool
Returns vanilla LivingEntity.isImmobile().
Returns whether this entity is immobile because it’s dead or dying.
Sourcefn is_immobile(&self) -> bool
fn is_immobile(&self) -> bool
Returns whether this entity is currently immobile.
Sourcefn apply_living_velocity_thresholds(&self)
fn apply_living_velocity_thresholds(&self)
Zeroes out velocity components too small to matter, using a stricter horizontal threshold for players than other entities.
Sourcefn server_ai_step(&self, _entity: &SharedEntity)
fn server_ai_step(&self, _entity: &SharedEntity)
Server AI hook called from vanilla LivingEntity.aiStep().
Sourcefn get_jump_boost_power(&self) -> f32
fn get_jump_boost_power(&self) -> f32
Returns the jump-height bonus from the Jump Boost effect, scaling with amplifier.
Sourcefn get_jump_power_with_multiplier(&self, multiplier: f32) -> f32
fn get_jump_power_with_multiplier(&self, multiplier: f32) -> f32
Returns jump velocity from the jump-strength attribute, scaled by
multiplier, the standing block’s jump factor, and Jump Boost.
Sourcefn get_jump_power(&self) -> f32
fn get_jump_power(&self) -> f32
Returns this entity’s jump power at the default multiplier.
Sourcefn default_jump_from_ground(&self)
fn default_jump_from_ground(&self)
Applies this entity’s jump velocity, unless jump power is negligible.
Sourcefn jump_from_ground(&self)
fn jump_from_ground(&self)
Applies the entity’s jump velocity.
Sourcefn go_down_in_water(&self)
fn go_down_in_water(&self)
Applies downward velocity while submerged and not jumping out of a liquid.
Sourcefn jump_in_liquid(&self, _fluid_tag: &Identifier)
fn jump_in_liquid(&self, _fluid_tag: &Identifier)
Applies upward velocity to jump out of the given liquid.
Sourcefn handle_living_jump(&self)
fn handle_living_jump(&self)
Handles jump input each AI step: jumps from the ground when clear of jump delay, or jumps within water/lava when only partially submerged.
Sourcefn tick_ridden(&self, _controller: &Player, _ridden_input: DVec3)
fn tick_ridden(&self, _controller: &Player, _ridden_input: DVec3)
Ticks side effects of a rider controlling this entity, such as steering-based input.
Sourcefn ridden_input(&self, _controller: &Player, self_input: DVec3) -> DVec3
fn ridden_input(&self, _controller: &Player, self_input: DVec3) -> DVec3
Transforms the rider’s raw input into this entity’s movement input while ridden.
Sourcefn ridden_speed(&self, _controller: &Player) -> f32
fn ridden_speed(&self, _controller: &Player) -> f32
Returns the movement speed to use while being ridden.
Sourcefn travel_ridden(
&self,
entity: &SharedEntity,
controller: &Player,
self_input: DVec3,
) -> Option<MoveResult>
fn travel_ridden( &self, entity: &SharedEntity, controller: &Player, self_input: DVec3, ) -> Option<MoveResult>
Handles movement while this entity is being ridden and steered by a controlling player.
Sourcefn default_ai_step(&self, entity: &SharedEntity) -> Option<MoveResult>
fn default_ai_step(&self, entity: &SharedEntity) -> Option<MoveResult>
Default vanilla-shaped LivingEntity.aiStep() movement foundation for overrides.
This covers the shared travel state Steel currently has; mob AI and equipment ticking are still separate follow-up work.
Sourcefn ai_step(&self, entity: &SharedEntity) -> Option<MoveResult>
fn ai_step(&self, entity: &SharedEntity) -> Option<MoveResult>
Runs one AI-driven movement and effect tick for the entity.
Sourcefn push_entities(&self)
fn push_entities(&self)
Pushes nearby colliding entities away from this one.
Sourcefn push_entities_in_order(&self, entities: &[SharedEntity])
fn push_entities_in_order(&self, entities: &[SharedEntity])
Pushes against entities in the given order. The caller applies cramming damage first.
Sourcefn apply_entity_cramming_damage(
&self,
world: &World,
pushable_entities: &[SharedEntity],
)
fn apply_entity_cramming_damage( &self, world: &World, pushable_entities: &[SharedEntity], )
Applies vanilla max entity cramming damage from LivingEntity.pushEntities().
Sourcefn is_suppressing_sliding_down_ladder(&self) -> bool
fn is_suppressing_sliding_down_ladder(&self) -> bool
Returns whether this entity is suppressing sliding down a ladder (sneaking on one).
Sourcefn levitation_travel_y_delta(&self, movement_y: f64) -> Option<f64>
fn levitation_travel_y_delta(&self, movement_y: f64) -> Option<f64>
Returns a levitation velocity adjustment for travelInAir.
Sourcefn should_travel_in_fluid(&self, fluid_state: FluidState) -> bool
fn should_travel_in_fluid(&self, fluid_state: FluidState) -> bool
Returns whether movement should use fluid physics: currently in water or lava, affected by fluids, and unable to stand on this fluid.
Sourcefn get_water_slow_down(&self) -> f32
fn get_water_slow_down(&self) -> f32
Returns the water-movement slowdown multiplier.
Sourcefn water_movement_efficiency(&self) -> f32
fn water_movement_efficiency(&self) -> f32
Returns the water movement efficiency attribute used by fluid travel.
Sourcefn has_dolphins_grace(&self) -> bool
fn has_dolphins_grace(&self) -> bool
Returns whether dolphin’s grace should apply to water travel.
Sourcefn get_flying_speed(&self) -> f32
fn get_flying_speed(&self) -> f32
Returns airborne movement speed: scaled from this entity’s speed when ridden by a player, otherwise a small constant.
Sourcefn get_friction_influenced_speed(&self, block_friction: f32) -> f32
fn get_friction_influenced_speed(&self, block_friction: f32) -> f32
Returns movement speed adjusted by ground friction; airborne entities use flying speed instead.
Sourcefn air_travel_vertical_friction(&self, _horizontal_friction: f32) -> f32
fn air_travel_vertical_friction(&self, _horizontal_friction: f32) -> f32
Returns the vertical friction used by travelInAir.
Sourcefn handle_on_climbable(&self, movement: DVec3) -> DVec3
fn handle_on_climbable(&self, movement: DVec3) -> DVec3
Clamps movement while on a climbable block: caps horizontal and downward speed, and resets fall distance; sneaking players holding on don’t slide down non-scaffolding ladders.
Sourcefn apply_living_travel_gravity(&self)
fn apply_living_travel_gravity(&self)
Applies gravity using vanilla living-entity effective gravity.
Sourcefn handle_relative_friction_and_calculate_movement(
&self,
entity: &SharedEntity,
input: DVec3,
block_friction: f32,
) -> Option<(DVec3, MoveResult)>
fn handle_relative_friction_and_calculate_movement( &self, entity: &SharedEntity, input: DVec3, block_friction: f32, ) -> Option<(DVec3, MoveResult)>
Applies friction-adjusted relative movement and returns the resulting velocity and move result.
Sourcefn travel_in_air(
&self,
entity: &SharedEntity,
input: DVec3,
) -> Option<MoveResult>
fn travel_in_air( &self, entity: &SharedEntity, input: DVec3, ) -> Option<MoveResult>
Handles movement, gravity, and air friction while the entity is airborne.
Sourcefn get_fluid_falling_adjusted_movement(
&self,
base_gravity: f64,
is_falling: bool,
movement: DVec3,
) -> DVec3
fn get_fluid_falling_adjusted_movement( &self, base_gravity: f64, is_falling: bool, movement: DVec3, ) -> DVec3
Adjusts vertical movement while falling through a fluid to smooth the fall speed.
Sourcefn jump_out_of_fluid(&self, old_y: f64)
fn jump_out_of_fluid(&self, old_y: f64)
Gives the entity an upward boost when it collides horizontally while rising out of a fluid.
Sourcefn float_in_water_while_ridden(&self)
fn float_in_water_while_ridden(&self)
Applies buoyancy to keep a ridden entity afloat when it’s tagged to float while ridden.
Sourcefn travel_in_water(
&self,
entity: &SharedEntity,
input: DVec3,
base_gravity: f64,
is_falling: bool,
old_y: f64,
) -> Option<MoveResult>
fn travel_in_water( &self, entity: &SharedEntity, input: DVec3, base_gravity: f64, is_falling: bool, old_y: f64, ) -> Option<MoveResult>
Handles movement, drag, and buoyancy effects while the entity is swimming in water.
Sourcefn travel_in_lava(
&self,
entity: &SharedEntity,
input: DVec3,
base_gravity: f64,
is_falling: bool,
old_y: f64,
) -> Option<MoveResult>
fn travel_in_lava( &self, entity: &SharedEntity, input: DVec3, base_gravity: f64, is_falling: bool, old_y: f64, ) -> Option<MoveResult>
Handles movement and drag effects while the entity is moving through lava.
Sourcefn travel_in_fluid(
&self,
entity: &SharedEntity,
input: DVec3,
) -> Option<MoveResult>
fn travel_in_fluid( &self, entity: &SharedEntity, input: DVec3, ) -> Option<MoveResult>
Dispatches fluid movement handling to the water or lava variant based on the current fluid.
Sourcefn update_fall_flying(&self)
fn update_fall_flying(&self)
Mirrors the validation part of vanilla LivingEntity.updateFallFlying().
Sourcefn update_fall_flying_movement(&self, movement: DVec3) -> DVec3
fn update_fall_flying_movement(&self, movement: DVec3) -> DVec3
Computes the next movement vector for elytra gliding based on look direction and lift.
Sourcefn stop_fall_flying(&self)
fn stop_fall_flying(&self)
Toggles fall flying off, ending the elytra gliding state.
Sourcefn handle_fall_flying_collisions(
&self,
previous_horizontal_speed: f64,
new_horizontal_speed: f64,
)
fn handle_fall_flying_collisions( &self, previous_horizontal_speed: f64, new_horizontal_speed: f64, )
Applies fly-into-wall damage when a horizontal collision occurs while gliding.
Sourcefn travel_fall_flying(
&self,
entity: &SharedEntity,
input: DVec3,
) -> Option<MoveResult>
fn travel_fall_flying( &self, entity: &SharedEntity, input: DVec3, ) -> Option<MoveResult>
Handles movement, lift, and collision damage while the entity is gliding with an elytra.
Sourcefn default_travel(
&self,
entity: &SharedEntity,
input: DVec3,
) -> Option<MoveResult>
fn default_travel( &self, entity: &SharedEntity, input: DVec3, ) -> Option<MoveResult>
Dispatches movement to fluid, fall-flying, or air travel handling based on current state.
Sourcefn travel(&self, entity: &SharedEntity, input: DVec3) -> Option<MoveResult>
fn travel(&self, entity: &SharedEntity, input: DVec3) -> Option<MoveResult>
Handles the entity’s self-driven movement for the current tick based on its input.
Sourcefn sleeping_pos(&self) -> Option<BlockPos>
fn sleeping_pos(&self) -> Option<BlockPos>
Returns the bed position that makes this living entity sleeping.
Sourcefn set_sleeping_pos(&self, bed_position: BlockPos)
fn set_sleeping_pos(&self, bed_position: BlockPos)
Sets the vanilla living-entity sleeping position.
Sourcefn clear_sleeping_pos(&self)
fn clear_sleeping_pos(&self)
Clears the vanilla living-entity sleeping position.
Sourcefn is_sleeping(&self) -> bool
fn is_sleeping(&self) -> bool
Checks if the entity is sleeping.
Sourcefn living_synced_data(&self) -> Option<&dyn LivingEntitySyncedData>
fn living_synced_data(&self) -> Option<&dyn LivingEntitySyncedData>
Returns synchronized data specific to this living entity type, if
any; None by default.
Sourcefn start_sleeping(&self, bed_position: BlockPos) -> Result<(), EntityMoveError>
fn start_sleeping(&self, bed_position: BlockPos) -> Result<(), EntityMoveError>
Starts sleeping at the given bed position.
Sourcefn default_stop_sleeping(&self)
fn default_stop_sleeping(&self)
Shared body for overrides that need vanilla super.stopSleeping().
Sourcefn stop_sleeping(&self)
fn stop_sleeping(&self)
Stops the entity from sleeping.
Sourcefn is_sprinting(&self) -> bool
fn is_sprinting(&self) -> bool
Checks if the entity is sprinting.
Sourcefn set_sprinting(&self, sprinting: bool)
fn set_sprinting(&self, sprinting: bool)
Sets whether the entity is sprinting.
Sourcefn apply_post_impulse_grace_time(&self, ticks: i32)
fn apply_post_impulse_grace_time(&self, ticks: i32)
Applies vanilla post-impulse movement validation grace.
Sourcefn set_ignore_fall_damage_from_current_impulse(
&self,
ignore_fall_damage: bool,
new_impulse_impact_pos: DVec3,
)
fn set_ignore_fall_damage_from_current_impulse( &self, ignore_fall_damage: bool, new_impulse_impact_pos: DVec3, )
Sets whether fall damage from the current knockback/impulse impact should be ignored.
Sourcefn is_ignoring_fall_damage_from_current_impulse(&self) -> bool
fn is_ignoring_fall_damage_from_current_impulse(&self) -> bool
Returns whether fall damage should currently be ignored due to a recent knockback/impulse impact.
Sourcefn current_impulse_impact_pos(&self) -> Option<DVec3>
fn current_impulse_impact_pos(&self) -> Option<DVec3>
Returns the position of the most recent knockback/impulse impact, if still active.
Sourcefn try_reset_current_impulse_context(&self)
fn try_reset_current_impulse_context(&self)
Attempts to reset the current impulse context.
Sourcefn reset_current_impulse_context(&self)
fn reset_current_impulse_context(&self)
Resets the current impulse context.
Sourcefn is_in_post_impulse_grace_time(&self) -> bool
fn is_in_post_impulse_grace_time(&self) -> bool
Returns whether movement validation is inside post-impulse grace.
Sourcefn tick_post_impulse_grace_time(&self)
fn tick_post_impulse_grace_time(&self)
Decrements post-impulse grace once per living-entity tick.
Sourcefn refresh_dirty_attributes(&self)
fn refresh_dirty_attributes(&self)
Drains dirty attributes and applies server-side effects.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".