pub struct EntityBase {
id: i32,
uuid: Uuid,
world: SyncMutex<Weak<World>>,
state: SyncMutex<EntityBaseState>,
save_data: SyncMutex<EntityBaseSaveData>,
movement_trace: SyncMutex<EntityMovementTrace>,
lifecycle: SyncMutex<EntityLifecycleState>,
relationships: SyncMutex<EntityRelationshipState>,
portal_process: SyncMutex<Option<PortalProcessor>>,
level_callback: SyncMutex<Arc<dyn EntityLevelCallback>>,
}Expand description
Common fields and methods shared by all entities.
Entities embed this struct to avoid duplicating core identity, position,
and lifecycle management code. The Entity trait implementation can then
delegate to EntityBase methods for common functionality.
§Example
pub struct MyEntity {
base: EntityBase,
// Entity-specific fields...
}
impl Entity for MyEntity {
fn id(&self) -> i32 { self.base.id() }
fn uuid(&self) -> Uuid { self.base.uuid() }
fn position(&self) -> DVec3 { self.base.position() }
// ... delegate other common methods ...
// Entity-specific implementations:
fn entity_type(&self) -> EntityTypeRef { vanilla_entities::MY_ENTITY }
fn tick(&self) { /* custom tick logic */ }
}Fields§
§id: i32Unique network ID for this entity (session-local).
uuid: UuidPersistent UUID for this entity.
world: SyncMutex<Weak<World>>The world this entity is in.
state: SyncMutex<EntityBaseState>Current vanilla movement state.
save_data: SyncMutex<EntityBaseSaveData>Shared vanilla save data outside the movement snapshot.
movement_trace: SyncMutex<EntityMovementTrace>Per-tick movement segments used by vanilla block-contact effects.
lifecycle: SyncMutex<EntityLifecycleState>Removal and tick bookkeeping.
relationships: SyncMutex<EntityRelationshipState>Passenger, vehicle, and boarding-cooldown state.
portal_process: SyncMutex<Option<PortalProcessor>>Active vanilla portal timing state.
level_callback: SyncMutex<Arc<dyn EntityLevelCallback>>Callback for entity lifecycle events.
Implementations§
Source§impl EntityBase
impl EntityBase
Sourcepub fn new(
id: i32,
position: DVec3,
dimensions: EntityDimensions,
world: Weak<World>,
) -> Self
pub fn new( id: i32, position: DVec3, dimensions: EntityDimensions, world: Weak<World>, ) -> Self
Creates a new EntityBase with a randomly generated UUID.
Sourcepub fn new_with_state(
id: i32,
state: EntityBaseState,
world: Weak<World>,
) -> Self
pub fn new_with_state( id: i32, state: EntityBaseState, world: Weak<World>, ) -> Self
Creates a new EntityBase with a randomly generated UUID and explicit state.
Sourcepub fn with_uuid(
id: i32,
uuid: Uuid,
position: DVec3,
dimensions: EntityDimensions,
world: Weak<World>,
) -> Self
pub fn with_uuid( id: i32, uuid: Uuid, position: DVec3, dimensions: EntityDimensions, world: Weak<World>, ) -> Self
Creates a new EntityBase with the specified UUID.
Use this when loading entities from disk or when the UUID is known.
Sourcepub fn with_uuid_and_state(
id: i32,
uuid: Uuid,
state: EntityBaseState,
world: Weak<World>,
) -> Self
pub fn with_uuid_and_state( id: i32, uuid: Uuid, state: EntityBaseState, world: Weak<World>, ) -> Self
Creates a new EntityBase with the specified UUID and restored movement state.
Use this when loading entities from disk so the vanilla base fields are reconstructed in one place.
Sourcepub fn from_load(load: EntityBaseLoad, dimensions: EntityDimensions) -> Self
pub fn from_load(load: EntityBaseLoad, dimensions: EntityDimensions) -> Self
Creates a base from persistent vanilla entity fields.
Sourcepub fn old_position(&self) -> DVec3
pub fn old_position(&self) -> DVec3
Gets the entity position used by vanilla movement traces.
Sourcepub fn known_speed(&self) -> DVec3
pub fn known_speed(&self) -> DVec3
Returns vanilla lastKnownSpeed, the displacement computed at base-tick start.
Sourcepub fn tick_count(&self) -> i32
pub fn tick_count(&self) -> i32
Returns vanilla Entity.tickCount.
Sourcepub fn bounding_box(&self) -> WorldAabb
pub fn bounding_box(&self) -> WorldAabb
Gets the entity’s current bounding box.
Sourcepub(crate) fn physics_state(
&self,
input: EntityPhysicsStateInput,
) -> EntityPhysicsState
pub(crate) fn physics_state( &self, input: EntityPhysicsStateInput, ) -> EntityPhysicsState
Returns the vanilla movement physics snapshot from the current base state.
Sourcepub fn dimensions(&self) -> EntityDimensions
pub fn dimensions(&self) -> EntityDimensions
Gets the entity’s current dimensions.
Sourcepub fn old_rotation(&self) -> (f32, f32)
pub fn old_rotation(&self) -> (f32, f32)
Gets vanilla yRotO/xRotO as (yaw, pitch) in degrees.
Sourcepub fn movement_flags(&self) -> EntityMovementFlags
pub fn movement_flags(&self) -> EntityMovementFlags
Returns the current vanilla movement flag snapshot.
Sourcepub fn ground_contact(&self) -> EntityGroundContact
pub fn ground_contact(&self) -> EntityGroundContact
Returns the current vanilla ground-contact snapshot.
Sourcepub fn movement_progress(&self) -> EntityMovementProgress
pub fn movement_progress(&self) -> EntityMovementProgress
Returns vanilla movement side-effect progress counters.
Sourcepub fn fire_freeze_state(&self) -> EntityFireFreezeState
pub fn fire_freeze_state(&self) -> EntityFireFreezeState
Returns the current vanilla fire/freeze state.
Sourcepub fn save_data(&self) -> EntityBaseSaveData
pub fn save_data(&self) -> EntityBaseSaveData
Returns a snapshot of shared vanilla save data.
Sourcepub fn replace_save_data(&self, save_data: EntityBaseSaveData)
pub fn replace_save_data(&self, save_data: EntityBaseSaveData)
Replaces shared vanilla save data.
Sourcepub fn in_block_state(&self, world: &World) -> BlockStateId
pub fn in_block_state(&self, world: &World) -> BlockStateId
Returns vanilla Entity.getInBlockState, cached until base tick or block-position change.
Sourcepub fn set_fire_freeze_state(&self, fire_freeze: EntityFireFreezeState)
pub fn set_fire_freeze_state(&self, fire_freeze: EntityFireFreezeState)
Replaces the current vanilla fire/freeze state.
Sourcepub fn horizontal_collision(&self) -> bool
pub fn horizontal_collision(&self) -> bool
Returns true if the last movement was clipped horizontally.
Sourcepub fn vertical_collision(&self) -> bool
pub fn vertical_collision(&self) -> bool
Returns true if the last movement was clipped vertically.
Sourcepub fn vertical_collision_below(&self) -> bool
pub fn vertical_collision_below(&self) -> bool
Returns true if the last vertical collision was below the entity.
Sourcepub fn supporting_block(&self) -> Option<BlockPos>
pub fn supporting_block(&self) -> Option<BlockPos>
Returns the block currently supporting this entity, if known.
Sourcepub fn on_ground_no_blocks(&self) -> bool
pub fn on_ground_no_blocks(&self) -> bool
Returns true when the entity is grounded but no supporting block was found.
Sourcepub fn fluid_contact(&self) -> EntityFluidContact
pub fn fluid_contact(&self) -> EntityFluidContact
Returns cached fluid contact from the last entity fluid refresh.
Sourcepub fn was_eye_in_water(&self) -> bool
pub fn was_eye_in_water(&self) -> bool
Returns vanilla wasEyeInWater from the previous fluid refresh.
Sourcepub fn fall_distance(&self) -> f64
pub fn fall_distance(&self) -> f64
Returns accumulated vanilla fall distance.
Sourcepub fn no_physics(&self) -> bool
pub fn no_physics(&self) -> bool
Returns true when movement bypasses collision physics.
Sourcepub fn air_supply(&self) -> i32
pub fn air_supply(&self) -> i32
Returns the synchronized vanilla Air value.
Sourcepub fn portal_cooldown(&self) -> i32
pub fn portal_cooldown(&self) -> i32
Returns the vanilla portal cooldown in ticks.
Sourcepub fn is_on_portal_cooldown(&self) -> bool
pub fn is_on_portal_cooldown(&self) -> bool
Returns whether the entity is on vanilla portal cooldown.
Sourcepub fn portal_process(&self) -> Option<PortalProcessor>
pub fn portal_process(&self) -> Option<PortalProcessor>
Returns the active vanilla portal process, if the entity is charging a portal.
Sourcepub fn no_gravity(&self) -> bool
pub fn no_gravity(&self) -> bool
Returns the shared vanilla NoGravity flag.
Sourcepub fn invulnerable(&self) -> bool
pub fn invulnerable(&self) -> bool
Returns the shared vanilla Invulnerable flag.
Sourcepub fn custom_name(&self) -> Option<TextComponent>
pub fn custom_name(&self) -> Option<TextComponent>
Returns the optional vanilla custom name.
Sourcepub fn custom_name_visible(&self) -> bool
pub fn custom_name_visible(&self) -> bool
Returns the vanilla custom-name visibility flag.
Returns a sorted snapshot of vanilla scoreboard tags.
Sourcepub fn custom_data(&self) -> NbtCompound
pub fn custom_data(&self) -> NbtCompound
Returns a snapshot of vanilla custom data.
Sourcepub fn needs_velocity_sync(&self) -> bool
pub fn needs_velocity_sync(&self) -> bool
Returns true when vanilla ServerEntity should consider a velocity sync.
Sourcepub fn hurt_marked(&self) -> bool
pub fn hurt_marked(&self) -> bool
Returns true when vanilla hurt-marked velocity sync is pending.
Sourcepub fn level(&self) -> Option<Arc<World>>
pub fn level(&self) -> Option<Arc<World>>
Gets the world this entity is in.
Returns None if the world has been dropped.
Sourcepub fn vehicle(&self) -> Option<SharedEntity>
pub fn vehicle(&self) -> Option<SharedEntity>
Gets the vehicle this entity is riding, if it is still loaded.
Sourcepub fn passengers(&self) -> Vec<SharedEntity> ⓘ
pub fn passengers(&self) -> Vec<SharedEntity> ⓘ
Gets this entity’s direct passengers, pruning stale weak references.
Sourcepub fn first_passenger(&self) -> Option<SharedEntity>
pub fn first_passenger(&self) -> Option<SharedEntity>
Gets this entity’s first direct passenger, if present.
Sourcepub fn is_vehicle(&self) -> bool
pub fn is_vehicle(&self) -> bool
Returns true when this entity has at least one direct passenger.
Sourcepub fn has_passenger_id(&self, passenger_id: i32) -> bool
pub fn has_passenger_id(&self, passenger_id: i32) -> bool
Returns true when the entity ID is a direct passenger.
Sourcepub fn boarding_cooldown(&self) -> i32
pub fn boarding_cooldown(&self) -> i32
Returns the vanilla boarding cooldown in ticks.
Sourcepub(crate) fn remove_passenger_id(&self, passenger_id: i32) -> bool
pub(crate) fn remove_passenger_id(&self, passenger_id: i32) -> bool
Removes a direct passenger by entity ID.
Sourcepub fn stop_riding(&self)
pub fn stop_riding(&self)
Stops riding the current vehicle, if any.
Sourcepub(crate) fn restore_passenger_relationship(
vehicle: &SharedEntity,
passenger: &SharedEntity,
)
pub(crate) fn restore_passenger_relationship( vehicle: &SharedEntity, passenger: &SharedEntity, )
Restores a persisted passenger relationship without applying gameplay boarding rules.
Sourcepub(crate) fn start_riding_relationship(
vehicle: &SharedEntity,
passenger: &SharedEntity,
)
pub(crate) fn start_riding_relationship( vehicle: &SharedEntity, passenger: &SharedEntity, )
Starts a gameplay passenger relationship after vanilla boarding rules pass.
fn add_passenger_relationship(vehicle: &SharedEntity, passenger: &SharedEntity)
Sourcepub(crate) fn set_boarding_cooldown(&self, boarding_cooldown: i32)
pub(crate) fn set_boarding_cooldown(&self, boarding_cooldown: i32)
Sets the vanilla boarding cooldown in ticks.
Sourcepub fn advance_base_tick_state(&self)
pub fn advance_base_tick_state(&self)
Advances the base-tick movement and relationship state Steel currently implements.
Sourcefn clear_in_block_state_for_base_tick(&self)
fn clear_in_block_state_for_base_tick(&self)
Clears vanilla inBlockState at the start of base tick.
Sourcepub fn compute_known_speed(&self)
pub fn compute_known_speed(&self)
Computes vanilla lastKnownSpeed from the previous base-tick position.
fn decrement_boarding_cooldown(&self)
Sourcepub fn process_portal_cooldown(&self)
pub fn process_portal_cooldown(&self)
Advances vanilla portal cooldown by one server tick.
Sourcepub fn reset_for_player_respawn(&self, dimensions: EntityDimensions)
pub fn reset_for_player_respawn(&self, dimensions: EntityDimensions)
Resets state that vanilla gets from constructing a fresh player entity for death respawn.
Sourcepub(crate) fn reset_for_player_respawn_during_world_change(
&self,
dimensions: EntityDimensions,
pending_token: PendingWorldChangeToken,
)
pub(crate) fn reset_for_player_respawn_during_world_change( &self, dimensions: EntityDimensions, pending_token: PendingWorldChangeToken, )
Resets death-respawn state while retaining the relocation that owns admission.
fn reset_for_player_respawn_inner( &self, dimensions: EntityDimensions, pending_world_change: Option<PendingWorldChangeToken>, )
Sourcepub(crate) fn set_world(&self, world: Weak<World>)
pub(crate) fn set_world(&self, world: Weak<World>)
Updates the world reference used by this entity.
Sourcepub fn begin_pending_world_change(&self) -> Option<PendingWorldChangeToken>
pub fn begin_pending_world_change(&self) -> Option<PendingWorldChangeToken>
Marks this entity as waiting for a prepared world change.
Sourcepub(crate) fn begin_pending_player_respawn(
&self,
) -> Option<PendingWorldChangeToken>
pub(crate) fn begin_pending_player_respawn( &self, ) -> Option<PendingWorldChangeToken>
Marks a live or killed player as waiting for respawn preparation.
Killed players remain eligible because their async spawn search may need to be retried after the death animation removes their live entity.
Sourcepub fn finish_pending_world_change(
&self,
token: PendingWorldChangeToken,
) -> bool
pub fn finish_pending_world_change( &self, token: PendingWorldChangeToken, ) -> bool
Clears a pending world change if it still matches the provided token.
Sourcepub fn is_world_change_pending(&self) -> bool
pub fn is_world_change_pending(&self) -> bool
Returns true while this entity is waiting for a prepared world change.
Sourcepub fn is_world_change_token_pending(
&self,
token: PendingWorldChangeToken,
) -> bool
pub fn is_world_change_token_pending( &self, token: PendingWorldChangeToken, ) -> bool
Returns true if the given world-change token is still pending.
Sourcepub fn is_removed(&self) -> bool
pub fn is_removed(&self) -> bool
Returns true if the entity has been marked for removal.
Sourcepub fn removal_reason(&self) -> Option<RemovalReason>
pub fn removal_reason(&self) -> Option<RemovalReason>
Returns the reason this entity was removed, if it has been removed.
Sourcepub fn set_removed(&self, reason: RemovalReason)
pub fn set_removed(&self, reason: RemovalReason)
Marks the entity as removed with the given reason.
Notifies the level callback on first removal.
fn detach_from_relationships(&self, reason: RemovalReason)
fn stop_riding_relationship(&self)
fn eject_passenger_relationships(&self)
fn clear_vehicle_if(&self, vehicle_id: i32) -> bool
Sourcepub fn clear_removed(&self) -> bool
pub fn clear_removed(&self) -> bool
Clears the removed flag and returns whether the entity had been removed.
Steel reuses the same Player instance across respawn while vanilla
constructs a fresh ServerPlayer, so player respawn needs an explicit
way to reset this base lifecycle flag.
Sourcepub fn set_level_callback(&self, callback: Arc<dyn EntityLevelCallback>)
pub fn set_level_callback(&self, callback: Arc<dyn EntityLevelCallback>)
Sets the level callback for lifecycle events.
Sourcepub fn try_set_position(&self, pos: DVec3) -> Result<(), EntityMoveError>
pub fn try_set_position(&self, pos: DVec3) -> Result<(), EntityMoveError>
Sets the entity’s position through the active level callback.
Sourcepub(crate) fn set_position_local(&self, pos: DVec3)
pub(crate) fn set_position_local(&self, pos: DVec3)
Sets position without consulting world lifecycle callbacks.
Use this for construction, loading, proto-staged entities, and tests.
fn set_position_local_unchecked(&self, pos: DVec3)
Sourcepub fn set_old_position_to_current(&self)
pub fn set_old_position_to_current(&self)
Sets the vanilla movement-trace old position to the current position.
Sourcepub fn set_old_position(&self, old_position: DVec3)
pub fn set_old_position(&self, old_position: DVec3)
Sets the vanilla movement-trace old position explicitly.
Sourcepub fn set_old_rotation_to_current(&self)
pub fn set_old_rotation_to_current(&self)
Sets vanilla yRotO/xRotO to the current rotation.
Sourcepub fn set_old_yaw_to_current(&self)
pub fn set_old_yaw_to_current(&self)
Sets vanilla yRotO to the current yaw without changing xRotO.
Sourcepub fn set_old_rotation(&self, old_rotation: (f32, f32))
pub fn set_old_rotation(&self, old_rotation: (f32, f32))
Sets vanilla yRotO/xRotO explicitly.
Sourcepub fn record_movement_this_tick(&self, movement: EntityMovement)
pub fn record_movement_this_tick(&self, movement: EntityMovement)
Records a movement segment for vanilla block-contact effects.
Sourcepub fn remove_latest_movement_recording(&self)
pub fn remove_latest_movement_recording(&self)
Removes the latest movement segment recorded this tick.
Sourcepub fn clear_movement_this_tick(&self)
pub fn clear_movement_this_tick(&self)
Clears movement segments recorded for the current tick.
Sourcepub fn take_movements_for_block_effects(&self) -> Vec<EntityMovement>
pub fn take_movements_for_block_effects(&self) -> Vec<EntityMovement>
Takes and finalizes this tick’s movement segments for block-contact effects.
Sourcepub fn last_movements_for_block_effects(&self) -> Vec<EntityMovement>
pub fn last_movements_for_block_effects(&self) -> Vec<EntityMovement>
Returns the last finalized movement segments for vanilla block-contact effects.
Sourcepub fn set_bounding_box(&self, bounding_box: WorldAabb)
pub fn set_bounding_box(&self, bounding_box: WorldAabb)
Sets the entity’s bounding box directly.
Use this for vanilla entities whose box is not simply dimensions centered on the entity position.
Sourcepub fn set_pose_and_dimensions(
&self,
pose: EntityPose,
dimensions: EntityDimensions,
)
pub fn set_pose_and_dimensions( &self, pose: EntityPose, dimensions: EntityDimensions, )
Sets pose and dimensions, then rebuilds the default position-centered box.
fn notify_bounding_box_changed(&self, bounding_box: WorldAabb)
Sourcepub fn set_velocity(&self, velocity: DVec3)
pub fn set_velocity(&self, velocity: DVec3)
Sets the entity’s velocity in blocks per tick.
Sourcepub fn advance_tick_count(&self)
pub fn advance_tick_count(&self)
Advances vanilla Entity.tickCount by one tick.
Sourcepub fn record_movement_progress(
&self,
clipped_movement: DVec3,
climbing: bool,
) -> EntityMovementProgress
pub fn record_movement_progress( &self, clipped_movement: DVec3, climbing: bool, ) -> EntityMovementProgress
Records movement distance used by vanilla step, swim, and flap effects.
Sourcepub fn set_next_step(&self, next_step: f32)
pub fn set_next_step(&self, next_step: f32)
Stores vanilla nextStep after a produced movement side effect.
Sourcepub fn amethyst_step_sound(
&self,
tick_count: i32,
) -> Option<EntityAmethystStepSound>
pub fn amethyst_step_sound( &self, tick_count: i32, ) -> Option<EntityAmethystStepSound>
Returns vanilla amethyst-step chime parameters when the cooldown allows it.
Sourcepub fn set_rotation(&self, rotation: (f32, f32))
pub fn set_rotation(&self, rotation: (f32, f32))
Sets the entity’s rotation as (yaw, pitch) in degrees.
Sourcepub fn set_no_physics(&self, no_physics: bool)
pub fn set_no_physics(&self, no_physics: bool)
Sets whether this entity bypasses collision physics.
Sourcepub fn set_air_supply(&self, air_supply: i32)
pub fn set_air_supply(&self, air_supply: i32)
Sets the synchronized vanilla Air value.
Sourcepub fn set_portal_cooldown(&self, portal_cooldown: i32)
pub fn set_portal_cooldown(&self, portal_cooldown: i32)
Sets the vanilla portal cooldown in ticks.
Sourcepub fn set_as_inside_portal(&self, portal: PortalKind, entry_position: BlockPos)
pub fn set_as_inside_portal(&self, portal: PortalKind, entry_position: BlockPos)
Marks this entity as inside a vanilla portal during the current tick.
Sourcepub fn process_portal_teleportation(
&self,
allowed_to_teleport: bool,
transition_time: i32,
) -> Option<PortalProcessResult>
pub fn process_portal_teleportation( &self, allowed_to_teleport: bool, transition_time: i32, ) -> Option<PortalProcessResult>
Advances the active vanilla portal process, if one exists.
Sourcepub fn clear_portal_process(&self)
pub fn clear_portal_process(&self)
Clears the active vanilla portal process.
Sourcepub fn set_no_gravity(&self, no_gravity: bool)
pub fn set_no_gravity(&self, no_gravity: bool)
Sets the shared vanilla NoGravity flag.
Sourcepub fn set_invulnerable(&self, invulnerable: bool)
pub fn set_invulnerable(&self, invulnerable: bool)
Sets the shared vanilla Invulnerable flag.
Sourcepub fn set_custom_name(&self, custom_name: Option<TextComponent>)
pub fn set_custom_name(&self, custom_name: Option<TextComponent>)
Sets the optional vanilla custom name.
Sourcepub fn set_custom_name_visible(&self, visible: bool)
pub fn set_custom_name_visible(&self, visible: bool)
Sets the vanilla custom-name visibility flag.
Sourcepub fn set_silent(&self, silent: bool)
pub fn set_silent(&self, silent: bool)
Sets the synchronized vanilla silent flag.
Sourcepub fn set_glowing(&self, glowing: bool)
pub fn set_glowing(&self, glowing: bool)
Sets the server-owned vanilla glowing tag flag.
Sourcepub fn remove_tag(&self, tag: &str) -> bool
pub fn remove_tag(&self, tag: &str) -> bool
Removes a vanilla scoreboard tag.
Sourcepub fn set_custom_data(&self, custom_data: NbtCompound)
pub fn set_custom_data(&self, custom_data: NbtCompound)
Replaces vanilla custom data.
Sourcepub fn mark_velocity_sync(&self)
pub fn mark_velocity_sync(&self)
Marks velocity for vanilla ServerEntity synchronization.
Sourcepub fn clear_velocity_sync(&self)
pub fn clear_velocity_sync(&self)
Clears the vanilla velocity sync marker after send processing.
Sourcepub fn clear_hurt_mark(&self)
pub fn clear_hurt_mark(&self)
Clears the vanilla hurt-marked motion sync flag.
Sourcepub fn set_fall_distance(&self, fall_distance: f64)
pub fn set_fall_distance(&self, fall_distance: f64)
Sets accumulated vanilla fall distance.
Sourcepub fn accumulate_fall_distance(&self, vertical_movement: f64)
pub fn accumulate_fall_distance(&self, vertical_movement: f64)
Adds vertical movement to accumulated fall distance using vanilla precision.
Sourcepub fn reset_fall_distance(&self)
pub fn reset_fall_distance(&self)
Resets accumulated vanilla fall distance.
Sourcepub fn remaining_fire_ticks(&self) -> i32
pub fn remaining_fire_ticks(&self) -> i32
Returns vanilla remainingFireTicks.
Sourcepub fn set_remaining_fire_ticks(&self, remaining_fire_ticks: i32)
pub fn set_remaining_fire_ticks(&self, remaining_fire_ticks: i32)
Sets vanilla remainingFireTicks.
Sourcepub fn ticks_frozen(&self) -> i32
pub fn ticks_frozen(&self) -> i32
Returns synchronized vanilla TicksFrozen.
Sourcepub fn set_ticks_frozen(&self, ticks_frozen: i32)
pub fn set_ticks_frozen(&self, ticks_frozen: i32)
Sets synchronized vanilla TicksFrozen.
Sourcepub fn is_in_powder_snow(&self) -> bool
pub fn is_in_powder_snow(&self) -> bool
Returns whether the entity touched powder snow during the current tick.
Sourcepub fn was_in_powder_snow(&self) -> bool
pub fn was_in_powder_snow(&self) -> bool
Returns whether the entity touched powder snow during the previous tick.
Sourcepub fn set_visual_fire(&self, has_visual_fire: bool)
pub fn set_visual_fire(&self, has_visual_fire: bool)
Sets vanilla hasVisualFire.
Sourcepub fn has_visual_fire(&self) -> bool
pub fn has_visual_fire(&self) -> bool
Returns vanilla hasVisualFire.
Sourcepub fn is_on_fire(&self, fire_immune: bool) -> bool
pub fn is_on_fire(&self, fire_immune: bool) -> bool
Returns whether the entity is on fire on the server.
Sourcepub fn is_freezing(&self) -> bool
pub fn is_freezing(&self) -> bool
Returns whether the entity is freezing.
Sourcepub fn is_fully_frozen(&self, ticks_required_to_freeze: i32) -> bool
pub fn is_fully_frozen(&self, ticks_required_to_freeze: i32) -> bool
Returns whether the entity has reached full-freeze duration.
Sourcepub fn advance_powder_snow_contact_for_base_tick(&self)
pub fn advance_powder_snow_contact_for_base_tick(&self)
Advances vanilla powder-snow contact at the start of base tick.
Sourcepub fn advance_fire_tick(&self, fire_immune: bool, in_lava: bool) -> bool
pub fn advance_fire_tick(&self, fire_immune: bool, in_lava: bool) -> bool
Advances vanilla server-side fire tick state.
Returns true when the caller should apply one tick of on-fire damage.
Sourcepub fn clear_freeze(&self)
pub fn clear_freeze(&self)
Clears accumulated freezing.
Sourcepub fn clear_fire(&self)
pub fn clear_fire(&self)
Clears fire without resetting the vanilla fire immunity cooldown.
Sourcepub fn ignite_for_ticks(
&self,
number_of_ticks: i32,
remaining_fire_ticks_cap: Option<i32>,
)
pub fn ignite_for_ticks( &self, number_of_ticks: i32, remaining_fire_ticks_cap: Option<i32>, )
Ignites this entity for a vanilla tick duration.
Sourcepub fn apply_inside_block_effect(
&self,
effect_type: InsideBlockEffectType,
can_freeze: bool,
fire_immune: bool,
fire_ignite_extra_ticks: i32,
ticks_required_to_freeze: i32,
remaining_fire_ticks_cap: Option<i32>,
)
pub fn apply_inside_block_effect( &self, effect_type: InsideBlockEffectType, can_freeze: bool, fire_immune: bool, fire_ignite_extra_ticks: i32, ticks_required_to_freeze: i32, remaining_fire_ticks_cap: Option<i32>, )
Applies a vanilla inside-block effect to base fire/freeze state.
fn apply_fire_ignite( fire_freeze: &mut EntityFireFreezeState, fire_immune: bool, fire_ignite_extra_ticks: i32, remaining_fire_ticks_cap: Option<i32>, )
fn ignite_for_ticks_in_state( fire_freeze: &mut EntityFireFreezeState, number_of_ticks: i32, remaining_fire_ticks_cap: Option<i32>, )
fn set_remaining_fire_ticks_in_state( fire_freeze: &mut EntityFireFreezeState, remaining_fire_ticks: i32, remaining_fire_ticks_cap: Option<i32>, )
fn cap_remaining_fire_ticks( remaining_fire_ticks: i32, remaining_fire_ticks_cap: Option<i32>, ) -> i32
Sourcepub fn dampen_fall_distance_in_lava(&self)
pub fn dampen_fall_distance_in_lava(&self)
Applies vanilla base-tick fall-distance damping while touching lava.
Sourcepub fn reset_fall_distance_in_water(&self)
pub fn reset_fall_distance_in_water(&self)
Applies vanilla fluid-interaction fall-distance reset while touching water.
Sourcepub fn set_on_ground(&self, on_ground: bool)
pub fn set_on_ground(&self, on_ground: bool)
Sets whether this entity is touching the ground.
Sourcepub fn set_movement_flags(
&self,
movement_flags: EntityMovementFlags,
ground_contact: EntityGroundContact,
)
pub fn set_movement_flags( &self, movement_flags: EntityMovementFlags, ground_contact: EntityGroundContact, )
Sets all vanilla movement flags after Entity.move.
Sourcepub fn set_ground_contact(&self, ground_contact: EntityGroundContact)
pub fn set_ground_contact(&self, ground_contact: EntityGroundContact)
Stores the current vanilla supporting-block snapshot.
Sourcepub fn set_fluid_contact(&self, fluid_contact: EntityFluidContact)
pub fn set_fluid_contact(&self, fluid_contact: EntityFluidContact)
Stores the current vanilla fluid contact snapshot.
Sourcepub fn set_fluid_contact_for_base_tick(&self, fluid_contact: EntityFluidContact)
pub fn set_fluid_contact_for_base_tick(&self, fluid_contact: EntityFluidContact)
Stores fluid contact for a vanilla base-tick refresh.
Vanilla updates wasEyeInWater from the previous fluid interaction
before scanning the current one.
Sourcepub fn set_on_ground_with_movement(
&self,
on_ground: bool,
horizontal_collision: bool,
ground_contact: EntityGroundContact,
)
pub fn set_on_ground_with_movement( &self, on_ground: bool, horizontal_collision: bool, ground_contact: EntityGroundContact, )
Sets ground and horizontal collision flags from an accepted client move.
Sourcepub fn clear_collision_flags(&self)
pub fn clear_collision_flags(&self)
Clears collision flags after a no-physics move.
Sourcepub fn limit_piston_movement(
&self,
movement: DVec3,
current_game_time: i64,
) -> DVec3
pub fn limit_piston_movement( &self, movement: DVec3, current_game_time: i64, ) -> DVec3
Applies vanilla per-tick piston movement accumulation.
Sourcepub fn make_stuck_in_block(&self, speed_multiplier: DVec3)
pub fn make_stuck_in_block(&self, speed_multiplier: DVec3)
Sets the speed multiplier used for the next stuck-in-block movement pass.
Sourcepub fn consume_stuck_speed_multiplier(
&self,
movement: DVec3,
apply_multiplier: bool,
) -> DVec3
pub fn consume_stuck_speed_multiplier( &self, movement: DVec3, apply_multiplier: bool, ) -> DVec3
Applies and clears vanilla stuck-in-block speed state.
Auto Trait Implementations§
impl !Freeze for EntityBase
impl !RefUnwindSafe for EntityBase
impl !UnwindSafe for EntityBase
impl Send for EntityBase
impl Sync for EntityBase
impl Unpin for EntityBase
impl UnsafeUnpin for EntityBase
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreArc<SyncMutex<>>