Skip to main content

LivingEntity

Trait LivingEntity 

Source
pub trait LivingEntity: Entity {
Show 236 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 advance_attack_animation_for_base_tick(&self) { ... } fn base_tick_living_entity(&self) { ... } fn living_swing_state(&self) -> LivingSwingState { ... } fn current_swing_duration(&self) -> i32 { ... } fn swing(&self, hand: InteractionHand, update_self: bool) { ... } fn update_swing_time(&self) { ... } fn attributes(&self) -> &SyncMutex<AttributeMap> { ... } 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_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 sound_volume(&self) -> f32 { ... } fn 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<DamageSource> { ... } fn set_last_hurt_by_player(&self, player_uuid: Uuid, 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, world: &World, source: &DamageSource, ) { ... } fn resolve_player_responsible_for_damage( &self, world: &World, 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 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 broadcast_hurt_animation(&self, world: &World) { ... } fn die(&self, source: &DamageSource) { ... } 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_id: Option<i32>, ) -> i32 { ... } fn drop_all_death_loot(&self, source: &DamageSource) { ... } fn drop_experience(&self, world: &Arc<World>, killer_entity_id: Option<i32>) { ... } 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 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 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 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 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 on_equipped_item_broken(&self, 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) { ... } 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 default_is_immobile(&self) -> bool { ... } fn is_immobile(&self) -> bool { ... } fn apply_living_velocity_thresholds(&self) { ... } fn server_ai_step(&self) { ... } 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, controller: &Player, self_input: DVec3, ) -> Option<MoveResult> { ... } fn default_ai_step(&self) -> Option<MoveResult> { ... } fn ai_step(&self) -> Option<MoveResult> { ... } fn push_entities(&self) { ... } 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, input: DVec3, block_friction: f32, ) -> Option<(DVec3, MoveResult)> { ... } fn travel_in_air(&self, 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, input: DVec3, base_gravity: f64, is_falling: bool, old_y: f64, ) -> Option<MoveResult> { ... } fn travel_in_lava( &self, input: DVec3, base_gravity: f64, is_falling: bool, old_y: f64, ) -> Option<MoveResult> { ... } fn travel_in_fluid(&self, 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, input: DVec3) -> Option<MoveResult> { ... } fn default_travel(&self, input: DVec3) -> Option<MoveResult> { ... } fn travel(&self, 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 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) { ... }
}
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§

Source

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.

Source

fn get_health(&self) -> f32

Gets the current health of the entity.

Source

fn set_health(&self, health: f32)

Sets the health of the entity, clamped between 0 and max health.

Provided Methods§

Source

fn living_rotation_state(&self) -> LivingRotationState

Returns vanilla living body/head rotation state.

Source

fn y_body_rot(&self) -> f32

Returns vanilla LivingEntity.yBodyRot.

Source

fn set_y_body_rot(&self, y_body_rot: f32)

Sets vanilla LivingEntity.yBodyRot.

Source

fn y_head_rot(&self) -> f32

Returns vanilla LivingEntity.yHeadRot.

Source

fn set_y_head_rot(&self, y_head_rot: f32)

Sets vanilla LivingEntity.yHeadRot.

Source

fn advance_living_rotation_for_base_tick(&self)

Copies current living body/head rotations to vanilla old-rotation state.

Source

fn advance_attack_animation_for_base_tick(&self)

Copies current attack animation to vanilla old attack-animation state.

Source

fn base_tick_living_entity(&self)

Runs vanilla LivingEntity.baseTick.

Source

fn living_swing_state(&self) -> LivingSwingState

Returns vanilla arm-swing animation state.

Source

fn current_swing_duration(&self) -> i32

Returns vanilla LivingEntity.getCurrentSwingDuration.

Source

fn swing(&self, hand: InteractionHand, update_self: bool)

Runs vanilla LivingEntity.swing.

Source

fn update_swing_time(&self)

Runs vanilla LivingEntity.updateSwingTime.

Source

fn attributes(&self) -> &SyncMutex<AttributeMap>

