From 7405427199e5a994d4a6a706f84434a69cb7a7d9 Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Fri, 14 Jul 2023 22:20:40 -0500 Subject: Mining (#95) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * more mining stuff * initialize azalea-tags crate * more mining stuff 2 * mining in ecs * well technically mining works but no codegen for how long it takes to mine each block yet * rename downloads to __cache__ it was bothering me since it's not *just* downloads * codegen block behavior * fix not sending packet to finish breaking block * mining animation 🎉 * clippy * cleanup, move Client::mine into a client extension * add azalea/src/mining.rs --------- Co-authored-by: mat --- azalea-entity/src/effects.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 azalea-entity/src/effects.rs (limited to 'azalea-entity/src/effects.rs') diff --git a/azalea-entity/src/effects.rs b/azalea-entity/src/effects.rs new file mode 100644 index 00000000..9cc750e5 --- /dev/null +++ b/azalea-entity/src/effects.rs @@ -0,0 +1,26 @@ +// TODO + +// pub struct ActiveEffects(HashMap); + +/// Returns the level of the given effect, or `None` if the effect is not +/// active. The lowest level is 0. +pub fn get_effect(_effect: azalea_registry::MobEffect) -> Option { + // TODO + None +} + +pub fn get_dig_speed_amplifier() -> Option { + let effect_plus_one = u32::max( + get_effect(azalea_registry::MobEffect::Haste) + .map(|x| x + 1) + .unwrap_or_default(), + get_effect(azalea_registry::MobEffect::ConduitPower) + .map(|x| x + 1) + .unwrap_or_default(), + ); + if effect_plus_one > 0 { + Some(effect_plus_one - 1) + } else { + None + } +} -- cgit v1.2.3