aboutsummaryrefslogtreecommitdiff
path: root/azalea-entity/src/mining.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-10-10 23:21:23 -0500
committermat <git@matdoes.dev>2023-10-10 23:21:23 -0500
commit9a687f0ffebad80441e036aabe14e7cf80c774d3 (patch)
tree2f6ad5a1a14cae23723550c934df395aab1733f6 /azalea-entity/src/mining.rs
parent0297b8aacee27d9e86cea781b3751591e32df401 (diff)
downloadazalea-drasl-9a687f0ffebad80441e036aabe14e7cf80c774d3.tar.xz
start adding mining to pathfinder
Diffstat (limited to 'azalea-entity/src/mining.rs')
-rw-r--r--azalea-entity/src/mining.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/azalea-entity/src/mining.rs b/azalea-entity/src/mining.rs
index a2f869cf..ee5c961b 100644
--- a/azalea-entity/src/mining.rs
+++ b/azalea-entity/src/mining.rs
@@ -4,6 +4,14 @@ use azalea_registry as registry;
use crate::{effects, enchantments, FluidOnEyes, Physics};
+/// How much progress is made towards mining the block per tick, as a
+/// percentage. If this is 1 then the block gets broken instantly.
+///
+/// You can divide 1 by this and then round up to get the number of ticks it
+/// takes to mine the block.
+///
+/// The player inventory is needed to check your armor and offhand for modifiers
+/// to your mining speed.
pub fn get_mine_progress(
block: &dyn Block,
held_item: registry::Item,
@@ -11,16 +19,6 @@ pub fn get_mine_progress(
fluid_on_eyes: &FluidOnEyes,
physics: &Physics,
) -> f32 {
- // public float getDestroyProgress(BlockState blockState, Player player,
- // BlockGetter world, BlockPos blockPos) { float destroySpeed =
- // blockState.getDestroySpeed(world, blockPos); if (destroySpeed ==
- // -1.0F) { return 0.0F;
- // } else {
- // int divider = player.hasCorrectToolForDrops(blockState) ? 30 : 100;
- // return player.getDestroySpeed(blockState) / destroySpeed /
- // (float)divider; }
- // }
-
let block_behavior: BlockBehavior = block.behavior();
let destroy_time = block_behavior.destroy_time;