pub trait ExplosionDamageCalculator: Send + Sync {
// Provided methods
fn block_explosion_resistance(
&self,
_explosion: &dyn Explosion,
_world: &World,
_pos: BlockPos,
state: BlockStateId,
fluid: FluidState,
) -> Option<f32> { ... }
fn should_block_explode(
&self,
_explosion: &dyn Explosion,
_world: &World,
_pos: BlockPos,
_state: BlockStateId,
_power: f32,
) -> bool { ... }
fn should_damage_entity(
&self,
_explosion: &dyn Explosion,
_entity: &dyn Entity,
) -> bool { ... }
fn knockback_multiplier(&self, _entity: &dyn Entity) -> f32 { ... }
fn entity_damage_amount(
&self,
explosion: &dyn Explosion,
entity: &dyn Entity,
exposure: f32,
) -> f32 { ... }
}Expand description
Customizable Vanilla explosion resistance, damage, and knockback policy.
Provided Methods§
Sourcefn block_explosion_resistance(
&self,
_explosion: &dyn Explosion,
_world: &World,
_pos: BlockPos,
state: BlockStateId,
fluid: FluidState,
) -> Option<f32>
fn block_explosion_resistance( &self, _explosion: &dyn Explosion, _world: &World, _pos: BlockPos, state: BlockStateId, fluid: FluidState, ) -> Option<f32>
Returns the effective resistance at an affected block position.
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
Returns whether the current ray may affect this block position.
Sourcefn should_damage_entity(
&self,
_explosion: &dyn Explosion,
_entity: &dyn Entity,
) -> bool
fn should_damage_entity( &self, _explosion: &dyn Explosion, _entity: &dyn Entity, ) -> bool
Returns whether the explosion damages this entity.
Sourcefn knockback_multiplier(&self, _entity: &dyn Entity) -> f32
fn knockback_multiplier(&self, _entity: &dyn Entity) -> f32
Returns the multiplier applied to this entity’s explosion knockback.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".