Returns a reference to this entity’s attribute map.

Source

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.

Source

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.

Source

fn drain_dirty_mob_effects(&self) -> Vec<MobEffectSyncChange>

Drains dirty mob-effect packet changes for vanilla recipients.

Source

fn pack_all_equipment(&self) -> Vec<EquipmentSlotItem>

Packs non-empty equipment slots for initial spawn pairing.

Source

fn drain_dirty_equipment(&self) -> Vec<EquipmentSlotItem>

Drains equipment slots that changed since the last tracker sync.

Source

fn save_command_nbt(&self, nbt: &mut NbtCompound)

Appends vanilla-shaped living state used by command NBT predicates.

Source

fn get_max_health(&self) -> f32

Gets the maximum health from the attribute system.

Source

fn no_action_time(&self) -> i32

Returns vanilla LivingEntity.noActionTime.

Source

fn set_no_action_time(&self, no_action_time: i32)

Sets vanilla LivingEntity.noActionTime.

Source

fn increment_no_action_time(&self)

Increments vanilla LivingEntity.noActionTime.

Source

fn heal(&self, amount: f32)

Heals the entity by the specified amount.

Source

fn is_dead_or_dying(&self) -> bool

Returns true if the entity is dead or dying (health <= 0).

Source

fn is_baby(&self) -> bool

Returns vanilla LivingEntity.isBaby().

Source

fn sound_volume(&self) -> f32

Returns vanilla LivingEntity.getSoundVolume.

Source

fn voice_pitch(&self) -> f32

Returns vanilla LivingEntity.getVoicePitch.

Source

fn hurt_sound(&self, _source: &DamageSource) -> Option<SoundEventRef>

Returns vanilla LivingEntity.getHurtSound.

Source

fn death_sound(&self) -> Option<SoundEventRef>

Returns vanilla LivingEntity.getDeathSound.

Source

fn make_sound(&self, sound: Option<SoundEventRef>)

Runs vanilla LivingEntity.makeSound.

Source

fn play_hurt_sound(&self, source: &DamageSource)

Runs vanilla LivingEntity.playHurtSound.

Source

fn play_death_sound(&self)

Plays vanilla’s death sound for this living entity.

Source

fn get_age_scale(&self) -> f32

Returns vanilla LivingEntity.getAgeScale().

Source

fn get_scale(&self) -> f32

Returns vanilla LivingEntity.getScale().

Source

fn is_alive(&self) -> bool

Returns true if the entity is alive (health > 0).

Source

fn get_armor_cover_percentage(&self) -> f32

Returns vanilla LivingEntity.getArmorCoverPercentage().

Source

fn get_visibility_percent(&self, targeting_entity: Option<&dyn Entity>) -> f64

Returns vanilla LivingEntity.getVisibilityPercent().

Source

fn disguise_head_matches_targeting_entity( &self, targeting_entity: Option<&dyn Entity>, ) -> bool

Returns whether the equipped head item reduces visibility to targeting_entity.

Source

fn can_be_seen_by_anyone(&self) -> bool

Returns vanilla LivingEntity.canBeSeenByAnyone().

Source

fn can_be_seen_as_enemy(&self) -> bool

Returns vanilla LivingEntity.canBeSeenAsEnemy().

Source

fn can_attack(&self, target: &dyn LivingEntity) -> bool

Returns vanilla LivingEntity.canAttack().

Source

fn last_damage_source(&self) -> Option<DamageSource>

Returns vanilla LivingEntity.getLastDamageSource().

Source

fn set_last_hurt_by_player(&self, player_uuid: Uuid, time_to_remember: i32)

Sets vanilla LivingEntity.lastHurtByPlayer.

Source

fn last_hurt_by_player_memory_time(&self) -> i32

Returns vanilla LivingEntity.lastHurtByPlayerMemoryTime.

Source

fn last_hurt_by_player_uuid(&self) -> Option<Uuid>

Returns vanilla LivingEntity.lastHurtByPlayer, if still remembered.

Source

