aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/plugins/interact
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2026-01-04 02:11:39 +0100
committermat <git@matdoes.dev>2026-01-03 18:42:16 -0630
commit57394c07a5de53061f868c131b42007707a2d7f1 (patch)
tree343f07a2cfb556ee7d1383376946b294dce28a5a /azalea-client/src/plugins/interact
parenta4a63ead6e00a645899bf87deea4ec94a66703f3 (diff)
downloadazalea-drasl-57394c07a5de53061f868c131b42007707a2d7f1.tar.xz
fix incorrect attack cooldowns for tools
Diffstat (limited to 'azalea-client/src/plugins/interact')
-rw-r--r--azalea-client/src/plugins/interact/mod.rs69
1 files changed, 1 insertions, 68 deletions
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>)>,
) {