From c36201cc894bcc99a06358eea31d210800980dae Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 28 Nov 2024 03:17:58 +0000 Subject: change DataComponentPatch::get to take in a generic (and add get_kind, has, and has_kind) --- azalea/src/auto_tool.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'azalea/src') 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::() { this_item_speed = Some(azalea_entity::mining::get_mine_progress( block.as_ref(), - item_slot.kind, + item_stack.kind, menu, fluid_on_eyes, physics, -- cgit v1.2.3