fn last_hurt_by_mob(&self) -> Option<SharedEntity>

Returns vanilla LivingEntity.lastHurtByMob.

Source

fn last_hurt_by_mob_timestamp(&self) -> i32

Returns vanilla LivingEntity.lastHurtByMobTimestamp.

Source

fn set_last_hurt_by_mob(&self, target: Option<&SharedEntity>)

Sets vanilla LivingEntity.lastHurtByMob.

Source

fn last_hurt_mob(&self) -> Option<SharedEntity>

Returns vanilla LivingEntity.lastHurtMob.

Source

fn last_hurt_mob_timestamp(&self) -> i32

Returns vanilla LivingEntity.lastHurtMobTimestamp.

Source

fn set_last_hurt_mob(&self, target: Option<&SharedEntity>)

Sets vanilla LivingEntity.lastHurtMob.

Source

fn resolve_mob_responsible_for_damage( &self, world: &World, source: &DamageSource, )

Resolves vanilla LivingEntity.resolveMobResponsibleForDamage.

Source

fn resolve_player_responsible_for_damage( &self, world: &World, source: &DamageSource, )

Resolves vanilla LivingEntity.resolvePlayerResponsibleForDamage.

Source

fn has_line_of_sight(&self, target: &dyn Entity) -> bool

Returns vanilla LivingEntity.hasLineOfSight().

Source

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.

Source

fn default_is_invulnerable_to(&self, source: &DamageSource) -> bool

Returns vanilla base living-entity invulnerability.

Source

fn is_invulnerable_to(&self, world: &World, source: &DamageSource) -> bool

Returns whether this living entity ignores a damage source.

Source

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.

Source

fn before_actually_hurt(&self, _source: &DamageSource, _amount: f32)

Hook before applying damage after vanilla reductions.

Source

fn hurt_armor(&self, _source: &DamageSource, _damage: f32)

Damages equipment that participates in vanilla armor absorption.

Source

fn do_hurt_equipment( &self, source: &DamageSource, damage: f32, slots: &[EquipmentSlot], )

Mirrors vanilla LivingEntity.doHurtEquipment.

Source

fn get_damage_after_armor_absorb( &self, source: &DamageSource, damage: f32, ) -> f32

Mirrors vanilla LivingEntity.getDamageAfterArmorAbsorb.

Source

fn get_damage_after_magic_absorb( &self, source: &DamageSource, damage: f32, ) -> f32

Mirrors vanilla LivingEntity.getDamageAfterMagicAbsorb.

Source

fn actually_hurt(&self, world: &World, source: &DamageSource, amount: f32)

Applies damage after vanilla reductions.

Source

fn apply_damage_knockback(&self, source: &DamageSource)

Applies vanilla hurt knockback for a damage source.

Source

fn damage_knockback_direction(&self, source: &DamageSource) -> (f64, f64)

Returns the horizontal direction used by vanilla damage knockback.

Source

fn knockback(&self, power: f64, xd: f64, zd: f64)

Applies vanilla LivingEntity.knockback.

Source

fn knockback_resistance(&self) -> f64

Returns vanilla knockback resistance.

Source

fn indicate_damage(&self, _xd: f64, _zd: f64)

Mirrors vanilla LivingEntity.indicateDamage.

Source

fn hurt_broadcast_chunk(&self) -> ChunkPos

Returns the chunk used for vanilla nearby hurt broadcasts.

Source

fn broadcast_damage_event(&self, world: &World, source: &DamageSource)

Broadcasts vanilla damage-event metadata near this entity.

Source

fn broadcast_hurt_animation(&self, world: &World)

Broadcasts vanilla hurt animation near this entity.

Source

fn die(&self, source: &DamageSource)

Processes vanilla living death side effects.

Source

fn should_drop_loot(&self, world: &World) -> bool

Returns vanilla LivingEntity.shouldDropLoot.

Source

fn should_drop_experience(&self) -> bool

Returns vanilla LivingEntity.shouldDropExperience.

Source

fn is_always_experience_dropper(&self) -> bool

