aboutsummaryrefslogtreecommitdiff
path: root/azalea/src
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2024-11-28 03:17:58 +0000
committermat <git@matdoes.dev>2024-11-28 03:17:58 +0000
commitc36201cc894bcc99a06358eea31d210800980dae (patch)
tree03cf79c6e8ee6df5e3a1c198e218bc9de7c6f119 /azalea/src
parent08958c2278b15ebeac8a964f392ebb792e479b61 (diff)
downloadazalea-drasl-c36201cc894bcc99a06358eea31d210800980dae.tar.xz
change DataComponentPatch::get to take in a generic (and add get_kind, has, and has_kind)
Diffstat (limited to 'azalea/src')
-rw-r--r--azalea/src/auto_tool.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/azalea/src/auto_tool.rs b/azalea/src/auto_tool.rs
index 441f9791..1824e13c 100644
--- a/azalea/src/auto_tool.rs
+++ b/azalea/src/auto_tool.rs
@@ -1,7 +1,7 @@
use azalea_block::{Block, BlockState};
use azalea_client::{inventory::Inventory, Client};
use azalea_entity::{FluidOnEyes, Physics};
-use azalea_inventory::{ItemStack, Menu};
+use azalea_inventory::{components, ItemStack, Menu};
use azalea_registry::{DataComponentKind, Fluid};
#[derive(Debug)]
@@ -89,17 +89,13 @@ pub fn accurate_best_tool_in_hotbar_for_block(
physics,
));
}
- ItemStack::Present(item_slot) => {
+ ItemStack::Present(item_stack) => {
// lazy way to avoid checking durability since azalea doesn't have durability
// data yet
- if item_slot
- .components
- .get(DataComponentKind::Damage)
- .is_none()
- {
+ if !item_stack.components.has::<components::Damage>() {
this_item_speed = Some(azalea_entity::mining::get_mine_progress(
block.as_ref(),
- item_slot.kind,
+ item_stack.kind,
menu,
fluid_on_eyes,
physics,