pub trait Entity:
EntityEventSource
+ ErasedType
+ Send
+ Sync
+ 'static {
Show 371 methods
// Required methods
fn base(&self) -> &EntityBase;
fn entity_type(&self) -> EntityTypeRef;
// Provided methods
fn is_always_ticking(&self) -> bool { ... }
fn broadcast_to_player(&self, _player: &Player) -> bool { ... }
fn id(&self) -> i32 { ... }
fn generation(&self) -> EntityGeneration { ... }
fn uuid(&self) -> Uuid { ... }
fn scoreboard_name(&self) -> String { ... }
fn name(&self) -> TextComponent { ... }
fn display_name(&self) -> TextComponent { ... }
fn plain_text_name(&self) -> String { ... }
fn nbt_for_data_compare(&self) -> NbtCompound { ... }
fn nbt_for_passenger_save(&self) -> Option<NbtCompound> { ... }
fn position(&self) -> DVec3 { ... }
fn spawn_position(&self) -> DVec3 { ... }
fn block_position(&self) -> BlockPos { ... }
fn in_block_state(&self, world: &World) -> BlockStateId { ... }
fn old_position(&self) -> DVec3 { ... }
fn bounding_box(&self) -> WorldAabb { ... }
fn is_free(&self, delta: DVec3) -> bool { ... }
fn blocks_building(&self) -> bool { ... }
fn is_pickable(&self) -> bool { ... }
fn attackable(&self) -> bool { ... }
fn skip_attack_interaction(&self, _source: &SharedEntity) -> bool { ... }
fn is_pushable(&self) -> bool { ... }
fn is_pushed_by_fluid(&self) -> bool { ... }
fn on_above_bubble_column(&self, drag_down: bool, pos: BlockPos) { ... }
fn default_on_above_bubble_column(&self, drag_down: bool, pos: BlockPos) { ... }
fn on_inside_bubble_column(&self, drag_down: bool) { ... }
fn default_on_inside_bubble_column(&self, drag_down: bool) { ... }
fn is_spectator(&self) -> bool { ... }
fn is_ignoring_block_triggers(&self) -> bool { ... }
fn explosion_indirect_source(&self) -> Option<SharedEntity> { ... }
fn explosion_damage_origin(&self) -> DVec3 { ... }
fn ignore_explosion(&self, _explosion: &dyn Explosion) -> bool { ... }
fn block_explosion_resistance(
&self,
explosion: &dyn Explosion,
world: &World,
pos: BlockPos,
state: BlockStateId,
fluid: FluidState,
resistance: f32,
) -> f32 { ... }
fn should_block_explode(
&self,
explosion: &dyn Explosion,
world: &World,
pos: BlockPos,
state: BlockStateId,
power: f32,
) -> bool { ... }
fn on_explosion_hit(&self, _explosion_source: Option<&dyn Entity>) { ... }
fn piston_push_reaction(&self) -> PushReaction { ... }
fn is_supported_by(&self, pos: BlockPos) -> bool { ... }
fn can_interact_with_level(&self) -> bool { ... }
fn is_invisible(&self) -> bool { ... }
fn is_discrete(&self) -> bool { ... }
fn is_allied_to(&self, _other: &dyn Entity) -> bool { ... }
fn is_marker_armor_stand(&self) -> bool { ... }
fn is_tame_owned_by(&self, _owner: &dyn LivingEntity) -> bool { ... }
fn projectile_owner_uuid(&self) -> Option<Uuid> { ... }
fn projectile_owner(&self) -> Option<SharedEntity> { ... }
fn is_flying_player(&self) -> bool { ... }
fn can_be_collided_with(&self, _other: Option<&dyn Entity>) -> bool { ... }
fn is_hard_collision_relevant(&self) -> bool { ... }
fn can_be_hit_by_projectile(&self) -> bool { ... }
fn deflection(&self, _projectile: &dyn Projectile) -> ProjectileDeflection { ... }
fn vehicle(&self) -> Option<SharedEntity> { ... }
fn controlled_vehicle(&self) -> Option<SharedEntity> { ... }
fn is_passenger(&self) -> bool { ... }
fn can_ride(&self, _vehicle: &dyn Entity) -> bool { ... }
fn stop_riding(&self) { ... }
fn eject_passengers(&self) { ... }
fn start_riding(&self, entity_to_ride: &SharedEntity) -> bool { ... }
fn passengers(&self) -> Vec<SharedEntity> ⓘ { ... }
fn count_player_passengers(&self) -> usize { ... }
fn has_exactly_one_player_passenger(&self) -> bool { ... }
fn first_passenger(&self) -> Option<SharedEntity> { ... }
fn controlling_passenger(&self) -> Option<SharedEntity> { ... }
fn can_control_vehicle(&self) -> bool { ... }
fn has_controlling_passenger(&self) -> bool { ... }
fn is_vehicle(&self) -> bool { ... }
fn dismounts_underwater(&self) -> bool { ... }
fn has_passenger(&self, passenger: &dyn Entity) -> bool { ... }
fn can_add_passenger(&self, _passenger: &dyn Entity) -> bool { ... }
fn could_accept_passenger(&self) -> bool { ... }
fn passenger_index(&self, passenger: &dyn Entity) -> Option<usize> { ... }
fn vehicle_attachment_point(&self, _vehicle: &dyn Entity) -> DVec3 { ... }
fn default_passenger_attachment_point(
&self,
passenger: &dyn Entity,
) -> DVec3 { ... }
fn passenger_attachment_point(&self, passenger: &dyn Entity) -> DVec3 { ... }
fn passenger_riding_position(&self, passenger: &dyn Entity) -> DVec3 { ... }
fn position_rider(&self, passenger: &dyn Entity) { ... }
fn root_vehicle_id(&self) -> i32 { ... }
fn root_vehicle(&self) -> Option<SharedEntity> { ... }
fn is_passenger_of_same_vehicle(&self, other: &dyn Entity) -> bool { ... }
fn has_indirect_passenger(&self, entity: &dyn Entity) -> bool { ... }
fn can_collide_with(&self, other: &dyn Entity) -> bool { ... }
fn as_default_entity_push(&self) -> Option<&dyn DefaultEntityPush> { ... }
fn push_impulse(&self, impulse: DVec3) { ... }
fn push_entity(&self, entity: &dyn Entity) { ... }
fn make_bounding_box_at(&self, position: DVec3) -> WorldAabb { ... }
fn get_relative_portal_position(
&self,
axis: Axis,
portal_area: FoundRectangle,
) -> DVec3 { ... }
fn default_tick(&self) { ... }
fn tick(self: Arc<Self>) { ... }
fn ride_tick(self: Arc<Self>) { ... }
fn default_ride_tick(self: Arc<Self>) { ... }
fn base_tick(&self) { ... }
fn handle_portal(&self) { ... }
fn entity_base_tick(&self) { ... }
fn check_below_world(&self) { ... }
fn on_below_world(&self) { ... }
fn check_despawn(&self) { ... }
fn apply_inside_block_effect(&self, effect_type: InsideBlockEffectType) { ... }
fn level(&self) -> Option<Arc<World>> { ... }
fn pack_dirty_entity_data(&self) -> Option<Vec<DataValue>> { ... }
fn pack_all_entity_data(&self) -> Vec<DataValue> { ... }
fn synced_data(&self) -> Option<&dyn EntitySyncedData> { ... }
fn update_data_before_sync(&self) { ... }
fn is_removed(&self) -> bool { ... }
fn is_alive(&self) -> bool { ... }
fn begin_pending_world_change(&self) -> Option<PendingWorldChangeToken> { ... }
fn finish_pending_world_change(
&self,
token: PendingWorldChangeToken,
) -> bool { ... }
fn is_world_change_pending(&self) -> bool { ... }
fn is_world_change_token_pending(
&self,
token: PendingWorldChangeToken,
) -> bool { ... }
fn can_use_portal(&self, ignore_passenger: bool) -> bool { ... }
fn dimension_changing_delay(&self) -> i32 { ... }
fn removal_reason(&self) -> Option<RemovalReason> { ... }
fn set_removed(&self, reason: RemovalReason) { ... }
fn game_event_with_source_entity(
&self,
event: GameEventRef,
source_entity: Option<&dyn Entity>,
) { ... }
fn game_event(&self, event: GameEventRef) { ... }
fn kill(&self, world: &World) { ... }
fn restore_owner_reference(&self, _owner: &SharedEntity) { ... }
fn on_teleported(&self) { ... }
fn set_level_callback(&self, callback: Arc<dyn EntityLevelCallback>) { ... }
fn notify_leash_holder(&self, _leashable: &dyn Entity) { ... }
fn notify_leashee_removed(&self, _leashable: &dyn Entity) { ... }
fn player_touch(self: Arc<Self>, _player: &Arc<Player>) { ... }
fn leashables_leashed_to(&self) -> Vec<SharedEntity> ⓘ { ... }
fn leashables_leashed_to_holder_in_area(
&self,
holder: &dyn Entity,
) -> Vec<SharedEntity> ⓘ { ... }
fn transfer_leashables_from_holder(&self, old_holder: &dyn Entity) -> bool { ... }
fn drop_all_leash_connections(&self, player: Option<&Player>) -> bool { ... }
fn shear_off_all_leash_connections(&self, player: Option<&Player>) -> bool { ... }
fn attempt_to_shear_equipment(
&self,
player: &Player,
hand: InteractionHand,
) -> bool { ... }
fn interact(
&self,
player: &Player,
hand: InteractionHand,
location: DVec3,
) -> InteractionResult { ... }
fn interact_entity(
&self,
player: &Player,
hand: InteractionHand,
_location: DVec3,
) -> InteractionResult { ... }
fn is_living_entity(&self) -> bool { ... }
fn is_abstract_arrow(&self) -> bool { ... }
fn as_projectile(&self) -> Option<&dyn Projectile> { ... }
fn as_living_entity(&self) -> Option<&dyn LivingEntity> { ... }
fn as_item_frame(&self) -> Option<&dyn ItemFrame> { ... }
fn as_player(&self) -> Option<&Player> { ... }
fn with_weapon_item(&self, visitor: &mut dyn FnMut(Option<&ItemStack>)) { ... }
fn is_pathfinder_mob(&self) -> bool { ... }
fn as_pathfinder_mob(&self) -> Option<&dyn PathfinderMob> { ... }
fn is_mob(&self) -> bool { ... }
fn as_mob(&self) -> Option<&dyn Mob> { ... }
fn as_leashable(&self) -> Option<&dyn Leashable> { ... }
fn as_abstract_minecart(&self) -> Option<&dyn AbstractMinecart> { ... }
fn is_animal(&self) -> bool { ... }
fn as_animal(&self) -> Option<&dyn Animal> { ... }
fn is_monster(&self) -> bool { ... }
fn as_monster(&self) -> Option<&dyn Monster> { ... }
fn is_enemy(&self) -> bool { ... }
fn as_enemy(&self) -> Option<&dyn Enemy> { ... }
fn is_ageable_mob(&self) -> bool { ... }
fn as_ageable_mob(&self) -> Option<&dyn AgeableMob> { ... }
fn is_item_steerable(&self) -> bool { ... }
fn as_item_steerable(&self) -> Option<&dyn ItemSteerable> { ... }
fn forces_fall_flying_velocity_sync(&self) -> bool { ... }
fn uses_client_movement_packets(&self) -> bool { ... }
fn is_server_driven_movement(&self) -> bool { ... }
fn can_simulate_movement(&self) -> bool { ... }
fn is_effective_ai(&self) -> bool { ... }
fn is_suppressing_bounce(&self) -> bool { ... }
fn is_stepping_carefully(&self) -> bool { ... }
fn is_descending(&self) -> bool { ... }
fn set_shared_shift_key_down(&self, shift_key_down: bool) { ... }
fn set_shared_swimming(&self, swimming: bool) { ... }
fn update_swimming(&self) { ... }
fn default_update_swimming(&self) { ... }
fn set_shared_sprinting(&self, sprinting: bool) { ... }
fn set_shared_fall_flying(&self, fall_flying: bool) { ... }
fn is_flying_vehicle(&self) -> bool { ... }
fn on_climbable(&self) -> bool { ... }
fn default_known_movement(&self) -> DVec3 { ... }
fn known_movement(&self) -> DVec3 { ... }
fn known_speed(&self) -> DVec3 { ... }
fn tick_count(&self) -> i32 { ... }
fn is_first_tick(&self) -> bool { ... }
fn set_first_tick(&self, first_tick: bool) { ... }
fn advance_tick_count(&self) { ... }
fn fall_sounds(&self) -> (SoundEventRef, SoundEventRef) { ... }
fn rotation(&self) -> (f32, f32) { ... }
fn set_rotation(&self, rotation: (f32, f32)) { ... }
fn direction_yaw(&self) -> Direction { ... }
fn motion_direction(&self) -> Direction { ... }
fn look_at(&self, from_anchor: EntityAnchor, target: DVec3) { ... }
fn look_at_entity(
&self,
from_anchor: EntityAnchor,
target: &dyn Entity,
target_anchor: EntityAnchor,
) { ... }
fn head_yaw(&self) -> f32 { ... }
fn spawn_data(&self) -> i32 { ... }
fn get_eye_height(&self) -> f64 { ... }
fn get_fluid_jump_threshold(&self) -> f64 { ... }
fn get_eye_y(&self) -> f64 { ... }
fn is_in_wall(&self) -> bool { ... }
fn calculate_view_vector(
&self,
pitch_degrees: f32,
yaw_degrees: f32,
) -> DVec3 { ... }
fn look_angle(&self) -> DVec3 { ... }
fn hand_holding_item_angle(&self, item: ItemRef) -> DVec3 { ... }
fn velocity(&self) -> DVec3 { ... }
fn set_velocity(&self, velocity: DVec3) { ... }
fn needs_velocity_sync(&self) -> bool { ... }
fn mark_velocity_sync(&self) { ... }
fn clear_velocity_sync(&self) { ... }
fn hurt_marked(&self) -> bool { ... }
fn mark_hurt(&self) { ... }
fn clear_hurt_mark(&self) { ... }
fn fall_distance(&self) -> f64 { ... }
fn is_in_powder_snow(&self) -> bool { ... }
fn was_in_powder_snow(&self) -> bool { ... }
fn set_fall_distance(&self, fall_distance: f64) { ... }
fn reset_fall_distance(&self) { ... }
fn check_fall_distance_accumulation(&self) { ... }
fn fire_freeze_state(&self) -> EntityFireFreezeState { ... }
fn remaining_fire_ticks(&self) -> i32 { ... }
fn set_remaining_fire_ticks(&self, remaining_fire_ticks: i32) { ... }
fn ticks_frozen(&self) -> i32 { ... }
fn set_ticks_frozen(&self, ticks_frozen: i32) { ... }
fn fire_immune(&self) -> bool { ... }
fn fire_immune_ticks(&self) -> i32 { ... }
fn should_play_lava_hurt_sound(&self) -> bool { ... }
fn lava_ignite(&self) { ... }
fn lava_hurt(&self) { ... }
fn remaining_fire_ticks_cap(&self) -> Option<i32> { ... }
fn fire_ignite_extra_ticks(&self) -> i32 { ... }
fn is_on_fire(&self) -> bool { ... }
fn has_visual_fire(&self) -> bool { ... }
fn is_freezing(&self) -> bool { ... }
fn default_can_freeze(&self) -> bool { ... }
fn can_freeze(&self) -> bool { ... }
fn ticks_required_to_freeze(&self) -> i32 { ... }
fn is_fully_frozen(&self) -> bool { ... }
fn percent_frozen(&self) -> f32 { ... }
fn clear_freeze(&self) { ... }
fn clear_fire(&self) { ... }
fn extinguish_fire(&self) { ... }
fn ignite_for_ticks(&self, number_of_ticks: i32) { ... }
fn sync_base_fire_freeze_entity_data(&self) { ... }
fn sync_base_entity_data(&self) { ... }
fn is_in_water(&self) -> bool { ... }
fn is_in_rain(&self) -> bool { ... }
fn is_in_water_or_rain(&self) -> bool { ... }
fn is_in_lava(&self) -> bool { ... }
fn is_eye_in_water(&self) -> bool { ... }
fn is_eye_in_lava(&self) -> bool { ... }
fn is_under_water(&self) -> bool { ... }
fn fluid_contact(&self) -> EntityFluidContact { ... }
fn refresh_fluid_contact(&self) -> EntityFluidContact { ... }
fn update_fluid_interaction(&self) -> bool { ... }
fn scan_and_store_fluid_contact(
&self,
advance_eye_water_history: bool,
) -> EntityFluidContact { ... }
fn apply_fluid_current_impulses(
&self,
world: &Arc<World>,
contact: EntityFluidContact,
) { ... }
fn apply_fluid_current_impulse(&self, impulse: DVec3) { ... }
fn is_fall_damage_immune(&self) -> bool { ... }
fn propagate_fall_to_passengers(
&self,
fall_distance: f64,
damage_modifier: f32,
source: &DamageSource,
) { ... }
fn cause_fall_damage(
self: Arc<Self>,
fall_distance: f64,
damage_modifier: f32,
source: &DamageSource,
) -> bool { ... }
fn on_ground(&self) -> bool { ... }
fn horizontal_collision(&self) -> bool { ... }
fn vertical_collision(&self) -> bool { ... }
fn vertical_collision_below(&self) -> bool { ... }
fn no_physics(&self) -> bool { ... }
fn is_affected_by_blocks(&self) -> bool { ... }
fn set_no_physics(&self, no_physics: bool) { ... }
fn update_no_physics_from_current_collision(&self) { ... }
fn move_towards_closest_space(&self, x: f64, y: f64, z: f64) { ... }
fn default_make_stuck_in_block(
&self,
_state: BlockStateId,
speed_multiplier: DVec3,
) { ... }
fn make_stuck_in_block(&self, state: BlockStateId, speed_multiplier: DVec3) { ... }
fn apply_effects_from_blocks(&self) { ... }
fn apply_effects_from_blocks_between(&self, from: DVec3, to: DVec3) { ... }
fn apply_effects_from_blocks_for_last_movements(&self) { ... }
fn land_after_teleport(&self) { ... }
fn set_on_ground(&self, on_ground: bool) { ... }
fn set_on_ground_with_movement(
&self,
on_ground: bool,
horizontal_collision: bool,
movement: DVec3,
) { ... }
fn default_apply_accepted_client_movement(
self: Arc<Self>,
world: &Arc<World>,
accepted: AcceptedClientMovement,
) -> Result<AcceptedClientMovementOutcome, EntityMoveError> { ... }
fn apply_accepted_client_movement(
self: Arc<Self>,
world: &Arc<World>,
accepted: AcceptedClientMovement,
) -> Result<AcceptedClientMovementOutcome, EntityMoveError> { ... }
fn apply_accepted_client_vehicle_movement(
self: Arc<Self>,
world: &Arc<World>,
accepted: AcceptedClientMovement,
) -> Result<AcceptedClientMovementOutcome, EntityMoveError> { ... }
fn try_set_position(&self, pos: DVec3) -> Result<(), EntityMoveError> { ... }
fn try_set_position_base(&self, pos: DVec3) -> Result<(), EntityMoveError> { ... }
fn teleport_to(&self, pos: DVec3) -> Result<(), EntityMoveError> { ... }
fn set_old_position_to_current(&self) { ... }
fn set_old_position(&self, old_position: DVec3) { ... }
fn remove_latest_movement_recording(&self) { ... }
fn on_pos(&self, offset: f32) -> Option<BlockPos> { ... }
fn block_pos_below_that_affects_movement(&self) -> Option<BlockPos> { ... }
fn on_pos_legacy(&self) -> Option<BlockPos> { ... }
fn default_block_speed_factor(&self) -> f32 { ... }
fn block_speed_factor(&self) -> f32 { ... }
fn block_jump_factor(&self) -> f32 { ... }
fn pose(&self) -> EntityPose { ... }
fn dimensions_for_pose(&self, _pose: EntityPose) -> EntityDimensions { ... }
fn refresh_dimensions(&self) { ... }
fn fudge_position_after_size_change(
&self,
previous_dimensions: EntityDimensions,
) -> bool { ... }
fn set_pose(&self, pose: EntityPose) { ... }
fn is_crouching(&self) -> bool { ... }
fn is_swimming(&self) -> bool { ... }
fn is_on_rails(&self) -> bool { ... }
fn is_state_climbable(&self, state: BlockStateId) -> bool { ... }
fn movement_emission(&self) -> EntityMovementEmission { ... }
fn may_interact(&self, _world: &World, _pos: BlockPos) -> bool { ... }
fn air_supply(&self) -> i32 { ... }
fn set_air_supply(&self, air_supply: i32) { ... }
fn max_air_supply(&self) -> i32 { ... }
fn portal_cooldown(&self) -> i32 { ... }
fn set_portal_cooldown(&self, portal_cooldown: i32) { ... }
fn is_on_portal_cooldown(&self) -> bool { ... }
fn reset_portal_cooldown(&self) { ... }
fn set_as_inside_portal(&self, portal: PortalKind, entry_position: BlockPos) { ... }
fn custom_name(&self) -> Option<TextComponent> { ... }
fn set_custom_name(&self, custom_name: Option<TextComponent>) { ... }
fn is_custom_name_visible(&self) -> bool { ... }
fn set_custom_name_visible(&self, visible: bool) { ... }
fn has_glowing_tag(&self) -> bool { ... }
fn set_glowing_tag(&self, glowing: bool) { ... }
fn tags(&self) -> Vec<String> { ... }
fn add_tag(&self, tag: String) -> bool { ... }
fn remove_tag(&self, tag: &str) -> bool { ... }
fn custom_data(&self) -> NbtCompound { ... }
fn set_custom_data(&self, custom_data: NbtCompound) { ... }
fn sound_source(&self) -> SoundSource { ... }
fn swim_sound(&self) -> SoundEventRef { ... }
fn is_silent(&self) -> bool { ... }
fn set_silent(&self, silent: bool) { ... }
fn broadcast_entity_event(&self, event: EntityStatus) { ... }
fn play_sound(&self, sound: SoundEventRef, volume: f32, pitch: f32) { ... }
fn swim_splash_sound(&self) -> SoundEventRef { ... }
fn swim_high_speed_splash_sound(&self) -> SoundEventRef { ... }
fn do_water_splash_effect(&self) { ... }
fn default_do_water_splash_effect(&self) { ... }
fn play_entity_on_fire_extinguished_sound(&self) { ... }
fn play_step_sound(&self, _pos: BlockPos, block_state: BlockStateId) { ... }
fn play_block_step_sound(&self, block_state: BlockStateId) { ... }
fn play_muffled_step_sound(&self, block_state: BlockStateId) { ... }
fn play_combination_step_sounds(
&self,
primary_step_sound: BlockStateId,
secondary_step_sound: BlockStateId,
) { ... }
fn walking_step_sound(&self, pos: BlockPos, block_state: BlockStateId) { ... }
fn play_amethyst_step_sound(&self) { ... }
fn water_swim_sound(&self) { ... }
fn play_swim_sound(&self, volume: f32) { ... }
fn is_flapping(&self) -> bool { ... }
fn on_flap(&self) { ... }
fn process_flapping_movement(&self) { ... }
fn next_step(&self) -> f32 { ... }
fn apply_movement_emission_and_play_sound(
&self,
emission: EntityMovementEmission,
clipped_movement: DVec3,
effect_pos: BlockPos,
effect_state: BlockStateId,
) { ... }
fn apply_movement_side_effects_after_move(
&self,
world: &World,
actual_movement: DVec3,
) { ... }
fn vibration_and_sound_effects_from_block(
&self,
pos: BlockPos,
block_state: BlockStateId,
should_sound: bool,
should_vibrate: bool,
clipped_movement: DVec3,
) -> bool { ... }
fn max_up_step(&self) -> f32 { ... }
fn backs_off_from_edge(&self) -> bool { ... }
fn get_default_gravity(&self) -> f64 { ... }
fn is_no_gravity(&self) -> bool { ... }
fn set_no_gravity(&self, no_gravity: bool) { ... }
fn is_invulnerable(&self) -> bool { ... }
fn set_invulnerable(&self, invulnerable: bool) { ... }
fn get_gravity(&self) -> f64 { ... }
fn get_air_drag(&self) -> f64 { ... }
fn apply_gravity(&self) { ... }
fn move_relative(&self, speed: f32, input: DVec3) { ... }
fn move_without_physics(&self, delta: DVec3) -> Option<MoveResult> { ... }
fn default_move_entity(
self: Arc<Self>,
mover_type: MoverType,
delta: DVec3,
) -> Option<MoveResult> { ... }
fn move_entity(
self: Arc<Self>,
mover_type: MoverType,
delta: DVec3,
) -> Option<MoveResult> { ... }
fn apply_fall_damage_after_move(
self: Arc<Self>,
result: &MoveResult,
world: &Arc<World>,
) -> bool { ... }
fn reset_fall_distance_on_resetting_clip(
&self,
world: &Arc<World>,
movement: DVec3,
) { ... }
fn do_check_fall_damage(
self: Arc<Self>,
movement: DVec3,
on_ground: bool,
world: &Arc<World>,
) -> bool { ... }
fn refresh_supporting_block_for_fall_damage(
&self,
movement: DVec3,
on_ground: bool,
) { ... }
fn send_landing_particles(
&self,
world: &World,
on_state: BlockStateId,
pos: BlockPos,
) { ... }
fn check_fall_damage(
self: Arc<Self>,
vertical_movement: f64,
on_ground: bool,
on_state: BlockStateId,
pos: BlockPos,
world: &Arc<World>,
) { ... }
fn ground_contact_after_movement(
&self,
on_ground: bool,
movement: Option<DVec3>,
) -> EntityGroundContact { ... }
fn check_supporting_block(
&self,
on_ground: bool,
movement: Option<DVec3>,
world: &Arc<World>,
) -> EntityGroundContact { ... }
fn spawn_at_location(
&self,
item: ItemStack,
y_offset: f64,
) -> Option<Arc<ItemEntity>> { ... }
fn spawn_at_location_with_offset(
&self,
item: ItemStack,
offset: DVec3,
) -> Option<Arc<ItemEntity>> { ... }
fn save_additional(&self, _nbt: &mut NbtCompound) { ... }
fn load_additional(&self, _nbt: BorrowedNbtCompoundView<'_, '_>) { ... }
fn apply_implicit_item_components(&self, _item_stack: &ItemStack) { ... }
fn apply_spawn_data(&self, nbt: BorrowedNbtCompoundView<'_, '_>) { ... }
fn is_invulnerable_to_base(&self, source: &DamageSource) -> bool { ... }
fn hurt(&self, world: &World, source: &DamageSource, amount: f32) -> bool { ... }
fn distance_to_sqr(&self, pos: DVec3) -> f64 { ... }
fn snap_to(&self, position: DVec3, yaw: f32, pitch: f32) { ... }
fn killed_entity(
&self,
_world: &World,
_entity: &dyn LivingEntity,
_source: &DamageSource,
) -> bool { ... }
fn award_kill_score(
&self,
_victim: &dyn Entity,
_killing_blow: &DamageSource,
) { ... }
}Expand description
A trait for entities.
This trait provides the core functionality for entities.
It’s based on Minecraft’s Entity class.
Concrete implementations must also claim a unique steel_utils::DowncastTypeKey
through steel_utils::DowncastType.
§Using EntityBase
Entities expose EntityBase to get default implementations for common
methods like id(), uuid(), position(), etc.
impl Entity for MyEntity {
fn base(&self) -> &EntityBase { &self.base }
fn entity_type(&self) -> EntityTypeRef { vanilla_entities::MY_ENTITY }
fn bounding_box(&self) -> WorldAabb { /* ... */ }
// All other common methods use defaults from EntityBase!
}Required Methods§
Sourcefn base(&self) -> &EntityBase
fn base(&self) -> &EntityBase
Returns a reference to the entity’s shared vanilla base fields.
Sourcefn entity_type(&self) -> EntityTypeRef
fn entity_type(&self) -> EntityTypeRef
Gets the entity type containing tracking range, dimensions, etc.
Provided Methods§
Sourcefn is_always_ticking(&self) -> bool
fn is_always_ticking(&self) -> bool
Returns whether this entity ignores chunk ticking visibility.
Sourcefn broadcast_to_player(&self, _player: &Player) -> bool
fn broadcast_to_player(&self, _player: &Player) -> bool
Returns whether this entity should be broadcast to the given player.
Mirrors vanilla Entity.broadcastToPlayer. Most entities are always
broadcastable; players override this for spectator visibility rules.
Sourcefn generation(&self) -> EntityGeneration
fn generation(&self) -> EntityGeneration
Gets the generation counter of this runtime construction of the entity.
Sourcefn scoreboard_name(&self) -> String
fn scoreboard_name(&self) -> String
Returns this entity’s vanilla scoreboard holder name.
Non-player entities use their UUID string. Players override this with their game profile name.
Sourcefn name(&self) -> TextComponent
fn name(&self) -> TextComponent
Returns this entity’s vanilla name component before team decoration.
Sourcefn display_name(&self) -> TextComponent
fn display_name(&self) -> TextComponent
Returns this entity’s vanilla display name.
Sourcefn plain_text_name(&self) -> String
fn plain_text_name(&self) -> String
Returns this entity’s plain vanilla name.
Custom names are resolved as text components; otherwise entities use their translated type description. Players override this with their game profile name.
Sourcefn nbt_for_data_compare(&self) -> NbtCompound
fn nbt_for_data_compare(&self) -> NbtCompound
Returns the vanilla-shaped entity NBT used by command predicates.
Mirrors NbtPredicate.getEntityTagToCompare: base and type-specific
Entity.saveWithoutId data, passengers, and a player’s selected item.
Sourcefn nbt_for_passenger_save(&self) -> Option<NbtCompound>
fn nbt_for_passenger_save(&self) -> Option<NbtCompound>
Returns passenger-save NBT including the entity type id.
Sourcefn spawn_position(&self) -> DVec3
fn spawn_position(&self) -> DVec3
Gets the position to send in this entity’s add-entity packet.
Mirrors vanilla Entity.getAddEntityPacket() overloads. Most entities
spawn at their current position; block-attached entities can override
this with the backing block position used by the vanilla packet.
Sourcefn block_position(&self) -> BlockPos
fn block_position(&self) -> BlockPos
Gets the entity’s current block position.
Sourcefn in_block_state(&self, world: &World) -> BlockStateId
fn in_block_state(&self, world: &World) -> BlockStateId
Returns the block state this entity’s origin currently overlaps.
Sourcefn old_position(&self) -> DVec3
fn old_position(&self) -> DVec3
Gets the entity position used by vanilla movement traces.
Sourcefn bounding_box(&self) -> WorldAabb
fn bounding_box(&self) -> WorldAabb
Gets the entity’s bounding box for collision queries.
Sourcefn is_free(&self, delta: DVec3) -> bool
fn is_free(&self, delta: DVec3) -> bool
Returns whether the bounding box shifted by delta is free of block
collisions and liquids.
Sourcefn blocks_building(&self) -> bool
fn blocks_building(&self) -> bool
Returns whether this entity obstructs block placement.
Base entities do not obstruct placement unless a concrete entity type opts in.
Sourcefn is_pickable(&self) -> bool
fn is_pickable(&self) -> bool
Returns whether this entity can be targeted by picking and interaction raycasts.
Base entities are not pickable unless a concrete entity type opts in.
Sourcefn attackable(&self) -> bool
fn attackable(&self) -> bool
Returns whether this entity can be attacked.
Concrete entities that override vanilla to reject player attacks should override this method.
Sourcefn skip_attack_interaction(&self, _source: &SharedEntity) -> bool
fn skip_attack_interaction(&self, _source: &SharedEntity) -> bool
Returns whether this entity handles and consumes an attack before normal damage.
Sourcefn is_pushable(&self) -> bool
fn is_pushable(&self) -> bool
Returns whether this entity participates in vanilla push separation.
Base entities are not pushable unless a concrete entity type opts in.
Sourcefn is_pushed_by_fluid(&self) -> bool
fn is_pushed_by_fluid(&self) -> bool
Returns whether vanilla fluid currents can push this entity.
The extractor flattens vanilla’s per-subclass overrides into one flag.
Entities with extra conditions still override, as Player does.
Sourcefn on_above_bubble_column(&self, drag_down: bool, pos: BlockPos)
fn on_above_bubble_column(&self, drag_down: bool, pos: BlockPos)
Applies bubble-column surface push velocity, dispatching to the projectile override when this entity is a projectile.
Sourcefn default_on_above_bubble_column(&self, drag_down: bool, pos: BlockPos)
fn default_on_above_bubble_column(&self, drag_down: bool, pos: BlockPos)
Applies the base entity’s clamped bubble-column surface movement.
Sourcefn on_inside_bubble_column(&self, drag_down: bool)
fn on_inside_bubble_column(&self, drag_down: bool)
Applies bubble-column push velocity while submerged in the column, dispatching to the projectile override when this entity is a projectile.
Sourcefn default_on_inside_bubble_column(&self, drag_down: bool)
fn default_on_inside_bubble_column(&self, drag_down: bool)
Applies the base entity’s clamped movement inside a bubble-column.
Sourcefn is_spectator(&self) -> bool
fn is_spectator(&self) -> bool
Returns whether this entity is invisible to normal entity selectors.
Base entities are never spectators; players override this from their game mode.
Sourcefn is_ignoring_block_triggers(&self) -> bool
fn is_ignoring_block_triggers(&self) -> bool
Returns whether this entity is excluded from pressure plates and tripwires.
Display-like entities and marker entities override this capability.
Sourcefn explosion_indirect_source(&self) -> Option<SharedEntity>
fn explosion_indirect_source(&self) -> Option<SharedEntity>
Returns the living entity credited as this explosion’s indirect source.
Sourcefn explosion_damage_origin(&self) -> DVec3
fn explosion_damage_origin(&self) -> DVec3
Returns the point used to calculate this entity’s explosion direction.
Sourcefn ignore_explosion(&self, _explosion: &dyn Explosion) -> bool
fn ignore_explosion(&self, _explosion: &dyn Explosion) -> bool
Returns whether this entity is wholly ignored by an explosion.
Sourcefn block_explosion_resistance(
&self,
explosion: &dyn Explosion,
world: &World,
pos: BlockPos,
state: BlockStateId,
fluid: FluidState,
resistance: f32,
) -> f32
fn block_explosion_resistance( &self, explosion: &dyn Explosion, world: &World, pos: BlockPos, state: BlockStateId, fluid: FluidState, resistance: f32, ) -> f32
Lets an entity source modify effective block or fluid resistance.
Sourcefn should_block_explode(
&self,
explosion: &dyn Explosion,
world: &World,
pos: BlockPos,
state: BlockStateId,
power: f32,
) -> bool
fn should_block_explode( &self, explosion: &dyn Explosion, world: &World, pos: BlockPos, state: BlockStateId, power: f32, ) -> bool
Lets an entity source veto one affected block position.
Sourcefn on_explosion_hit(&self, _explosion_source: Option<&dyn Entity>)
fn on_explosion_hit(&self, _explosion_source: Option<&dyn Entity>)
Called after this entity is processed by an explosion.
Sourcefn piston_push_reaction(&self) -> PushReaction
fn piston_push_reaction(&self) -> PushReaction
Returns how vanilla lets this entity respond to piston movement.
Sourcefn is_supported_by(&self, pos: BlockPos) -> bool
fn is_supported_by(&self, pos: BlockPos) -> bool
Returns whether this entity’s main supporting block is pos.
Sourcefn can_interact_with_level(&self) -> bool
fn can_interact_with_level(&self) -> bool
Returns whether vanilla lets this entity interact with its loaded level.
Sourcefn is_invisible(&self) -> bool
fn is_invisible(&self) -> bool
Returns whether this entity is invisible, per its synced entity data.
Sourcefn is_discrete(&self) -> bool
fn is_discrete(&self) -> bool
Returns whether this entity is sneaking (shift key down), per its synced entity data.
Sourcefn is_allied_to(&self, _other: &dyn Entity) -> bool
fn is_allied_to(&self, _other: &dyn Entity) -> bool
Returns whether this entity is allied to other.
Sourcefn is_marker_armor_stand(&self) -> bool
fn is_marker_armor_stand(&self) -> bool
Returns whether this entity is a marker armor stand.
Sourcefn is_tame_owned_by(&self, _owner: &dyn LivingEntity) -> bool
fn is_tame_owned_by(&self, _owner: &dyn LivingEntity) -> bool
Returns whether this entity is a tameable animal owned by owner.
Sourcefn projectile_owner_uuid(&self) -> Option<Uuid>
fn projectile_owner_uuid(&self) -> Option<Uuid>
Returns the vanilla Projectile owner UUID when this entity exposes one.
Sourcefn projectile_owner(&self) -> Option<SharedEntity>
fn projectile_owner(&self) -> Option<SharedEntity>
Returns the live vanilla Projectile owner when this entity exposes one.
Sourcefn is_flying_player(&self) -> bool
fn is_flying_player(&self) -> bool
Returns true for vanilla players whose abilities have flying set.
Sourcefn can_be_collided_with(&self, _other: Option<&dyn Entity>) -> bool
fn can_be_collided_with(&self, _other: Option<&dyn Entity>) -> bool
Returns whether other can collide with this entity.
Base entities cannot be collided with unless a concrete entity type opts in.
Sourcefn is_hard_collision_relevant(&self) -> bool
fn is_hard_collision_relevant(&self) -> bool
Whether movement queries must consider this entity for hard collisions.
Returning false promises Self::can_be_collided_with is always false and
Self::can_collide_with never broadens the default rule. This capability may be
cached for the registered lifetime, including chunk-unload retention.
Sourcefn can_be_hit_by_projectile(&self) -> bool
fn can_be_hit_by_projectile(&self) -> bool
Returns whether projectile collision may interact with this entity.
Sourcefn deflection(&self, _projectile: &dyn Projectile) -> ProjectileDeflection
fn deflection(&self, _projectile: &dyn Projectile) -> ProjectileDeflection
Returns this entity’s Vanilla projectile deflection behavior.
Sourcefn vehicle(&self) -> Option<SharedEntity>
fn vehicle(&self) -> Option<SharedEntity>
Gets the vehicle this entity is riding, if present.
Sourcefn controlled_vehicle(&self) -> Option<SharedEntity>
fn controlled_vehicle(&self) -> Option<SharedEntity>
Returns the vehicle this entity directly controls, if any.
Sourcefn is_passenger(&self) -> bool
fn is_passenger(&self) -> bool
Returns whether this entity is riding another entity.
Sourcefn can_ride(&self, _vehicle: &dyn Entity) -> bool
fn can_ride(&self, _vehicle: &dyn Entity) -> bool
Returns whether vanilla allows this entity to start riding vehicle.
Sourcefn stop_riding(&self)
fn stop_riding(&self)
Stops riding the current vehicle, if any.
Sourcefn eject_passengers(&self)
fn eject_passengers(&self)
Dismounts every passenger from this entity.
Sourcefn start_riding(&self, entity_to_ride: &SharedEntity) -> bool
fn start_riding(&self, entity_to_ride: &SharedEntity) -> bool
Starts riding entity_to_ride if vanilla boarding rules allow it.
Sourcefn passengers(&self) -> Vec<SharedEntity> ⓘ
fn passengers(&self) -> Vec<SharedEntity> ⓘ
Gets this entity’s direct passengers.
Sourcefn count_player_passengers(&self) -> usize
fn count_player_passengers(&self) -> usize
Counts indirect player passengers.
Sourcefn has_exactly_one_player_passenger(&self) -> bool
fn has_exactly_one_player_passenger(&self) -> bool
Returns whether this entity has exactly one indirect player passenger.
Sourcefn first_passenger(&self) -> Option<SharedEntity>
fn first_passenger(&self) -> Option<SharedEntity>
Gets this entity’s first direct passenger.
Sourcefn controlling_passenger(&self) -> Option<SharedEntity>
fn controlling_passenger(&self) -> Option<SharedEntity>
Returns the living passenger currently controlling this entity, if any.
Base entities have no controller; controllable vehicles override this based on their own rules.
Sourcefn can_control_vehicle(&self) -> bool
fn can_control_vehicle(&self) -> bool
Returns whether this entity can control a vehicle it is riding.
Sourcefn has_controlling_passenger(&self) -> bool
fn has_controlling_passenger(&self) -> bool
Returns whether this entity currently has a controlling passenger.
Sourcefn is_vehicle(&self) -> bool
fn is_vehicle(&self) -> bool
Returns whether this entity has any direct passengers.
Sourcefn dismounts_underwater(&self) -> bool
fn dismounts_underwater(&self) -> bool
Returns whether this entity’s passengers are forced to dismount when
it goes underwater, per the dismounts_underwater entity type tag.
Sourcefn has_passenger(&self, passenger: &dyn Entity) -> bool
fn has_passenger(&self, passenger: &dyn Entity) -> bool
Returns whether passenger is a direct passenger of this entity.
Sourcefn can_add_passenger(&self, _passenger: &dyn Entity) -> bool
fn can_add_passenger(&self, _passenger: &dyn Entity) -> bool
Returns whether this entity can accept passenger as a direct passenger.
Sourcefn could_accept_passenger(&self) -> bool
fn could_accept_passenger(&self) -> bool
Returns whether this entity can accept any passenger.
Sourcefn passenger_index(&self, passenger: &dyn Entity) -> Option<usize>
fn passenger_index(&self, passenger: &dyn Entity) -> Option<usize>
Returns the current direct passenger index for attachment lookup.
Sourcefn vehicle_attachment_point(&self, _vehicle: &dyn Entity) -> DVec3
fn vehicle_attachment_point(&self, _vehicle: &dyn Entity) -> DVec3
Returns this passenger’s vehicle attachment point.
Sourcefn default_passenger_attachment_point(&self, passenger: &dyn Entity) -> DVec3
fn default_passenger_attachment_point(&self, passenger: &dyn Entity) -> DVec3
Returns this vehicle’s passenger attachment point for this entity’s dimensions and seat index, rotated by the vehicle’s yaw.
Sourcefn passenger_attachment_point(&self, passenger: &dyn Entity) -> DVec3
fn passenger_attachment_point(&self, passenger: &dyn Entity) -> DVec3
Returns the vehicle-relative position where this passenger attaches to.
Sourcefn passenger_riding_position(&self, passenger: &dyn Entity) -> DVec3
fn passenger_riding_position(&self, passenger: &dyn Entity) -> DVec3
Returns the world position where passenger should ride this vehicle.
Sourcefn position_rider(&self, passenger: &dyn Entity)
fn position_rider(&self, passenger: &dyn Entity)
Repositions a direct passenger from this vehicle’s attachment point.
Sourcefn root_vehicle_id(&self) -> i32
fn root_vehicle_id(&self) -> i32
Returns this entity’s root vehicle ID, or this entity’s ID when it is not riding.
Mirrors vanilla Entity.getRootVehicle using session IDs for object identity.
Sourcefn root_vehicle(&self) -> Option<SharedEntity>
fn root_vehicle(&self) -> Option<SharedEntity>
Returns this entity’s root vehicle, if this entity is riding one.
Sourcefn is_passenger_of_same_vehicle(&self, other: &dyn Entity) -> bool
fn is_passenger_of_same_vehicle(&self, other: &dyn Entity) -> bool
Returns whether this entity and other share the same root vehicle.
Sourcefn has_indirect_passenger(&self, entity: &dyn Entity) -> bool
fn has_indirect_passenger(&self, entity: &dyn Entity) -> bool
Returns whether entity is an indirect passenger of this entity.
Sourcefn can_collide_with(&self, other: &dyn Entity) -> bool
fn can_collide_with(&self, other: &dyn Entity) -> bool
Returns whether this entity can collide with other.
Sourcefn as_default_entity_push(&self) -> Option<&dyn DefaultEntityPush>
fn as_default_entity_push(&self) -> Option<&dyn DefaultEntityPush>
Opts this entity into the DefaultEntityPush fast path. It is read under the
entity manager lock, so it must give the same answer for the entity’s whole
lifetime and have no side effects.
Sourcefn push_impulse(&self, impulse: DVec3)
fn push_impulse(&self, impulse: DVec3)
Adds an impulse to this entity’s velocity and marks velocity for sync.
Sourcefn push_entity(&self, entity: &dyn Entity)
fn push_entity(&self, entity: &dyn Entity)
Applies vanilla entity-to-entity push separation.
Sourcefn make_bounding_box_at(&self, position: DVec3) -> WorldAabb
fn make_bounding_box_at(&self, position: DVec3) -> WorldAabb
Builds this entity’s default bounding box at position.
Sourcefn get_relative_portal_position(
&self,
axis: Axis,
portal_area: FoundRectangle,
) -> DVec3
fn get_relative_portal_position( &self, axis: Axis, portal_area: FoundRectangle, ) -> DVec3
Returns this entity’s position relative to the portal, in portal-local space; living entities have their forward-axis offset reset to zero.
Sourcefn default_tick(&self)
fn default_tick(&self)
Concrete entity ticks that mirror vanilla super.tick() should call this
rather than calling Self::base_tick directly.
Sourcefn tick(self: Arc<Self>)
fn tick(self: Arc<Self>)
Called every game tick when the entity is in a ticked chunk.
Use self.level() to access the world for physics, block queries, etc.
The caller handles post-tick dirty data sync.
The default dispatches vanilla living behavior without requiring every
living implementation to repeat an Entity::tick forwarding method.
Non-living entities with custom tick behavior override this directly.
Sourcefn ride_tick(self: Arc<Self>)
fn ride_tick(self: Arc<Self>)
Called every game tick while this entity is riding another entity.
Sourcefn default_ride_tick(self: Arc<Self>)
fn default_ride_tick(self: Arc<Self>)
The default implementation of Entity.rideTick when not overridden.
Sourcefn base_tick(&self)
fn base_tick(&self)
Runs vanilla Entity.baseTick pieces Steel currently implements.
This intentionally stays separate from tick() because several vanilla
subclasses override tick without calling super.tick().
Sourcefn handle_portal(&self)
fn handle_portal(&self)
Runs vanilla Entity.handlePortal behavior currently implemented by Steel.
Sourcefn entity_base_tick(&self)
fn entity_base_tick(&self)
Runs only vanilla Entity.baseTick behavior.
Subtype base-tick chains call this from their owner trait.
Sourcefn check_below_world(&self)
fn check_below_world(&self)
Applies vanilla below-world handling.
Sourcefn on_below_world(&self)
fn on_below_world(&self)
Runs entity-specific behavior after falling below the world.
Sourcefn check_despawn(&self)
fn check_despawn(&self)
Runs vanilla pre-tick despawn checks.
Sourcefn apply_inside_block_effect(&self, effect_type: InsideBlockEffectType)
fn apply_inside_block_effect(&self, effect_type: InsideBlockEffectType)
Applies an inside-block effect queued by vanilla’s step-based collector.
Sourcefn level(&self) -> Option<Arc<World>>
fn level(&self) -> Option<Arc<World>>
Gets the world this entity is in.
Returns None if the entity is not in a world or the world was dropped.
Sourcefn pack_dirty_entity_data(&self) -> Option<Vec<DataValue>>
fn pack_dirty_entity_data(&self) -> Option<Vec<DataValue>>
Packs dirty entity data for network synchronization.
Returns Some(values) if there are dirty values to sync, None otherwise.
Clears the dirty flags after packing.
Sourcefn pack_all_entity_data(&self) -> Vec<DataValue>
fn pack_all_entity_data(&self) -> Vec<DataValue>
Packs all non-default entity data for initial spawn.
Used when sending entity data to a player who just started tracking this entity.
Sourcefn synced_data(&self) -> Option<&dyn EntitySyncedData>
fn synced_data(&self) -> Option<&dyn EntitySyncedData>
Returns the synchronized entity-data container for entities with vanilla data accessors.
Sourcefn update_data_before_sync(&self)
fn update_data_before_sync(&self)
Updates synchronized entity data just before tracker sync.
Sourcefn is_removed(&self) -> bool
fn is_removed(&self) -> bool
Returns true if the entity has been marked for removal.
Sourcefn is_alive(&self) -> bool
fn is_alive(&self) -> bool
Returns whether this entity is alive for vanilla generic entity checks.
Sourcefn begin_pending_world_change(&self) -> Option<PendingWorldChangeToken>
fn begin_pending_world_change(&self) -> Option<PendingWorldChangeToken>
Marks this entity as waiting for a prepared world change.
Sourcefn finish_pending_world_change(&self, token: PendingWorldChangeToken) -> bool
fn finish_pending_world_change(&self, token: PendingWorldChangeToken) -> bool
Clears a pending world change if it still matches the provided token.
Sourcefn is_world_change_pending(&self) -> bool
fn is_world_change_pending(&self) -> bool
Returns true while this entity is waiting for a prepared world change.
Sourcefn is_world_change_token_pending(&self, token: PendingWorldChangeToken) -> bool
fn is_world_change_token_pending(&self, token: PendingWorldChangeToken) -> bool
Returns true if the given world-change token is still pending.
Sourcefn can_use_portal(&self, ignore_passenger: bool) -> bool
fn can_use_portal(&self, ignore_passenger: bool) -> bool
Returns whether this entity may enter a portal.
Mirrors vanilla Entity.canUsePortal, including LivingEntity sleeping
suppression.
Sourcefn dimension_changing_delay(&self) -> i32
fn dimension_changing_delay(&self) -> i32
Returns vanilla’s dimension-changing portal cooldown delay in ticks.
Mirrors vanilla getDimensionChangingDelay overrides for players,
projectiles, and base entities with a player passenger. Concrete vehicle
implementations override this method directly.
Sourcefn removal_reason(&self) -> Option<RemovalReason>
fn removal_reason(&self) -> Option<RemovalReason>
Returns why this entity was removed, if it has been removed.
Sourcefn set_removed(&self, reason: RemovalReason)
fn set_removed(&self, reason: RemovalReason)
Marks the entity as removed with the given reason.
Sourcefn game_event_with_source_entity(
&self,
event: GameEventRef,
source_entity: Option<&dyn Entity>,
)
fn game_event_with_source_entity( &self, event: GameEventRef, source_entity: Option<&dyn Entity>, )
Emits a vanilla game event from this entity’s exact position with an explicit source entity.
Sourcefn game_event(&self, event: GameEventRef)
fn game_event(&self, event: GameEventRef)
Emits a vanilla game event from this entity’s exact position.
Sourcefn kill(&self, world: &World)
fn kill(&self, world: &World)
Kills this entity using vanilla’s living/non-living class split.
world is vanilla’s explicit ServerLevel argument. Living entities
use it for damage processing, while death game events use the entity’s
attached world.
Sourcefn restore_owner_reference(&self, _owner: &SharedEntity)
fn restore_owner_reference(&self, _owner: &SharedEntity)
Caches a live owner reference after restoring persisted owner-linked entities. Most entities do not store owner references.
Sourcefn on_teleported(&self)
fn on_teleported(&self)
Called after a teleport completes successfully.
Sourcefn set_level_callback(&self, callback: Arc<dyn EntityLevelCallback>)
fn set_level_callback(&self, callback: Arc<dyn EntityLevelCallback>)
Sets the level callback for lifecycle events (movement, removal).
Sourcefn notify_leash_holder(&self, _leashable: &dyn Entity)
fn notify_leash_holder(&self, _leashable: &dyn Entity)
Called by leashables while this entity is their live leash holder.
Sourcefn notify_leashee_removed(&self, _leashable: &dyn Entity)
fn notify_leashee_removed(&self, _leashable: &dyn Entity)
Called when a leashable stops using this entity as its live leash holder.
Sourcefn player_touch(self: Arc<Self>, _player: &Arc<Player>)
fn player_touch(self: Arc<Self>, _player: &Arc<Player>)
Called when a player touches this entity during nearby pickup processing.
Sourcefn leashables_leashed_to(&self) -> Vec<SharedEntity> ⓘ
fn leashables_leashed_to(&self) -> Vec<SharedEntity> ⓘ
Finds leashable mobs in vanilla’s nearby leash scan whose holder is this entity.
Sourcefn leashables_leashed_to_holder_in_area(
&self,
holder: &dyn Entity,
) -> Vec<SharedEntity> ⓘ
fn leashables_leashed_to_holder_in_area( &self, holder: &dyn Entity, ) -> Vec<SharedEntity> ⓘ
Finds leashable mobs in this entity’s nearby leash scan whose holder is holder.
Sourcefn transfer_leashables_from_holder(&self, old_holder: &dyn Entity) -> bool
fn transfer_leashables_from_holder(&self, old_holder: &dyn Entity) -> bool
Transfers leashables currently held by old_holder to this entity.
Sourcefn drop_all_leash_connections(&self, player: Option<&Player>) -> bool
fn drop_all_leash_connections(&self, player: Option<&Player>) -> bool
Drops this entity’s leash and all leashables attached to it.
Sourcefn shear_off_all_leash_connections(&self, player: Option<&Player>) -> bool
fn shear_off_all_leash_connections(&self, player: Option<&Player>) -> bool
Shears off all leash connections reachable from this entity.
Sourcefn attempt_to_shear_equipment(
&self,
player: &Player,
hand: InteractionHand,
) -> bool
fn attempt_to_shear_equipment( &self, player: &Player, hand: InteractionHand, ) -> bool
Shears the first shearable equipped item on this mob, spawning it as a dropped item and playing its shearing sound; returns whether anything was sheared.
Sourcefn interact(
&self,
player: &Player,
hand: InteractionHand,
location: DVec3,
) -> InteractionResult
fn interact( &self, player: &Player, hand: InteractionHand, location: DVec3, ) -> InteractionResult
Handles vanilla entity right-click interaction.
Sourcefn interact_entity(
&self,
player: &Player,
hand: InteractionHand,
_location: DVec3,
) -> InteractionResult
fn interact_entity( &self, player: &Player, hand: InteractionHand, _location: DVec3, ) -> InteractionResult
Shared right-click interaction for mobs: leashing/unleashing, cutting leash connections, or shearing equipment with shears.
Sourcefn is_living_entity(&self) -> bool
fn is_living_entity(&self) -> bool
Returns true for entities that implement vanilla living-entity behavior.
Sourcefn is_abstract_arrow(&self) -> bool
fn is_abstract_arrow(&self) -> bool
Returns whether this entity belongs to vanilla’s AbstractArrow hierarchy.
Sourcefn as_projectile(&self) -> Option<&dyn Projectile>
fn as_projectile(&self) -> Option<&dyn Projectile>
Returns this entity as a projectile when it has projectile behavior.
Sourcefn as_living_entity(&self) -> Option<&dyn LivingEntity>
fn as_living_entity(&self) -> Option<&dyn LivingEntity>
Returns this entity as a living entity when it has living behavior.
Sourcefn as_item_frame(&self) -> Option<&dyn ItemFrame>
fn as_item_frame(&self) -> Option<&dyn ItemFrame>
Returns this entity as an item frame when it has item-frame behavior.
Sourcefn as_player(&self) -> Option<&Player>
fn as_player(&self) -> Option<&Player>
Returns this entity as a player when it is the concrete server player.
Sourcefn with_weapon_item(&self, visitor: &mut dyn FnMut(Option<&ItemStack>))
fn with_weapon_item(&self, visitor: &mut dyn FnMut(Option<&ItemStack>))
Visits vanilla Entity.getWeaponItem without copying inventory state.
Sourcefn is_pathfinder_mob(&self) -> bool
fn is_pathfinder_mob(&self) -> bool
Returns true for mobs with pathfinding navigation.
Sourcefn as_pathfinder_mob(&self) -> Option<&dyn PathfinderMob>
fn as_pathfinder_mob(&self) -> Option<&dyn PathfinderMob>
Returns this entity as a pathfinder mob when it has pathfinding behavior.
Sourcefn as_leashable(&self) -> Option<&dyn Leashable>
fn as_leashable(&self) -> Option<&dyn Leashable>
Returns this entity as a Leashable if it has Leashable behavior.
Sourcefn as_abstract_minecart(&self) -> Option<&dyn AbstractMinecart>
fn as_abstract_minecart(&self) -> Option<&dyn AbstractMinecart>
Returns this entity as an AbstractMinecart if it has AbstractMinecart behavior.
Sourcefn as_animal(&self) -> Option<&dyn Animal>
fn as_animal(&self) -> Option<&dyn Animal>
Returns this entity as an animal when it has animal behavior.
Sourcefn is_monster(&self) -> bool
fn is_monster(&self) -> bool
Returns true for entities that implement vanilla hostile-mob behavior.
Sourcefn as_monster(&self) -> Option<&dyn Monster>
fn as_monster(&self) -> Option<&dyn Monster>
Returns the Monster capability, equivalent to vanilla’s instanceof Monster.
Sourcefn as_enemy(&self) -> Option<&dyn Enemy>
fn as_enemy(&self) -> Option<&dyn Enemy>
Returns the Enemy marker, equivalent to vanilla’s instanceof Enemy.
Sourcefn is_ageable_mob(&self) -> bool
fn is_ageable_mob(&self) -> bool
Returns true for entities that implement vanilla ageable-mob behavior.
Sourcefn as_ageable_mob(&self) -> Option<&dyn AgeableMob>
fn as_ageable_mob(&self) -> Option<&dyn AgeableMob>
Returns this entity as an ageable mob when it has ageable behavior.
Sourcefn is_item_steerable(&self) -> bool
fn is_item_steerable(&self) -> bool
Returns true for entities that implement vanilla item-steered boosts.
Sourcefn as_item_steerable(&self) -> Option<&dyn ItemSteerable>
fn as_item_steerable(&self) -> Option<&dyn ItemSteerable>
Returns this entity as item steerable when it has item-steering behavior.
Sourcefn forces_fall_flying_velocity_sync(&self) -> bool
fn forces_fall_flying_velocity_sync(&self) -> bool
Returns whether this entity’s velocity should sync every tick because it’s currently fall-flying with an elytra.
Sourcefn uses_client_movement_packets(&self) -> bool
fn uses_client_movement_packets(&self) -> bool
Returns true when movement is driven by serverbound movement packets.
Sourcefn is_server_driven_movement(&self) -> bool
fn is_server_driven_movement(&self) -> bool
Returns true when normal server ticks drive this entity’s movement.
Sourcefn can_simulate_movement(&self) -> bool
fn can_simulate_movement(&self) -> bool
Returns true when vanilla allows this side to apply movement simulation side effects.
Sourcefn is_effective_ai(&self) -> bool
fn is_effective_ai(&self) -> bool
Returns true when vanilla allows this side to run entity AI/travel logic.
Sourcefn is_suppressing_bounce(&self) -> bool
fn is_suppressing_bounce(&self) -> bool
Returns true when vanilla landing bounce should be suppressed.
Sourcefn is_stepping_carefully(&self) -> bool
fn is_stepping_carefully(&self) -> bool
Returns true when vanilla block step-on hooks should treat this entity as careful.
Sourcefn is_descending(&self) -> bool
fn is_descending(&self) -> bool
Returns true when vanilla collision context should treat the entity as descending.
Sets the vanilla shift-key-down shared flag.
Sets the vanilla swimming shared flag.
Sourcefn update_swimming(&self)
fn update_swimming(&self)
Updates the vanilla swimming shared flag.
Sourcefn default_update_swimming(&self)
fn default_update_swimming(&self)
Shared body of vanilla Entity.updateSwimming for player overrides.
Sets the vanilla sprinting shared flag.
Sets the vanilla fall-flying shared flag.
Sourcefn is_flying_vehicle(&self) -> bool
fn is_flying_vehicle(&self) -> bool
Returns whether vanilla excludes this vehicle from floating kicks.
Sourcefn on_climbable(&self) -> bool
fn on_climbable(&self) -> bool
Returns true if vanilla rules consider this entity to be on a climbable block.
Sourcefn default_known_movement(&self) -> DVec3
fn default_known_movement(&self) -> DVec3
Returns vanilla’s base known movement before entity-specific adjustments.
Sourcefn known_movement(&self) -> DVec3
fn known_movement(&self) -> DVec3
Returns the movement vector vanilla exposes for block-contact logic.
Sourcefn known_speed(&self) -> DVec3
fn known_speed(&self) -> DVec3
Returns the base-tick displacement vanilla exposes as getKnownSpeed.
Sourcefn tick_count(&self) -> i32
fn tick_count(&self) -> i32
Returns the number of ticks this entity has existed for.
Sourcefn is_first_tick(&self) -> bool
fn is_first_tick(&self) -> bool
Returns whether this entity has not completed its first tick.
Sourcefn set_first_tick(&self, first_tick: bool)
fn set_first_tick(&self, first_tick: bool)
Sets whether this entity has not completed its first tick.
Sourcefn advance_tick_count(&self)
fn advance_tick_count(&self)
Advances this entity’s tick counter by one.
Sourcefn fall_sounds(&self) -> (SoundEventRef, SoundEventRef)
fn fall_sounds(&self) -> (SoundEventRef, SoundEventRef)
Returns vanilla small and big fall sounds for this entity.
Sourcefn rotation(&self) -> (f32, f32)
fn rotation(&self) -> (f32, f32)
Gets the entity’s rotation as (yaw, pitch) in degrees.
Yaw is horizontal rotation (0-360), pitch is vertical (-90 to 90).
Sourcefn set_rotation(&self, rotation: (f32, f32))
fn set_rotation(&self, rotation: (f32, f32))
Sets the entity’s rotation as (yaw, pitch) in degrees.
Sourcefn direction_yaw(&self) -> Direction
fn direction_yaw(&self) -> Direction
Gets the nearest horizontal direction to the entity’s yaw (horizontal rotation).
Sourcefn motion_direction(&self) -> Direction
fn motion_direction(&self) -> Direction
Returns the horizontal direction used for movement-dependent behavior.
Sourcefn look_at(&self, from_anchor: EntityAnchor, target: DVec3)
fn look_at(&self, from_anchor: EntityAnchor, target: DVec3)
Rotates this entity to face a fixed position.
Sourcefn look_at_entity(
&self,
from_anchor: EntityAnchor,
target: &dyn Entity,
target_anchor: EntityAnchor,
)
fn look_at_entity( &self, from_anchor: EntityAnchor, target: &dyn Entity, target_anchor: EntityAnchor, )
Rotates this entity to follow an anchored point on another entity.
Sourcefn spawn_data(&self) -> i32
fn spawn_data(&self) -> i32
Extra spawn-packet data used by vanilla for entity-specific construction.
Sourcefn get_eye_height(&self) -> f64
fn get_eye_height(&self) -> f64
Gets the eye height for this entity.
Default implementation returns the eye height from the entity type dimensions. Override for entities with pose-dependent eye heights (e.g., players).
Sourcefn get_fluid_jump_threshold(&self) -> f64
fn get_fluid_jump_threshold(&self) -> f64
Returns the fluid-surface height threshold used for fluid-jump physics: 0.0 for entities with eye height under 0.4, otherwise 0.4.
Sourcefn is_in_wall(&self) -> bool
fn is_in_wall(&self) -> bool
Returns whether the entity is currently suffocating inside a solid block.
Sourcefn calculate_view_vector(&self, pitch_degrees: f32, yaw_degrees: f32) -> DVec3
fn calculate_view_vector(&self, pitch_degrees: f32, yaw_degrees: f32) -> DVec3
Computes a unit look-direction vector from the given pitch and yaw in degrees.
Sourcefn look_angle(&self) -> DVec3
fn look_angle(&self) -> DVec3
Returns this entity’s current unit look-direction vector.
Sourcefn hand_holding_item_angle(&self, item: ItemRef) -> DVec3
fn hand_holding_item_angle(&self, item: ItemRef) -> DVec3
Returns the vanilla offset for the hand holding item.
Only players have a hand offset. If both hands contain the item, vanilla chooses the main hand; otherwise an offhand-only item uses the opposite arm from the player’s configured main arm.
Sourcefn set_velocity(&self, velocity: DVec3)
fn set_velocity(&self, velocity: DVec3)
Sets the entity’s velocity.
Sourcefn needs_velocity_sync(&self) -> bool
fn needs_velocity_sync(&self) -> bool
Returns whether this entity’s velocity has changed enough to need syncing to clients.
Sourcefn mark_velocity_sync(&self)
fn mark_velocity_sync(&self)
Marks this entity’s velocity as needing to be synced to clients.
Sourcefn clear_velocity_sync(&self)
fn clear_velocity_sync(&self)
Clears the vanilla velocity sync marker after send processing.
Sourcefn hurt_marked(&self) -> bool
fn hurt_marked(&self) -> bool
Returns true when vanilla hurt-marked velocity sync is pending.
Sourcefn clear_hurt_mark(&self)
fn clear_hurt_mark(&self)
Clears the vanilla hurt-marked motion sync flag.
Sourcefn fall_distance(&self) -> f64
fn fall_distance(&self) -> f64
Returns accumulated vanilla fall distance.
Sourcefn is_in_powder_snow(&self) -> bool
fn is_in_powder_snow(&self) -> bool
Returns whether this entity is currently inside powder snow.
Sourcefn was_in_powder_snow(&self) -> bool
fn was_in_powder_snow(&self) -> bool
Returns whether this entity was inside powder snow during the previous base tick.
Sourcefn set_fall_distance(&self, fall_distance: f64)
fn set_fall_distance(&self, fall_distance: f64)
Sets accumulated vanilla fall distance.
Sourcefn reset_fall_distance(&self)
fn reset_fall_distance(&self)
Resets accumulated vanilla fall distance.
Sourcefn check_fall_distance_accumulation(&self)
fn check_fall_distance_accumulation(&self)
Caps the accumulated fall distance at 1 once the entity is no longer falling faster than 0.5 blocks per tick.
Sourcefn fire_freeze_state(&self) -> EntityFireFreezeState
fn fire_freeze_state(&self) -> EntityFireFreezeState
Returns the current vanilla fire/freeze state.
Sourcefn remaining_fire_ticks(&self) -> i32
fn remaining_fire_ticks(&self) -> i32
Returns the ticks remaining before this entity stops burning.
Sourcefn set_remaining_fire_ticks(&self, remaining_fire_ticks: i32)
fn set_remaining_fire_ticks(&self, remaining_fire_ticks: i32)
Sets the ticks remaining before this entity stops burning, clamped to this entity’s fire-ticks cap if any.
Sourcefn ticks_frozen(&self) -> i32
fn ticks_frozen(&self) -> i32
Returns ticks this entity has spent freezing in powder snow.
Sourcefn set_ticks_frozen(&self, ticks_frozen: i32)
fn set_ticks_frozen(&self, ticks_frozen: i32)
Sets ticks this entity has spent freezing in powder snow, syncing the change to clients.
Sourcefn fire_immune(&self) -> bool
fn fire_immune(&self) -> bool
Returns whether this entity is immune to fire effects and fire damage.
Sourcefn fire_immune_ticks(&self) -> i32
fn fire_immune_ticks(&self) -> i32
Returns vanilla fire immunity cooldown ticks after not being ignited.
Sourcefn should_play_lava_hurt_sound(&self) -> bool
fn should_play_lava_hurt_sound(&self) -> bool
Returns whether vanilla should play this entity’s lava hurt sound.
Sourcefn lava_ignite(&self)
fn lava_ignite(&self)
Ignites this entity in lava.
Sourcefn remaining_fire_ticks_cap(&self) -> Option<i32>
fn remaining_fire_ticks_cap(&self) -> Option<i32>
Maximum ticks this entity’s remaining-fire timer can hold; None means unlimited.
Sourcefn fire_ignite_extra_ticks(&self) -> i32
fn fire_ignite_extra_ticks(&self) -> i32
Returns extra ticks added by fire-block ignition before 8-second ignition.
Sourcefn is_on_fire(&self) -> bool
fn is_on_fire(&self) -> bool
Returns whether the entity is on fire on the server.
Sourcefn has_visual_fire(&self) -> bool
fn has_visual_fire(&self) -> bool
Returns whether this entity currently renders as visually on fire.
Sourcefn is_freezing(&self) -> bool
fn is_freezing(&self) -> bool
Returns whether the entity has any frozen ticks.
Sourcefn default_can_freeze(&self) -> bool
fn default_can_freeze(&self) -> bool
Returns vanilla Entity.canFreeze() without living-equipment overrides.
Sourcefn can_freeze(&self) -> bool
fn can_freeze(&self) -> bool
Returns whether this entity may accumulate frozen ticks.
Sourcefn ticks_required_to_freeze(&self) -> i32
fn ticks_required_to_freeze(&self) -> i32
Returns the ticks of powder-snow exposure required before this entity starts taking freeze damage.
Sourcefn is_fully_frozen(&self) -> bool
fn is_fully_frozen(&self) -> bool
Returns whether this entity has reached full-freeze duration.
Sourcefn percent_frozen(&self) -> f32
fn percent_frozen(&self) -> f32
Returns how frozen this entity is, from 0.0 to 1.0, based on ticks frozen versus ticks required.
Sourcefn clear_freeze(&self)
fn clear_freeze(&self)
Clears accumulated freezing.
Sourcefn clear_fire(&self)
fn clear_fire(&self)
Clears fire without resetting the vanilla fire immunity cooldown.
Sourcefn extinguish_fire(&self)
fn extinguish_fire(&self)
Plays the extinguish sound when currently on fire, then clears fire.
Sourcefn ignite_for_ticks(&self, number_of_ticks: i32)
fn ignite_for_ticks(&self, number_of_ticks: i32)
Ignites this entity for a vanilla tick duration.
Sourcefn sync_base_fire_freeze_entity_data(&self)
fn sync_base_fire_freeze_entity_data(&self)
Projects base fire/freeze state into generated synced entity data.
Sourcefn sync_base_entity_data(&self)
fn sync_base_entity_data(&self)
Projects all base-owned synchronized fields into generated entity data.
Sourcefn is_in_water(&self) -> bool
fn is_in_water(&self) -> bool
Returns true if this entity is currently touching water.
Sourcefn is_in_rain(&self) -> bool
fn is_in_rain(&self) -> bool
Returns true if rain falls at this entity’s feet or at the top of its bounding box.
Sourcefn is_in_water_or_rain(&self) -> bool
fn is_in_water_or_rain(&self) -> bool
Returns true if this entity is touching water or standing in rain.
Sourcefn is_in_lava(&self) -> bool
fn is_in_lava(&self) -> bool
Returns true if this entity is currently touching lava.
Sourcefn is_eye_in_water(&self) -> bool
fn is_eye_in_water(&self) -> bool
Returns true if this entity’s eyes are currently inside water.
Sourcefn is_eye_in_lava(&self) -> bool
fn is_eye_in_lava(&self) -> bool
Returns true if this entity’s eyes are currently inside lava.
Sourcefn is_under_water(&self) -> bool
fn is_under_water(&self) -> bool
Returns vanilla underwater state.
Sourcefn fluid_contact(&self) -> EntityFluidContact
fn fluid_contact(&self) -> EntityFluidContact
Returns cached fluid contact from the last entity fluid refresh.
Sourcefn refresh_fluid_contact(&self) -> EntityFluidContact
fn refresh_fluid_contact(&self) -> EntityFluidContact
Refreshes cached fluid contact from this entity’s current bounding box.
Sourcefn update_fluid_interaction(&self) -> bool
fn update_fluid_interaction(&self) -> bool
Runs vanilla Entity.updateFluidInteraction: refreshes cached contact,
emits the water-entry splash on transition, resets fall distance in
water, and applies fluid currents.
Returns whether any fluid touches the entity.
Sourcefn scan_and_store_fluid_contact(
&self,
advance_eye_water_history: bool,
) -> EntityFluidContact
fn scan_and_store_fluid_contact( &self, advance_eye_water_history: bool, ) -> EntityFluidContact
Scans current fluid contact and stores it on the entity base.
advance_eye_water_history scans currents and records wasTouchingWater for
vanilla updateFluidInteraction.
Sourcefn apply_fluid_current_impulses(
&self,
world: &Arc<World>,
contact: EntityFluidContact,
)
fn apply_fluid_current_impulses( &self, world: &Arc<World>, contact: EntityFluidContact, )
Applies vanilla water/lava current impulses from a fluid interaction update.
Sourcefn apply_fluid_current_impulse(&self, impulse: DVec3)
fn apply_fluid_current_impulse(&self, impulse: DVec3)
Applies a non-zero fluid current impulse and marks velocity sync.
Sourcefn is_fall_damage_immune(&self) -> bool
fn is_fall_damage_immune(&self) -> bool
Returns true if this entity type ignores vanilla fall damage.
Sourcefn propagate_fall_to_passengers(
&self,
fall_distance: f64,
damage_modifier: f32,
source: &DamageSource,
)
fn propagate_fall_to_passengers( &self, fall_distance: f64, damage_modifier: f32, source: &DamageSource, )
Propagates vanilla fall-damage handling to passengers.
Sourcefn cause_fall_damage(
self: Arc<Self>,
fall_distance: f64,
damage_modifier: f32,
source: &DamageSource,
) -> bool
fn cause_fall_damage( self: Arc<Self>, fall_distance: f64, damage_modifier: f32, source: &DamageSource, ) -> bool
Applies vanilla fall damage.
Living entities use the shared LivingEntity damage path; base entities
only propagate to passengers and return false.
Sourcefn horizontal_collision(&self) -> bool
fn horizontal_collision(&self) -> bool
Returns true if the last movement was clipped horizontally.
Sourcefn vertical_collision(&self) -> bool
fn vertical_collision(&self) -> bool
Returns true if the last movement was clipped vertically.
Sourcefn vertical_collision_below(&self) -> bool
fn vertical_collision_below(&self) -> bool
Returns true if the last vertical collision was below the entity.
Sourcefn no_physics(&self) -> bool
fn no_physics(&self) -> bool
Returns true when movement bypasses collision physics.
Sourcefn is_affected_by_blocks(&self) -> bool
fn is_affected_by_blocks(&self) -> bool
Returns true when vanilla block-contact effects may run for this entity.
Sourcefn set_no_physics(&self, no_physics: bool)
fn set_no_physics(&self, no_physics: bool)
Sets whether this entity bypasses collision physics.
Sourcefn update_no_physics_from_current_collision(&self)
fn update_no_physics_from_current_collision(&self)
Updates item-style noPhysics from the entity’s current collision state.
Sourcefn move_towards_closest_space(&self, x: f64, y: f64, z: f64)
fn move_towards_closest_space(&self, x: f64, y: f64, z: f64)
Nudges velocity toward the closest non-full collision block.
Sourcefn default_make_stuck_in_block(
&self,
_state: BlockStateId,
speed_multiplier: DVec3,
)
fn default_make_stuck_in_block( &self, _state: BlockStateId, speed_multiplier: DVec3, )
Default vanilla stuck-in-block movement for the next movement pass.
Sourcefn make_stuck_in_block(&self, state: BlockStateId, speed_multiplier: DVec3)
fn make_stuck_in_block(&self, state: BlockStateId, speed_multiplier: DVec3)
Applies vanilla stuck-in-block movement for the next movement pass.
Sourcefn apply_effects_from_blocks(&self)
fn apply_effects_from_blocks(&self)
Applies current block-contact effects to this entity.
Mirrors the shared ownership boundary of vanilla Entity.applyEffectsFromBlocks.
Sourcefn apply_effects_from_blocks_between(&self, from: DVec3, to: DVec3)
fn apply_effects_from_blocks_between(&self, from: DVec3, to: DVec3)
Applies block-contact effects for one explicit movement segment.
Mirrors vanilla’s Entity.applyEffectsFromBlocks(Vec3, Vec3) overload,
which does not finalize or clear the entity’s normal movement trace.
Sourcefn apply_effects_from_blocks_for_last_movements(&self)
fn apply_effects_from_blocks_for_last_movements(&self)
Replays the last finalized block-contact movement list.
Sourcefn land_after_teleport(&self)
fn land_after_teleport(&self)
What vanilla’s /teleport does once an entity has moved: unless it is gliding, it ends up
on the ground without vertical motion.
Sourcefn set_on_ground(&self, on_ground: bool)
fn set_on_ground(&self, on_ground: bool)
Sets whether the entity is on the ground.
Sourcefn set_on_ground_with_movement(
&self,
on_ground: bool,
horizontal_collision: bool,
movement: DVec3,
)
fn set_on_ground_with_movement( &self, on_ground: bool, horizontal_collision: bool, movement: DVec3, )
Sets ground and horizontal collision flags from accepted movement.
Sourcefn default_apply_accepted_client_movement(
self: Arc<Self>,
world: &Arc<World>,
accepted: AcceptedClientMovement,
) -> Result<AcceptedClientMovementOutcome, EntityMoveError>
fn default_apply_accepted_client_movement( self: Arc<Self>, world: &Arc<World>, accepted: AcceptedClientMovement, ) -> Result<AcceptedClientMovementOutcome, EntityMoveError>
Default final state application for accepted client-authored movement.
Mirrors the shared tail of vanilla player and controlled-vehicle movement handling after rollback/collision validation has accepted the target.
Sourcefn apply_accepted_client_movement(
self: Arc<Self>,
world: &Arc<World>,
accepted: AcceptedClientMovement,
) -> Result<AcceptedClientMovementOutcome, EntityMoveError>
fn apply_accepted_client_movement( self: Arc<Self>, world: &Arc<World>, accepted: AcceptedClientMovement, ) -> Result<AcceptedClientMovementOutcome, EntityMoveError>
Applies final state accepted from a client-authored movement packet.
Sourcefn apply_accepted_client_vehicle_movement(
self: Arc<Self>,
world: &Arc<World>,
accepted: AcceptedClientMovement,
) -> Result<AcceptedClientMovementOutcome, EntityMoveError>
fn apply_accepted_client_vehicle_movement( self: Arc<Self>, world: &Arc<World>, accepted: AcceptedClientMovement, ) -> Result<AcceptedClientMovementOutcome, EntityMoveError>
Applies final state accepted from a controlled-vehicle movement packet.
Sourcefn try_set_position(&self, pos: DVec3) -> Result<(), EntityMoveError>
fn try_set_position(&self, pos: DVec3) -> Result<(), EntityMoveError>
Attempts to set the entity’s position through world lifecycle validation.
For the base method, see Entity::try_set_position_base
Sourcefn try_set_position_base(&self, pos: DVec3) -> Result<(), EntityMoveError>
fn try_set_position_base(&self, pos: DVec3) -> Result<(), EntityMoveError>
The base method to set the entity’s position through world lifecycle validation.
Sourcefn teleport_to(&self, pos: DVec3) -> Result<(), EntityMoveError>
fn teleport_to(&self, pos: DVec3) -> Result<(), EntityMoveError>
Moves this entity to pos, keeping its current rotation.
Sourcefn set_old_position_to_current(&self)
fn set_old_position_to_current(&self)
Sets the vanilla movement-trace old position to the current position.
Sourcefn set_old_position(&self, old_position: DVec3)
fn set_old_position(&self, old_position: DVec3)
Sets the vanilla movement-trace old position explicitly.
Sourcefn remove_latest_movement_recording(&self)
fn remove_latest_movement_recording(&self)
Removes the latest movement segment recorded this tick.
Sourcefn on_pos(&self, offset: f32) -> Option<BlockPos>
fn on_pos(&self, offset: f32) -> Option<BlockPos>
Returns the block position this entity is standing on.
Sourcefn block_pos_below_that_affects_movement(&self) -> Option<BlockPos>
fn block_pos_below_that_affects_movement(&self) -> Option<BlockPos>
Returns the block position used for movement-affecting block properties.
Sourcefn on_pos_legacy(&self) -> Option<BlockPos>
fn on_pos_legacy(&self) -> Option<BlockPos>
Returns vanilla getOnPosLegacy(), used by fall/step block hooks.
Sourcefn default_block_speed_factor(&self) -> f32
fn default_block_speed_factor(&self) -> f32
Returns the vanilla block speed factor applied after movement.
Sourcefn block_speed_factor(&self) -> f32
fn block_speed_factor(&self) -> f32
Returns the block speed factor applied after movement.
Sourcefn block_jump_factor(&self) -> f32
fn block_jump_factor(&self) -> f32
Returns the jump-height multiplier from the block at this entity’s position, falling back to the block below when the current one doesn’t modify jumps.
Sourcefn pose(&self) -> EntityPose
fn pose(&self) -> EntityPose
Returns this entity’s physical pose.
Sourcefn dimensions_for_pose(&self, _pose: EntityPose) -> EntityDimensions
fn dimensions_for_pose(&self, _pose: EntityPose) -> EntityDimensions
Returns vanilla dimensions for a physical pose.
Sourcefn refresh_dimensions(&self)
fn refresh_dimensions(&self)
Refreshes dimensions for the current physical pose.
Sourcefn fudge_position_after_size_change(
&self,
previous_dimensions: EntityDimensions,
) -> bool
fn fudge_position_after_size_change( &self, previous_dimensions: EntityDimensions, ) -> bool
Moves the entity to the closest free position for its new dimensions
within the previous dimensions’ footprint, returning whether a valid
position was found. Vanilla runs this after growing in a confined space;
Steel’s ThrownEgg hatchlings also use it to fit a newborn chick at the
egg’s impact point.
Sourcefn set_pose(&self, pose: EntityPose)
fn set_pose(&self, pose: EntityPose)
Sets the physical pose and synchronized pose metadata.
Sourcefn is_crouching(&self) -> bool
fn is_crouching(&self) -> bool
Returns whether vanilla currently considers this entity crouching.
Sourcefn is_swimming(&self) -> bool
fn is_swimming(&self) -> bool
Returns whether vanilla currently considers this entity swimming.
Sourcefn is_on_rails(&self) -> bool
fn is_on_rails(&self) -> bool
Returns whether this entity is on rails.
Sourcefn is_state_climbable(&self, state: BlockStateId) -> bool
fn is_state_climbable(&self, state: BlockStateId) -> bool
Returns whether a block state is climbable for base movement effects.
Sourcefn movement_emission(&self) -> EntityMovementEmission
fn movement_emission(&self) -> EntityMovementEmission
Returns vanilla movement side effects emitted by this entity.
Sourcefn may_interact(&self, _world: &World, _pos: BlockPos) -> bool
fn may_interact(&self, _world: &World, _pos: BlockPos) -> bool
Returns whether this entity may modify the world at a position.
Vanilla Entity.mayInteract defaults to true; player-like entities can
apply world permission checks through overrides.
Sourcefn air_supply(&self) -> i32
fn air_supply(&self) -> i32
Returns this entity’s current air supply in ticks, synced to clients.
Sourcefn set_air_supply(&self, air_supply: i32)
fn set_air_supply(&self, air_supply: i32)
Sets this entity’s air supply in ticks, syncing the change to clients.
Sourcefn max_air_supply(&self) -> i32
fn max_air_supply(&self) -> i32
Returns this entity’s maximum vanilla air supply.
Sourcefn portal_cooldown(&self) -> i32
fn portal_cooldown(&self) -> i32
Returns the vanilla portal cooldown in ticks.
Sourcefn set_portal_cooldown(&self, portal_cooldown: i32)
fn set_portal_cooldown(&self, portal_cooldown: i32)
Sets the vanilla portal cooldown in ticks.
Sourcefn is_on_portal_cooldown(&self) -> bool
fn is_on_portal_cooldown(&self) -> bool
Returns whether the entity is on vanilla portal cooldown.
Sourcefn reset_portal_cooldown(&self)
fn reset_portal_cooldown(&self)
Resets vanilla portal cooldown to this entity’s dimension-changing delay.
Sourcefn set_as_inside_portal(&self, portal: PortalKind, entry_position: BlockPos)
fn set_as_inside_portal(&self, portal: PortalKind, entry_position: BlockPos)
Marks this entity as inside a vanilla portal during the current tick.
Sourcefn custom_name(&self) -> Option<TextComponent>
fn custom_name(&self) -> Option<TextComponent>
Returns this entity’s optional vanilla custom name.
Sourcefn set_custom_name(&self, custom_name: Option<TextComponent>)
fn set_custom_name(&self, custom_name: Option<TextComponent>)
Sets this entity’s optional vanilla custom name.
Sourcefn is_custom_name_visible(&self) -> bool
fn is_custom_name_visible(&self) -> bool
Returns whether vanilla renders this entity’s custom name.
Sourcefn set_custom_name_visible(&self, visible: bool)
fn set_custom_name_visible(&self, visible: bool)
Sets whether vanilla renders this entity’s custom name.
Sourcefn has_glowing_tag(&self) -> bool
fn has_glowing_tag(&self) -> bool
Returns whether this entity has the server-owned vanilla glowing tag.
Sourcefn set_glowing_tag(&self, glowing: bool)
fn set_glowing_tag(&self, glowing: bool)
Sets this entity’s server-owned vanilla glowing tag.
Returns a snapshot of this entity’s vanilla scoreboard tags.
Sourcefn remove_tag(&self, tag: &str) -> bool
fn remove_tag(&self, tag: &str) -> bool
Removes a vanilla scoreboard tag.
Sourcefn custom_data(&self) -> NbtCompound
fn custom_data(&self) -> NbtCompound
Returns a snapshot of this entity’s vanilla custom data.
Sourcefn set_custom_data(&self, custom_data: NbtCompound)
fn set_custom_data(&self, custom_data: NbtCompound)
Replaces this entity’s vanilla custom data.
Sourcefn sound_source(&self) -> SoundSource
fn sound_source(&self) -> SoundSource
Returns this entity’s vanilla sound source category.
Sourcefn swim_sound(&self) -> SoundEventRef
fn swim_sound(&self) -> SoundEventRef
Returns this entity’s vanilla swim sound.
Sourcefn set_silent(&self, silent: bool)
fn set_silent(&self, silent: bool)
Sets whether sounds from this entity are suppressed.
Sourcefn broadcast_entity_event(&self, event: EntityStatus)
fn broadcast_entity_event(&self, event: EntityStatus)
Broadcasts a vanilla entity event/status packet near this entity.
Sourcefn play_sound(&self, sound: SoundEventRef, volume: f32, pitch: f32)
fn play_sound(&self, sound: SoundEventRef, volume: f32, pitch: f32)
Plays an entity sound at the entity’s exact position.
Sourcefn swim_splash_sound(&self) -> SoundEventRef
fn swim_splash_sound(&self) -> SoundEventRef
Returns the sound played when this entity enters water at low speed.
Sourcefn swim_high_speed_splash_sound(&self) -> SoundEventRef
fn swim_high_speed_splash_sound(&self) -> SoundEventRef
Returns the sound played when this entity enters water at high speed.
Sourcefn do_water_splash_effect(&self)
fn do_water_splash_effect(&self)
Plays the vanilla water-entry splash sound and emits SPLASH.
Sourcefn default_do_water_splash_effect(&self)
fn default_do_water_splash_effect(&self)
The default implementation of Entity.doWaterSplashEffect when not overridden.
Sourcefn play_entity_on_fire_extinguished_sound(&self)
fn play_entity_on_fire_extinguished_sound(&self)
Plays vanilla’s extinguished-on-fire entity sound.
Sourcefn play_step_sound(&self, _pos: BlockPos, block_state: BlockStateId)
fn play_step_sound(&self, _pos: BlockPos, block_state: BlockStateId)
Plays the base vanilla step sound for a block.
Sourcefn play_block_step_sound(&self, block_state: BlockStateId)
fn play_block_step_sound(&self, block_state: BlockStateId)
Plays a vanilla block step sound at this entity’s current position.
Sourcefn play_muffled_step_sound(&self, block_state: BlockStateId)
fn play_muffled_step_sound(&self, block_state: BlockStateId)
Plays vanilla’s muffled secondary step sound.
Sourcefn play_combination_step_sounds(
&self,
primary_step_sound: BlockStateId,
secondary_step_sound: BlockStateId,
)
fn play_combination_step_sounds( &self, primary_step_sound: BlockStateId, secondary_step_sound: BlockStateId, )
Plays vanilla’s combination primary and secondary step sounds.
Sourcefn walking_step_sound(&self, pos: BlockPos, block_state: BlockStateId)
fn walking_step_sound(&self, pos: BlockPos, block_state: BlockStateId)
Plays vanilla walking step sounds, including amethyst chimes.
Sourcefn play_amethyst_step_sound(&self)
fn play_amethyst_step_sound(&self)
Plays vanilla amethyst step chime when its cooldown permits it.
Sourcefn water_swim_sound(&self)
fn water_swim_sound(&self)
Plays vanilla swim sound from movement emission.
Sourcefn play_swim_sound(&self, volume: f32)
fn play_swim_sound(&self, volume: f32)
Plays this entity’s swim sound at the given volume.
Sourcefn is_flapping(&self) -> bool
fn is_flapping(&self) -> bool
Returns whether the entity is currently flapping.
Sourcefn process_flapping_movement(&self)
fn process_flapping_movement(&self)
Processes vanilla flap movement side effects.
Sourcefn next_step(&self) -> f32
fn next_step(&self) -> f32
Returns the next step threshold after movement side effects are produced.
Sourcefn apply_movement_emission_and_play_sound(
&self,
emission: EntityMovementEmission,
clipped_movement: DVec3,
effect_pos: BlockPos,
effect_state: BlockStateId,
)
fn apply_movement_emission_and_play_sound( &self, emission: EntityMovementEmission, clipped_movement: DVec3, effect_pos: BlockPos, effect_state: BlockStateId, )
Applies vanilla movement sounds and game events after a completed move.
Sourcefn apply_movement_side_effects_after_move(
&self,
world: &World,
actual_movement: DVec3,
)
fn apply_movement_side_effects_after_move( &self, world: &World, actual_movement: DVec3, )
Applies movement side effects after vanilla collision and landing updates.
Sourcefn vibration_and_sound_effects_from_block(
&self,
pos: BlockPos,
block_state: BlockStateId,
should_sound: bool,
should_vibrate: bool,
clipped_movement: DVec3,
) -> bool
fn vibration_and_sound_effects_from_block( &self, pos: BlockPos, block_state: BlockStateId, should_sound: bool, should_vibrate: bool, clipped_movement: DVec3, ) -> bool
Emits step side effects from a candidate movement-effect block.
Sourcefn max_up_step(&self) -> f32
fn max_up_step(&self) -> f32
Maximum height this entity can step up during normal movement.
Sourcefn backs_off_from_edge(&self) -> bool
fn backs_off_from_edge(&self) -> bool
Whether movement should apply player-style sneak edge prevention.
Sourcefn get_default_gravity(&self) -> f64
fn get_default_gravity(&self) -> f64
Gets the default gravity for this entity type.
Override this to specify entity-specific gravity.
Vanilla values: ItemEntity = 0.04, LivingEntity = 0.08
Sourcefn is_no_gravity(&self) -> bool
fn is_no_gravity(&self) -> bool
Returns true if gravity is disabled for this entity.
Sourcefn set_no_gravity(&self, no_gravity: bool)
fn set_no_gravity(&self, no_gravity: bool)
Sets whether this entity ignores gravity, syncing the change to clients.
Sourcefn is_invulnerable(&self) -> bool
fn is_invulnerable(&self) -> bool
Returns whether this entity is invulnerable to non-bypassing damage.
Sourcefn set_invulnerable(&self, invulnerable: bool)
fn set_invulnerable(&self, invulnerable: bool)
Sets whether this entity is invulnerable to non-bypassing damage.
Sourcefn get_gravity(&self) -> f64
fn get_gravity(&self) -> f64
Gets the current gravity value.
Returns 0 if no_gravity is set, otherwise returns get_default_gravity().
Sourcefn get_air_drag(&self) -> f64
fn get_air_drag(&self) -> f64
get the air drag value of the entity
Sourcefn apply_gravity(&self)
fn apply_gravity(&self)
Applies gravity to the entity’s velocity.
Sourcefn move_relative(&self, speed: f32, input: DVec3)
fn move_relative(&self, speed: f32, input: DVec3)
Adds input scaled by speed, rotated to face this entity’s current
yaw, to its velocity.
Sourcefn move_without_physics(&self, delta: DVec3) -> Option<MoveResult>
fn move_without_physics(&self, delta: DVec3) -> Option<MoveResult>
Moves the entity without collision physics.
Sourcefn default_move_entity(
self: Arc<Self>,
mover_type: MoverType,
delta: DVec3,
) -> Option<MoveResult>
fn default_move_entity( self: Arc<Self>, mover_type: MoverType, delta: DVec3, ) -> Option<MoveResult>
Moves the entity with collision detection.
Updates position, on_ground, velocity (on collision), and returns collision info.
Sourcefn move_entity(
self: Arc<Self>,
mover_type: MoverType,
delta: DVec3,
) -> Option<MoveResult>
fn move_entity( self: Arc<Self>, mover_type: MoverType, delta: DVec3, ) -> Option<MoveResult>
Moves the entity with collision detection.
Sourcefn apply_fall_damage_after_move(
self: Arc<Self>,
result: &MoveResult,
world: &Arc<World>,
) -> bool
fn apply_fall_damage_after_move( self: Arc<Self>, result: &MoveResult, world: &Arc<World>, ) -> bool
Applies vanilla fall-distance bookkeeping after accepted movement.
Sourcefn reset_fall_distance_on_resetting_clip(
&self,
world: &Arc<World>,
movement: DVec3,
)
fn reset_fall_distance_on_resetting_clip( &self, world: &Arc<World>, movement: DVec3, )
Resets fall distance when vanilla’s fall-damage-resetting clip hits.
Sourcefn do_check_fall_damage(
self: Arc<Self>,
movement: DVec3,
on_ground: bool,
world: &Arc<World>,
) -> bool
fn do_check_fall_damage( self: Arc<Self>, movement: DVec3, on_ground: bool, world: &Arc<World>, ) -> bool
Applies fall damage from the block fallen on, then returns whether the entity was removed (e.g. killed) as a result.
Callers update on-ground/supporting-block state before this method.
Sourcefn refresh_supporting_block_for_fall_damage(
&self,
movement: DVec3,
on_ground: bool,
)
fn refresh_supporting_block_for_fall_damage( &self, movement: DVec3, on_ground: bool, )
Refreshes vanilla supporting-block state before fall-damage side effects.
Sourcefn send_landing_particles(
&self,
world: &World,
on_state: BlockStateId,
pos: BlockPos,
)
fn send_landing_particles( &self, world: &World, on_state: BlockStateId, pos: BlockPos, )
Sends the vanilla landing burst for living entities with enough fall power.
Sourcefn check_fall_damage(
self: Arc<Self>,
vertical_movement: f64,
on_ground: bool,
on_state: BlockStateId,
pos: BlockPos,
world: &Arc<World>,
)
fn check_fall_damage( self: Arc<Self>, vertical_movement: f64, on_ground: bool, on_state: BlockStateId, pos: BlockPos, world: &Arc<World>, )
Accumulates fall distance, applies landing damage from the block fallen on, and resets it.
Sourcefn ground_contact_after_movement(
&self,
on_ground: bool,
movement: Option<DVec3>,
) -> EntityGroundContact
fn ground_contact_after_movement( &self, on_ground: bool, movement: Option<DVec3>, ) -> EntityGroundContact
Computes vanilla support state for an on-ground update.
Sourcefn check_supporting_block(
&self,
on_ground: bool,
movement: Option<DVec3>,
world: &Arc<World>,
) -> EntityGroundContact
fn check_supporting_block( &self, on_ground: bool, movement: Option<DVec3>, world: &Arc<World>, ) -> EntityGroundContact
Determines the supporting block state and position underneath the entity while grounded.
Sourcefn spawn_at_location(
&self,
item: ItemStack,
y_offset: f64,
) -> Option<Arc<ItemEntity>>
fn spawn_at_location( &self, item: ItemStack, y_offset: f64, ) -> Option<Arc<ItemEntity>>
Spawns an item at this entity’s location.
The item spawns at the entity’s position with the given Y offset and has a default pickup delay.
Returns None if the item stack is empty or the entity has no world.
Sourcefn spawn_at_location_with_offset(
&self,
item: ItemStack,
offset: DVec3,
) -> Option<Arc<ItemEntity>>
fn spawn_at_location_with_offset( &self, item: ItemStack, offset: DVec3, ) -> Option<Arc<ItemEntity>>
Spawns an item at this entity’s location plus a vanilla attachment offset.
Sourcefn save_additional(&self, _nbt: &mut NbtCompound)
fn save_additional(&self, _nbt: &mut NbtCompound)
Saves type-specific entity data to NBT.
Called during chunk serialization. Implementors should save all data
needed to restore entity state on load. Base fields (pos, motion,
rotation, uuid, on_ground) are handled by the serialization layer.
Sourcefn load_additional(&self, _nbt: BorrowedNbtCompoundView<'_, '_>)
fn load_additional(&self, _nbt: BorrowedNbtCompoundView<'_, '_>)
Loads type-specific entity data from NBT.
Called after entity creation during chunk deserialization. Base fields are already restored; this handles type-specific data.
Sourcefn apply_implicit_item_components(&self, _item_stack: &ItemStack)
fn apply_implicit_item_components(&self, _item_stack: &ItemStack)
Applies entity-specific implicit components carried by an item stack.
Mirrors the overridable part of vanilla’s Entity.applyImplicitComponents.
Sourcefn apply_spawn_data(&self, nbt: BorrowedNbtCompoundView<'_, '_>)
fn apply_spawn_data(&self, nbt: BorrowedNbtCompoundView<'_, '_>)
Spawn-item data is merged into the entity’s current save state before it is loaded. Keeping that merge at the entity boundary preserves defaults and entity-specific state when the component only overrides one field.
Sourcefn is_invulnerable_to_base(&self, source: &DamageSource) -> bool
fn is_invulnerable_to_base(&self, source: &DamageSource) -> bool
Returns whether this entity is immune to damage from source: already
removed, or invulnerable and the source doesn’t bypass invulnerability.
Sourcefn hurt(&self, world: &World, source: &DamageSource, amount: f32) -> bool
fn hurt(&self, world: &World, source: &DamageSource, amount: f32) -> bool
Applies damage to this entity.
Sourcefn distance_to_sqr(&self, pos: DVec3) -> f64
fn distance_to_sqr(&self, pos: DVec3) -> f64
Calculates the squared Euclidean distance from this entity’s position to the given position.
Sourcefn snap_to(&self, position: DVec3, yaw: f32, pitch: f32)
fn snap_to(&self, position: DVec3, yaw: f32, pitch: f32)
Sets position and rotation.
§Panics
Panics if the active world entity manager rejects the snap position. This is an invariant failure for loaded entities.
Sourcefn killed_entity(
&self,
_world: &World,
_entity: &dyn LivingEntity,
_source: &DamageSource,
) -> bool
fn killed_entity( &self, _world: &World, _entity: &dyn LivingEntity, _source: &DamageSource, ) -> bool
Runs when this entity causes another entity to die. The entity provided is the entity who was killed.
Sourcefn award_kill_score(&self, _victim: &dyn Entity, _killing_blow: &DamageSource)
fn award_kill_score(&self, _victim: &dyn Entity, _killing_blow: &DamageSource)
Runs when this entity kills another entity.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".