Returns vanilla LivingEntity.isAlwaysExperienceDropper.

Source

fn skip_drop_experience(&self)

Runs vanilla LivingEntity.skipDropExperience.

Source

fn was_experience_consumed(&self) -> bool

Returns vanilla LivingEntity.wasExperienceConsumed.

Source

fn base_experience_reward(&self) -> i32

Returns vanilla LivingEntity.getBaseExperienceReward.

Source

fn experience_reward( &self, _world: &World, _killer_entity_id: Option<i32>, ) -> i32

Returns vanilla LivingEntity.getExperienceReward.

Source

fn drop_all_death_loot(&self, source: &DamageSource)

Runs the currently implemented subset of vanilla LivingEntity.dropAllDeathLoot.

Source

fn drop_experience(&self, world: &Arc<World>, killer_entity_id: Option<i32>)

Runs vanilla LivingEntity.dropExperience.

Source

fn death_loot_table(&self) -> Option<LootTableRef>

Resolves the loot table used by vanilla LivingEntity.dropFromLootTable.

Source

fn death_loot_table_seed(&self) -> i64

Returns vanilla Entity.getLootTableSeed for death loot.

Source

fn drop_from_loot_table(&self, source: &DamageSource, killed_by_player: bool)

Runs vanilla LivingEntity.dropFromLootTable.

Source

fn drop_custom_death_loot( &self, _source: &DamageSource, _killed_by_player: bool, )

Hook for non-mob custom death loot.

Source

fn tick_death(&self)

Ticks the vanilla living death animation and removes the entity at completion.

Source

fn get_absorption_amount(&self) -> f32

Gets the absorption amount (extra health from effects like absorption).

Source

fn set_absorption_amount(&self, amount: f32)

Sets the absorption amount.

Source

fn fall_damage_sound(&self, damage: i32) -> SoundEventRef

Returns vanilla LivingEntity.getFallDamageSound().

Source

fn play_block_fall_sound(&self)

Plays vanilla LivingEntity.playBlockFallSound().

Source

fn cause_living_fall_damage( &self, fall_distance: f64, damage_modifier: f32, source: &DamageSource, ) -> bool

Mirrors vanilla LivingEntity.causeFallDamage.

Source

fn get_armor_value(&self) -> i32

Gets the entity’s armor value from the attribute system.

Source

fn get_attribute_gravity(&self) -> f64

Gets the gravity value from the attribute system.

Source

fn get_effective_gravity(&self) -> f64

Returns vanilla LivingEntity.getEffectiveGravity().

Source

fn is_affected_by_potions(&self) -> bool

Checks if the entity can be affected by potions.

Source

fn default_can_be_affected(&self, effect: &MobEffectInstance) -> bool

Returns vanilla base LivingEntity.canBeAffected eligibility.

Source

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.

Source

fn has_mob_effect(&self, effect: MobEffectRef) -> bool

Returns vanilla LivingEntity.hasEffect().

Source

fn mob_effect(&self, effect: MobEffectRef) -> Option<ActiveMobEffect>

Returns vanilla LivingEntity.getEffect().

Source

fn active_mob_effects(&self) -> Vec<ActiveMobEffect>

Returns all active vanilla mob effects.

Source

fn set_mob_effect(&self, effect: MobEffectRef, amplifier: i32)

Sets active vanilla mob-effect state.

Source

fn add_mob_effect(&self, effect: MobEffectInstance) -> bool

Adds or updates active vanilla mob-effect state.

Source

fn set_mob_effect_active(&self, effect: MobEffectRef, active: bool)

Sets the presence of a vanilla mob effect.

Source

fn remove_mob_effect(&self, effect: MobEffectRef) -> bool

Removes active vanilla mob-effect state.

Source

fn tick_mob_effects(&self)

Ticks vanilla server-side mob-effect behavior and durations.

Source

fn has_water_breathing(&self) -> bool

Returns whether vanilla effects keep this entity from drowning.

Source

fn should_effects_refill_air_supply(&self) -> bool

