aboutsummaryrefslogtreecommitdiff
path: root/azalea-entity/src/effects.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2023-07-14 22:20:40 -0500
committerGitHub <noreply@github.com>2023-07-14 22:20:40 -0500
commit7405427199e5a994d4a6a706f84434a69cb7a7d9 (patch)
treeca537e5d761bc053187d952fced0915c850b92aa /azalea-entity/src/effects.rs
parentd1afd02aa84e7b4450c1607277f078eb2a0f1bf3 (diff)
downloadazalea-drasl-7405427199e5a994d4a6a706f84434a69cb7a7d9.tar.xz
Mining (#95)
* 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 <git@matdoes.dev>
Diffstat (limited to 'azalea-entity/src/effects.rs')
-rw-r--r--azalea-entity/src/effects.rs26
1 files changed, 26 insertions, 0 deletions
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<azalea_registry::MobEffect, MobEffectData>);
+
+/// 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<u32> {
+ // TODO
+ None
+}
+
+pub fn get_dig_speed_amplifier() -> Option<u32> {
+ 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
+ }
+}