diff options
| author | mat <git@matdoes.dev> | 2026-01-04 02:11:39 +0100 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2026-01-03 18:42:16 -0630 |
| commit | 57394c07a5de53061f868c131b42007707a2d7f1 (patch) | |
| tree | 343f07a2cfb556ee7d1383376946b294dce28a5a | |
| parent | a4a63ead6e00a645899bf87deea4ec94a66703f3 (diff) | |
| download | azalea-drasl-57394c07a5de53061f868c131b42007707a2d7f1.tar.xz | |
fix incorrect attack cooldowns for tools
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | azalea-client/src/plugins/interact/mod.rs | 69 | ||||
| -rw-r--r-- | azalea/examples/testbot/commands/debug.rs | 8 |
3 files changed, 8 insertions, 70 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 99e30e83..75e3d961 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ is breaking anyways, semantic versioning is not followed. ### Fixed - Serializing `FormattedText` with serde was writing `extra` twice. +- Attack cooldowns were being applied incorrectly for tools. ## [0.15.0+mc1.21.11] - 2025-12-18 diff --git a/azalea-client/src/plugins/interact/mod.rs b/azalea-client/src/plugins/interact/mod.rs index d2a4ef44..4f07c280 100644 --- a/azalea-client/src/plugins/interact/mod.rs +++ b/azalea-client/src/plugins/interact/mod.rs @@ -55,12 +55,7 @@ impl Plugin for InteractPlugin { .add_systems( Update, ( - ( - update_attributes_for_held_item, - update_attributes_for_gamemode, - ) - .in_set(UpdateAttributesSystems) - .chain(), + update_attributes_for_gamemode, handle_start_use_item_event, update_hit_result_component .after(clamp_look_direction) @@ -81,9 +76,6 @@ impl Plugin for InteractPlugin { } } -#[derive(Clone, Debug, Eq, Hash, PartialEq, SystemSet)] -pub struct UpdateAttributesSystems; - /// A component that contains information about our local block state /// predictions. #[derive(Clone, Component, Debug, Default)] @@ -465,65 +457,6 @@ pub fn handle_swing_arm_trigger(swing_arm: On<SwingArmEvent>, mut commands: Comm } #[allow(clippy::type_complexity)] -fn update_attributes_for_held_item( - mut query: Query<(&mut Attributes, &Inventory), (With<LocalEntity>, Changed<Inventory>)>, -) { - for (mut attributes, inventory) in &mut query { - let held_item = inventory.held_item(); - - let added_attack_speed = added_attack_speed_for_item(held_item.kind()); - attributes - .attack_speed - .insert(azalea_entity::attributes::base_attack_speed_modifier( - added_attack_speed, - )); - } -} - -fn added_attack_speed_for_item(item: ItemKind) -> f64 { - match item { - ItemKind::WoodenSword => -2.4, - ItemKind::WoodenShovel => -3.0, - ItemKind::WoodenPickaxe => -2.8, - ItemKind::WoodenAxe => -3.2, - ItemKind::WoodenHoe => -3.0, - - ItemKind::StoneSword => -2.4, - ItemKind::StoneShovel => -3.0, - ItemKind::StonePickaxe => -2.8, - ItemKind::StoneAxe => -3.2, - ItemKind::StoneHoe => -2.0, - - ItemKind::GoldenSword => -2.4, - ItemKind::GoldenShovel => -3.0, - ItemKind::GoldenPickaxe => -2.8, - ItemKind::GoldenAxe => -3.0, - ItemKind::GoldenHoe => -3.0, - - ItemKind::IronSword => -2.4, - ItemKind::IronShovel => -3.0, - ItemKind::IronPickaxe => -2.8, - ItemKind::IronAxe => -3.1, - ItemKind::IronHoe => -1.0, - - ItemKind::DiamondSword => -2.4, - ItemKind::DiamondShovel => -3.0, - ItemKind::DiamondPickaxe => -2.8, - ItemKind::DiamondAxe => -3.0, - ItemKind::DiamondHoe => 0.0, - - ItemKind::NetheriteSword => -2.4, - ItemKind::NetheriteShovel => -3.0, - ItemKind::NetheritePickaxe => -2.8, - ItemKind::NetheriteAxe => -3.0, - ItemKind::NetheriteHoe => 0.0, - - ItemKind::Trident => -2.9, - _ => 0., - } -} - -#[allow(clippy::type_complexity)] fn update_attributes_for_gamemode( query: Query<(&mut Attributes, &LocalGameMode), (With<LocalEntity>, Changed<LocalGameMode>)>, ) { diff --git a/azalea/examples/testbot/commands/debug.rs b/azalea/examples/testbot/commands/debug.rs index 36c699a4..c1837f97 100644 --- a/azalea/examples/testbot/commands/debug.rs +++ b/azalea/examples/testbot/commands/debug.rs @@ -10,11 +10,15 @@ use azalea::{ pathfinder::{ExecutingPath, Pathfinder}, }; use azalea_core::hit_result::HitResult; -use azalea_entity::{EntityKindComponent, metadata}; +use azalea_entity::{EntityKindComponent, LocalEntity, metadata}; use azalea_inventory::components::MaxStackSize; use azalea_world::InstanceContainer; use bevy_app::AppExit; -use bevy_ecs::{message::Messages, query::With, world::EntityRef}; +use bevy_ecs::{ + message::Messages, + query::{With, Without}, + world::EntityRef, +}; use parking_lot::Mutex; use super::{CommandSource, Ctx}; |