Returns whether active vanilla effects refill this entity’s air supply.

Source

fn can_breathe_underwater(&self) -> bool

Returns vanilla LivingEntity.canBreatheUnderwater.

Source

fn can_drown_in_water(&self) -> bool

Returns whether this entity can lose air and take drowning damage.

Source

fn is_eye_in_bubble_column(&self) -> bool

Returns whether the entity’s eye block is a bubble column.

Source

fn decrease_air_supply(&self, current_supply: i32) -> i32

Mirrors vanilla LivingEntity.decreaseAirSupply.

Source

fn increase_air_supply(&self, current_supply: i32) -> i32

Mirrors vanilla LivingEntity.increaseAirSupply.

Source

fn should_take_drowning_damage(&self) -> bool

Mirrors vanilla LivingEntity.shouldTakeDrowningDamage.

Source

fn tick_living_air_supply(&self)

Ticks vanilla living air-supply and drowning behavior from baseTick.

Source

fn is_in_wall(&self) -> bool

Mirrors vanilla LivingEntity.isInWall.

Source

fn tick_in_wall_damage(&self)

Applies vanilla living in-wall damage from baseTick.

Source

fn tick_living_environmental_damage(&self)

Applies vanilla living environmental damage in LivingEntity.baseTick order.

Source

fn is_affected_by_fluids(&self) -> bool

Returns vanilla LivingEntity.isAffectedByFluids().

Source

fn can_stand_on_fluid(&self, _fluid_state: FluidState) -> bool

Returns vanilla LivingEntity.canStandOnFluid().

Source

fn is_using_item(&self) -> bool

Checks if the entity is currently using an item.

Source

fn is_blocking(&self) -> bool

Checks if the entity is blocking with a shield or similar item.

Source

fn is_fall_flying(&self) -> bool

Checks if the entity is fall flying (using elytra).

Source

fn set_fall_flying(&self, fall_flying: bool)

Sets whether this entity is fall flying.

Source

fn fall_flying_ticks(&self) -> i32

Returns vanilla LivingEntity.getFallFlyingTicks().

Source

fn with_equipment_slot( &self, slot: EquipmentSlot, visitor: &mut dyn FnMut(&ItemStack), )

Visits the item in a vanilla living-entity equipment slot.

Source

fn is_holding(&self, predicate: &mut dyn FnMut(&ItemStack) -> bool) -> bool

Returns vanilla LivingEntity.isHolding.

Source

fn with_equipment_slot_mut( &self, slot: EquipmentSlot, visitor: &mut dyn FnMut(&mut ItemStack), )

Mutates the item in a vanilla living-entity equipment slot.

Source

fn has_item_in_slot(&self, slot: EquipmentSlot) -> bool

Returns whether this entity currently has an item in slot.

Source

fn can_use_slot(&self, _slot: EquipmentSlot) -> bool

Returns whether vanilla allows this entity to use slot.

Source

fn can_dispenser_equip_into_slot(&self, _slot: EquipmentSlot) -> bool

Returns the effective vanilla dispenser slot gate for living entities and mobs.

Source

fn can_equip_with_dispenser(&self, item_stack: &ItemStack) -> bool

Returns vanilla LivingEntity.canEquipWithDispenser.

Source

fn is_equippable_in_slot( &self, item_stack: &ItemStack, slot: EquipmentSlot, ) -> bool

Returns vanilla LivingEntity.isEquippableInSlot.

Source

fn equip_sound( &self, slot: EquipmentSlot, stack: &ItemStack, ) -> Option<SoundEventRef>

Returns the equip sound Steel can currently resolve for this entity.

Source

fn interact_living_entity_with_equippable( &self, player: &Player, hand: InteractionHand, ) -> InteractionResult

Runs vanilla’s equippable ItemStack.interactLivingEntity branch.

Source

fn refresh_equipment_attribute_modifiers(&self, slot: EquipmentSlot)

Refreshes transient item attribute modifiers for one equipment slot.

Source

fn detect_equipment_updates(&self)

