Skip to main content

Fallable

Trait Fallable 

Source
pub trait Fallable: Send + Sync {
    // Provided methods
    fn on_land(
        &self,
        _world: &Arc<World>,
        _pos: BlockPos,
        _state: BlockStateId,
        _replaced_state: BlockStateId,
        _entity: &FallingBlockEntity,
    ) { ... }
    fn on_broken_after_fall(
        &self,
        _world: &Arc<World>,
        _pos: BlockPos,
        _entity: &FallingBlockEntity,
    ) { ... }
    fn get_fall_damage_source(
        &self,
        entity: &FallingBlockEntity,
    ) -> DamageSource { ... }
    fn is_concrete_powder(&self) -> bool { ... }
}
Expand description

Shared behavior exposed by blocks implementing vanilla’s Fallable interface.

Falling entities use this capability for landing, failed-placement, and damage-source callbacks without depending on one concrete Rust block type.

Provided Methods§

Source

fn on_land( &self, _world: &Arc<World>, _pos: BlockPos, _state: BlockStateId, _replaced_state: BlockStateId, _entity: &FallingBlockEntity, )

Called after a falling entity successfully places its carried state.

Source

fn on_broken_after_fall( &self, _world: &Arc<World>, _pos: BlockPos, _entity: &FallingBlockEntity, )

Called when a falling entity breaks instead of placing its carried state.

Source

fn get_fall_damage_source(&self, entity: &FallingBlockEntity) -> DamageSource

Returns the damage source used when this falling block hurts entities.

Source

fn is_concrete_powder(&self) -> bool

Returns whether this behavior is in vanilla’s ConcretePowderBlock hierarchy.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§