aboutsummaryrefslogtreecommitdiff
path: root/azalea-entity/src/lib.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2025-12-09 13:29:59 -0600
committerGitHub <noreply@github.com>2025-12-09 13:29:59 -0600
commit26d619c9a329087a23d6577ee74bd764f50cd773 (patch)
tree8020fe902257764a23a445c6ed9987ea4848189d /azalea-entity/src/lib.rs
parent84cd261118c9d1e3145d4d1751c0d22098cd8cd8 (diff)
downloadazalea-drasl-26d619c9a329087a23d6577ee74bd764f50cd773.tar.xz
Enchantments (#286)
* start implementing enchants * store parsed registries * more work on enchants * implement deserializer for some entity effects * mostly working definitions for enchants * fix tests * detect equipment changes * fix errors * update changelog * fix some imports * remove outdated todo * add basic test for enchants applying attributes * use git simdnbt
Diffstat (limited to 'azalea-entity/src/lib.rs')
-rw-r--r--azalea-entity/src/lib.rs29
1 files changed, 16 insertions, 13 deletions
diff --git a/azalea-entity/src/lib.rs b/azalea-entity/src/lib.rs
index 927b4637..84e1c9f7 100644
--- a/azalea-entity/src/lib.rs
+++ b/azalea-entity/src/lib.rs
@@ -4,7 +4,7 @@ pub mod attributes;
mod data;
pub mod dimensions;
mod effects;
-mod enchantments;
+pub mod inventory;
pub mod metadata;
pub mod mining;
pub mod particle;
@@ -511,7 +511,7 @@ impl EntityBundle {
dimensions,
direction: LookDirection::default(),
- attributes: default_attributes(EntityKind::Player),
+ attributes: Attributes::new(EntityKind::Player),
jumping: Jumping(false),
crouching: Crouching(false),
@@ -522,17 +522,20 @@ impl EntityBundle {
}
}
-pub fn default_attributes(_entity_kind: EntityKind) -> Attributes {
- // TODO: do the correct defaults for everything, some
- // entities have different defaults
- Attributes {
- movement_speed: AttributeInstance::new(0.1f32 as f64),
- 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),
- entity_interaction_range: AttributeInstance::new(3.0),
- step_height: AttributeInstance::new(0.6),
+impl Attributes {
+ pub fn new(_entity_kind: EntityKind) -> Self {
+ // TODO: do the correct defaults for everything, some
+ // entities have different defaults
+ Attributes {
+ movement_speed: AttributeInstance::new(0.1f32 as f64),
+ sneaking_speed: AttributeInstance::new(0.3),
+ attack_speed: AttributeInstance::new(4.0),
+ water_movement_efficiency: AttributeInstance::new(0.0),
+ mining_efficiency: AttributeInstance::new(0.0),
+ block_interaction_range: AttributeInstance::new(4.5),
+ entity_interaction_range: AttributeInstance::new(3.0),
+ step_height: AttributeInstance::new(0.6),
+ }
}
}