aboutsummaryrefslogtreecommitdiff
path: root/azalea/src/pathfinder/mining.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2024-12-24 09:40:29 +0000
committermat <git@matdoes.dev>2024-12-24 09:40:29 +0000
commita599b5614e6acf65e552940fff99a9252a600472 (patch)
treecf686191747a389f963b633a0898940cba594d13 /azalea/src/pathfinder/mining.rs
parentf03e0c22355778a9863cccb5a59d852278d60701 (diff)
downloadazalea-drasl-a599b5614e6acf65e552940fff99a9252a600472.tar.xz
make BlockState a u16 and add a BlockStateIntegerRepr type
Diffstat (limited to 'azalea/src/pathfinder/mining.rs')
-rw-r--r--azalea/src/pathfinder/mining.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/azalea/src/pathfinder/mining.rs b/azalea/src/pathfinder/mining.rs
index 049e974a..62963306 100644
--- a/azalea/src/pathfinder/mining.rs
+++ b/azalea/src/pathfinder/mining.rs
@@ -1,7 +1,6 @@
use std::{cell::UnsafeCell, ops::RangeInclusive};
-use azalea_block::{properties::Waterlogged, BlockState, BlockStates};
-use azalea_core::bitset::BitSet;
+use azalea_block::{properties::Waterlogged, BlockState, BlockStateIntegerRepr, BlockStates};
use azalea_inventory::Menu;
use nohash_hasher::IntMap;
@@ -9,11 +8,11 @@ use super::costs::BLOCK_BREAK_ADDITIONAL_PENALTY;
use crate::auto_tool::best_tool_in_hotbar_for_block;
pub struct MiningCache {
- block_state_id_costs: UnsafeCell<IntMap<u32, f32>>,
+ block_state_id_costs: UnsafeCell<IntMap<BlockStateIntegerRepr, f32>>,
inventory_menu: Option<Menu>,
- water_block_state_range: RangeInclusive<u32>,
- lava_block_state_range: RangeInclusive<u32>,
+ water_block_state_range: RangeInclusive<BlockStateIntegerRepr>,
+ lava_block_state_range: RangeInclusive<BlockStateIntegerRepr>,
falling_blocks: Vec<BlockState>,
}
@@ -23,16 +22,16 @@ impl MiningCache {
let water_block_states = BlockStates::from(azalea_registry::Block::Water);
let lava_block_states = BlockStates::from(azalea_registry::Block::Lava);
- let mut water_block_state_range_min = u32::MAX;
- let mut water_block_state_range_max = u32::MIN;
+ let mut water_block_state_range_min = BlockStateIntegerRepr::MAX;
+ let mut water_block_state_range_max = BlockStateIntegerRepr::MIN;
for state in water_block_states {
water_block_state_range_min = water_block_state_range_min.min(state.id);
water_block_state_range_max = water_block_state_range_max.max(state.id);
}
let water_block_state_range = water_block_state_range_min..=water_block_state_range_max;
- let mut lava_block_state_range_min = u32::MAX;
- let mut lava_block_state_range_max = u32::MIN;
+ let mut lava_block_state_range_min = BlockStateIntegerRepr::MAX;
+ let mut lava_block_state_range_max = BlockStateIntegerRepr::MIN;
for state in lava_block_states {
lava_block_state_range_min = lava_block_state_range_min.min(state.id);
lava_block_state_range_max = lava_block_state_range_max.max(state.id);