diff options
| author | ShayBox <shaybox@shaybox.com> | 2025-10-30 12:14:19 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-30 11:14:19 -0500 |
| commit | 818f2d01d49e574946d1a704e1445156afc9c2fb (patch) | |
| tree | 4190ce61994e7d1280cbcd6b43811fa9f6b03b09 /azalea-entity/src/mining.rs | |
| parent | c7cc381fae569f3dfc9f2abe86c2c38d59b68cf2 (diff) | |
| download | azalea-drasl-818f2d01d49e574946d1a704e1445156afc9c2fb.tar.xz | |
Add support for mob effects (#269)
* Add support for mob effects
* Remove Option
* MobEffectFlags
* jump_boost_power f32
Diffstat (limited to 'azalea-entity/src/mining.rs')
| -rw-r--r-- | azalea-entity/src/mining.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/azalea-entity/src/mining.rs b/azalea-entity/src/mining.rs index cd526799..7c142020 100644 --- a/azalea-entity/src/mining.rs +++ b/azalea-entity/src/mining.rs @@ -2,7 +2,7 @@ use azalea_block::{BlockBehavior, BlockTrait}; use azalea_core::tier::get_item_tier; use azalea_registry as registry; -use crate::{FluidOnEyes, Physics, effects}; +use crate::{ActiveEffects, FluidOnEyes, Physics, effects}; /// How much progress is made towards mining the block per tick, as a /// percentage. @@ -20,6 +20,7 @@ pub fn get_mine_progress( player_inventory: &azalea_inventory::Menu, fluid_on_eyes: &FluidOnEyes, physics: &Physics, + active_effects: &ActiveEffects, ) -> f32 { let block_behavior: BlockBehavior = block.behavior(); @@ -39,6 +40,7 @@ pub fn get_mine_progress( player_inventory, fluid_on_eyes, physics, + active_effects, ); (base_destroy_speed / destroy_time) / divisor as f32 } @@ -82,6 +84,7 @@ fn destroy_speed( _player_inventory: &azalea_inventory::Menu, _fluid_on_eyes: &FluidOnEyes, physics: &Physics, + active_effects: &ActiveEffects, ) -> f32 { let mut base_destroy_speed = base_destroy_speed(block, tool); @@ -95,11 +98,13 @@ fn destroy_speed( // efficiency_level + 1) as f32; } // } - if let Some(dig_speed_amplifier) = effects::get_dig_speed_amplifier() { + if let Some(dig_speed_amplifier) = effects::get_dig_speed_amplifier(active_effects) { base_destroy_speed *= 1. + (dig_speed_amplifier + 1) as f32 * 0.2; } - if let Some(dig_slowdown) = effects::get_effect(registry::MobEffect::MiningFatigue) { + if let Some(dig_slowdown) = + effects::get_effect(active_effects, registry::MobEffect::MiningFatigue) + { let multiplier = match dig_slowdown { 0 => 0.3, 1 => 0.09, |