Detects and applies Vanilla living-equipment changes once per tick.

Source

fn pack_living_equipment(&self) -> Vec<EquipmentSlotItem>

Packs non-empty living equipment slots for initial spawn pairing.

Source

fn drain_dirty_living_equipment(&self) -> Vec<EquipmentSlotItem>

Drains dirty living equipment slots for tracker sync.

Source

fn has_infinite_materials(&self) -> bool

Returns whether equipment durability should be skipped for this entity.

Source

fn on_equipped_item_broken(&self, slot: EquipmentSlot)

Called after an equipped item breaks.

Source

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.

Source

fn is_on_non_air_block_for_frost(&self) -> bool

Returns whether vanilla tryAddFrost sees a non-air block below.

Source

fn remove_frost(&self)

Mirrors vanilla LivingEntity.removeFrost.

Source

fn try_add_frost(&self)

Mirrors vanilla LivingEntity.tryAddFrost.

Source

fn tick_freezing(&self)

Ticks vanilla LivingEntity.aiStep freezing effects.

Source

fn tick_living_entity(&self)

Runs vanilla LivingEntity.tick.

The default Entity::tick dispatches living entities here.

Source

fn tick_living_state(&self)

Ticks living-entity counters after movement.

Source

fn can_glide_using(&self, item_stack: &ItemStack, slot: EquipmentSlot) -> bool

Mirrors vanilla LivingEntity.canGlideUsing().

Source

fn can_glide_using_equipment_slot(&self, slot: EquipmentSlot) -> bool

Returns whether the item in slot can be used for vanilla gliding.

Source

fn damage_random_glider(&self)

Damages one random equipped glider like vanilla LivingEntity.updateFallFlying().

Source

fn default_can_glide(&self) -> bool

Default vanilla LivingEntity.canGlide() implementation for overrides.

Source

fn can_glide(&self) -> bool

Mirrors vanilla LivingEntity.canGlide().

Source

fn start_fall_flying(&self)

Mirrors vanilla Player.startFallFlying().

Source

fn try_to_start_fall_flying(&self) -> bool

Mirrors vanilla Player.tryToStartFallFlying().

Source

fn last_climbable_pos(&self) -> Option<BlockPos>

Returns the last climbable block position this living entity touched.

Source

fn set_last_climbable_pos(&self, pos: BlockPos)

Records the last climbable block position this living entity touched.

Source

fn default_living_on_climbable(&self) -> bool

Returns vanilla LivingEntity.onClimbable() behavior.

Source

fn should_discard_friction(&self) -> bool

Returns whether vanilla living travel should skip friction damping.

Source

fn set_discard_friction(&self, discard_friction: bool)

Sets whether vanilla living travel should skip friction damping.

Source

fn is_jumping(&self) -> bool

Returns whether this living entity is currently applying jump input.

Source

fn set_jumping(&self, jumping: bool)

Sets whether this living entity is currently applying jump input.

Source

fn travel_input(&self) -> LivingTravelInput

Returns vanilla living travel input.

Source

fn set_travel_input(&self, input: LivingTravelInput)

Sets vanilla living travel input.

Source

fn apply_input(&self)

Applies vanilla LivingEntity.applyInput() damping.

Source

fn no_jump_delay(&self) -> i32

Returns vanilla jump cooldown ticks.

Source

fn set_no_jump_delay(&self, ticks: i32)

Sets vanilla jump cooldown ticks.

Source

fn tick_no_jump_delay(&self)

Decrements vanilla jump cooldown once per living AI step.

Source

fn default_is_immobile(&self) -> bool

Returns vanilla LivingEntity.isImmobile().

Source

fn is_immobile(&self) -> bool

Returns vanilla LivingEntity.isImmobile().

Source

fn apply_living_velocity_thresholds(&self)

Applies vanilla LivingEntity.aiStep() velocity thresholds.

Source

fn server_ai_step(&self)

Server AI hook called from vanilla LivingEntity.aiStep().

Source

fn get_jump_boost_power(&self) -> f32

