pub trait EntityLevelCallback: Send + Sync {
// Required methods
fn validate_move(
&self,
old_pos: DVec3,
new_pos: DVec3,
) -> Result<(), EntityMoveError>;
fn on_move_committed(
&self,
old_pos: DVec3,
new_pos: DVec3,
) -> Result<(), EntityMoveError>;
fn on_remove(&self, reason: RemovalReason);
// Provided methods
fn allows_local_position_update(&self) -> bool { ... }
fn on_bounding_box_changed(&self, _bounding_box: WorldAabb) { ... }
}Expand description
Callback interface for entity lifecycle events.
Mirrors vanilla’s EntityInLevelCallback.
Required Methods§
Sourcefn validate_move(
&self,
old_pos: DVec3,
new_pos: DVec3,
) -> Result<(), EntityMoveError>
fn validate_move( &self, old_pos: DVec3, new_pos: DVec3, ) -> Result<(), EntityMoveError>
Called before an entity position change is committed.
Sourcefn on_move_committed(
&self,
old_pos: DVec3,
new_pos: DVec3,
) -> Result<(), EntityMoveError>
fn on_move_committed( &self, old_pos: DVec3, new_pos: DVec3, ) -> Result<(), EntityMoveError>
Called after an entity position change has been committed.
Sourcefn on_remove(&self, reason: RemovalReason)
fn on_remove(&self, reason: RemovalReason)
Called when entity is removed from the world.
Provided Methods§
Sourcefn allows_local_position_update(&self) -> bool
fn allows_local_position_update(&self) -> bool
Returns whether direct local position writes may bypass lifecycle callbacks.
Sourcefn on_bounding_box_changed(&self, _bounding_box: WorldAabb)
fn on_bounding_box_changed(&self, _bounding_box: WorldAabb)
Called after an entity’s collision bounds change without a position change.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".