aboutsummaryrefslogtreecommitdiff
path: root/azalea-entity/src/attributes.rs
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-entity/src/attributes.rs')
-rw-r--r--azalea-entity/src/attributes.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/azalea-entity/src/attributes.rs b/azalea-entity/src/attributes.rs
index 97b890dc..18bbc348 100644
--- a/azalea-entity/src/attributes.rs
+++ b/azalea-entity/src/attributes.rs
@@ -13,6 +13,7 @@ use uuid::{uuid, Uuid};
#[derive(Clone, Debug, Component)]
pub struct Attributes {
pub speed: AttributeInstance,
+ pub attack_speed: AttributeInstance,
}
#[derive(Clone, Debug)]
@@ -92,6 +93,24 @@ pub fn sprinting_modifier() -> AttributeModifier {
}
}
+pub static BASE_ATTACK_SPEED_UUID: Uuid = uuid!("FA233E1C-4180-4865-B01B-BCCE9785ACA3");
+pub fn weapon_attack_speed_modifier(amount: f64) -> AttributeModifier {
+ AttributeModifier {
+ uuid: BASE_ATTACK_SPEED_UUID,
+ name: "Weapon modifier".to_string(),
+ amount,
+ operation: AttributeModifierOperation::Addition,
+ }
+}
+pub fn tool_attack_speed_modifier(amount: f64) -> AttributeModifier {
+ AttributeModifier {
+ uuid: BASE_ATTACK_SPEED_UUID,
+ name: "Tool modifier".to_string(),
+ amount,
+ operation: AttributeModifierOperation::Addition,
+ }
+}
+
impl McBufReadable for AttributeModifier {
fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
let uuid = Uuid::read_from(buf)?;