Returns vanilla LivingEntity.getJumpBoostPower().

Source

fn get_jump_power_with_multiplier(&self, multiplier: f32) -> f32

Returns vanilla LivingEntity.getJumpPower(float).

Source

fn get_jump_power(&self) -> f32

Returns vanilla LivingEntity.getJumpPower().

Source

fn default_jump_from_ground(&self)

Default vanilla LivingEntity.jumpFromGround() implementation for overrides.

Source

fn jump_from_ground(&self)

Mirrors vanilla LivingEntity.jumpFromGround().

Source

fn go_down_in_water(&self)

Mirrors vanilla LivingEntity.goDownInWater().

Source

fn jump_in_liquid(&self, _fluid_tag: &Identifier)

Mirrors vanilla LivingEntity.jumpInLiquid().

Source

fn handle_living_jump(&self)

Applies vanilla LivingEntity.aiStep() jump handling.

Source

fn tick_ridden(&self, _controller: &Player, _ridden_input: DVec3)

Mirrors vanilla LivingEntity.tickRidden().

Source

fn ridden_input(&self, _controller: &Player, self_input: DVec3) -> DVec3

Mirrors vanilla LivingEntity.getRiddenInput().

Source

fn ridden_speed(&self, _controller: &Player) -> f32

Mirrors vanilla LivingEntity.getRiddenSpeed().

Source

fn travel_ridden( &self, controller: &Player, self_input: DVec3, ) -> Option<MoveResult>

Mirrors vanilla LivingEntity.travelRidden().

Source

fn default_ai_step(&self) -> 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.

Source

fn ai_step(&self) -> Option<MoveResult>

Mirrors vanilla LivingEntity.aiStep().

Source

fn push_entities(&self)

Mirrors vanilla LivingEntity.pushEntities().

Source

fn apply_entity_cramming_damage( &self, world: &World, pushable_entities: &[SharedEntity], )

Applies vanilla max entity cramming damage from LivingEntity.pushEntities().

Source

fn is_suppressing_sliding_down_ladder(&self) -> bool

Returns vanilla LivingEntity.isSuppressingSlidingDownLadder().

Source

fn levitation_travel_y_delta(&self, movement_y: f64) -> Option<f64>

Returns a levitation velocity adjustment for travelInAir.

Source

fn should_travel_in_fluid(&self, fluid_state: FluidState) -> bool

Returns whether vanilla LivingEntity.travel() should use fluid movement.

Source

fn get_water_slow_down(&self) -> f32

Returns vanilla LivingEntity.getWaterSlowDown().

Source

fn water_movement_efficiency(&self) -> f32

Returns the water movement efficiency attribute used by fluid travel.

Source

fn has_dolphins_grace(&self) -> bool

Returns whether dolphin’s grace should apply to water travel.

Source

fn get_flying_speed(&self) -> f32

Returns vanilla LivingEntity.getFlyingSpeed().

Source

fn get_friction_influenced_speed(&self, block_friction: f32) -> f32

Returns vanilla LivingEntity.getFrictionInfluencedSpeed().

Source

fn air_travel_vertical_friction(&self, _horizontal_friction: f32) -> f32

Returns the vertical friction used by travelInAir.

Source

fn handle_on_climbable(&self, movement: DVec3) -> DVec3

Applies vanilla LivingEntity.handleOnClimbable().

Source

fn apply_living_travel_gravity(&self)

Applies gravity using vanilla living-entity effective gravity.

Source

fn handle_relative_friction_and_calculate_movement( &self, input: DVec3, block_friction: f32, ) -> Option<(DVec3, MoveResult)>

Mirrors vanilla LivingEntity.handleRelativeFrictionAndCalculateMovement().

Source

fn travel_in_air(&self, input: DVec3) -> Option<MoveResult>

Mirrors vanilla LivingEntity.travelInAir().

Source

fn get_fluid_falling_adjusted_movement( &self, base_gravity: f64, is_falling: bool, movement: DVec3, ) -> DVec3

