aboutsummaryrefslogtreecommitdiff
path: root/azalea-entity/src
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-07-24 04:42:52 -0530
committermat <git@matdoes.dev>2025-07-24 04:42:52 -0530
commit302752860c7c10f02479727fe3d6d3b086177604 (patch)
tree5088f051ed9a2e816b17966513c6494e69626728 /azalea-entity/src
parent45f89b48e425262974a993adc0774dcbcad397fa (diff)
downloadazalea-drasl-302752860c7c10f02479727fe3d6d3b086177604.tar.xz
update movement code for 1.21.5 changes
fixes grim flags
Diffstat (limited to 'azalea-entity/src')
-rw-r--r--azalea-entity/src/attributes.rs3
-rw-r--r--azalea-entity/src/lib.rs5
2 files changed, 5 insertions, 3 deletions
diff --git a/azalea-entity/src/attributes.rs b/azalea-entity/src/attributes.rs
index 7af845f8..c2a22e9b 100644
--- a/azalea-entity/src/attributes.rs
+++ b/azalea-entity/src/attributes.rs
@@ -10,6 +10,7 @@ use thiserror::Error;
#[derive(Clone, Debug, Component)]
pub struct Attributes {
pub speed: AttributeInstance,
+ pub sneaking_speed: AttributeInstance,
pub attack_speed: AttributeInstance,
pub water_movement_efficiency: AttributeInstance,
@@ -92,7 +93,7 @@ pub enum AttributeModifierOperation {
pub fn sprinting_modifier() -> AttributeModifier {
AttributeModifier {
id: ResourceLocation::new("sprinting"),
- amount: 0.30000001192092896,
+ amount: 0.3f32 as f64,
operation: AttributeModifierOperation::MultiplyTotal,
}
}
diff --git a/azalea-entity/src/lib.rs b/azalea-entity/src/lib.rs
index 340b6f25..18e9e1a1 100644
--- a/azalea-entity/src/lib.rs
+++ b/azalea-entity/src/lib.rs
@@ -50,10 +50,10 @@ pub fn move_relative(
pub fn input_vector(direction: LookDirection, speed: f32, acceleration: Vec3) -> Vec3 {
let distance = acceleration.length_squared();
- if distance < 1.0E-7 {
+ if distance < 1.0e-7 {
return Vec3::ZERO;
}
- let acceleration = if distance > 1.0 {
+ let acceleration = if distance > 1. {
acceleration.normalize()
} else {
acceleration
@@ -492,6 +492,7 @@ pub fn default_attributes(_entity_kind: EntityKind) -> Attributes {
// entities have different defaults
Attributes {
speed: AttributeInstance::new(0.1),
+ sneaking_speed: AttributeInstance::new(0.3),
attack_speed: AttributeInstance::new(4.0),
water_movement_efficiency: AttributeInstance::new(0.0),
block_interaction_range: AttributeInstance::new(4.5),