Mirrors vanilla LivingEntity.getFluidFallingAdjustedMovement().

Source

fn jump_out_of_fluid(&self, old_y: f64)

Mirrors vanilla LivingEntity.jumpOutOfFluid().

Source

fn float_in_water_while_ridden(&self)

Mirrors vanilla LivingEntity.floatInWaterWhileRidden().

Source

fn travel_in_water( &self, input: DVec3, base_gravity: f64, is_falling: bool, old_y: f64, ) -> Option<MoveResult>

Mirrors vanilla LivingEntity.travelInWater().

Source

fn travel_in_lava( &self, input: DVec3, base_gravity: f64, is_falling: bool, old_y: f64, ) -> Option<MoveResult>

Mirrors vanilla LivingEntity.travelInLava().

Source

fn travel_in_fluid(&self, input: DVec3) -> Option<MoveResult>

Mirrors vanilla LivingEntity.travelInFluid().

Source

fn update_fall_flying(&self)

Mirrors the validation part of vanilla LivingEntity.updateFallFlying().

Source

fn update_fall_flying_movement(&self, movement: DVec3) -> DVec3

Mirrors vanilla LivingEntity.updateFallFlyingMovement().

Source

fn stop_fall_flying(&self)

Mirrors vanilla LivingEntity.stopFallFlying().

Source

fn handle_fall_flying_collisions( &self, previous_horizontal_speed: f64, new_horizontal_speed: f64, )

Mirrors vanilla LivingEntity.handleFallFlyingCollisions().

Source

fn travel_fall_flying(&self, input: DVec3) -> Option<MoveResult>

Mirrors vanilla LivingEntity.travelFallFlying().

Source

fn default_travel(&self, input: DVec3) -> Option<MoveResult>

Default vanilla LivingEntity.travel() implementation for overrides.

Source

fn travel(&self, input: DVec3) -> Option<MoveResult>

Mirrors vanilla LivingEntity.travel().

Source

fn sleeping_pos(&self) -> Option<BlockPos>

Returns the bed position that makes this living entity sleeping.

Source

fn set_sleeping_pos(&self, bed_position: BlockPos)

Sets the vanilla living-entity sleeping position.

Source

fn clear_sleeping_pos(&self)

Clears the vanilla living-entity sleeping position.

Source

fn is_sleeping(&self) -> bool

Checks if the entity is sleeping.

Source

fn stop_sleeping(&self)

Stops the entity from sleeping.

Source

fn is_sprinting(&self) -> bool

Checks if the entity is sprinting.

Source

fn set_sprinting(&self, sprinting: bool)

Sets whether the entity is sprinting.

Source

fn get_speed(&self) -> f32

Gets the entity’s cached movement speed.

Source

fn set_speed(&self, speed: f32)

Sets the entity’s cached movement speed.

Source

fn apply_post_impulse_grace_time(&self, ticks: i32)

Applies vanilla post-impulse movement validation grace.

Source

fn set_ignore_fall_damage_from_current_impulse( &self, ignore_fall_damage: bool, new_impulse_impact_pos: DVec3, )

Mirrors vanilla LivingEntity.setIgnoreFallDamageFromCurrentImpulse.

Source

fn is_ignoring_fall_damage_from_current_impulse(&self) -> bool

Returns vanilla LivingEntity.isIgnoringFallDamageFromCurrentImpulse.

Source

fn current_impulse_impact_pos(&self) -> Option<DVec3>

Returns vanilla LivingEntity.currentImpulseImpactPos.

Source

fn try_reset_current_impulse_context(&self)

Mirrors vanilla LivingEntity.tryResetCurrentImpulseContext.

Source

fn reset_current_impulse_context(&self)

Mirrors vanilla LivingEntity.resetCurrentImpulseContext.

Source

fn is_in_post_impulse_grace_time(&self) -> bool

Returns whether movement validation is inside post-impulse grace.

Source

fn tick_post_impulse_grace_time(&self)

Decrements post-impulse grace once per living-entity tick.

Source

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

Implementors§