diff options
| author | mat <git@matdoes.dev> | 2025-11-13 12:34:47 +0930 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-11-13 07:04:52 +0400 |
| commit | fbaae39cdf9c5a7a34005a51a37b85f7cdd5ea00 (patch) | |
| tree | 3126fb34a4e0ac979a1103a8227a2b9a136c1553 /azalea-entity | |
| parent | a4312599f7c04709a92b7be238dcf577bafbb14f (diff) | |
| download | azalea-drasl-fbaae39cdf9c5a7a34005a51a37b85f7cdd5ea00.tar.xz | |
rename ResourceLocation to Identifier ahead of mojmap changes
Diffstat (limited to 'azalea-entity')
| -rw-r--r-- | azalea-entity/src/attributes.rs | 16 | ||||
| -rw-r--r-- | azalea-entity/src/lib.rs | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/azalea-entity/src/attributes.rs b/azalea-entity/src/attributes.rs index 75423746..ca02e639 100644 --- a/azalea-entity/src/attributes.rs +++ b/azalea-entity/src/attributes.rs @@ -3,7 +3,7 @@ use std::collections::{HashMap, hash_map}; use azalea_buf::AzBuf; -use azalea_core::resource_location::ResourceLocation; +use azalea_core::identifier::Identifier; use bevy_ecs::component::Component; use thiserror::Error; @@ -23,7 +23,7 @@ pub struct Attributes { #[derive(Clone, Debug)] pub struct AttributeInstance { pub base: f64, - modifiers_by_id: HashMap<ResourceLocation, AttributeModifier>, + modifiers_by_id: HashMap<Identifier, AttributeModifier>, // TODO: add cache } @@ -73,14 +73,14 @@ impl AttributeInstance { /// Remove the modifier with the given ID from this attribute, returning /// the previous modifier is present. - pub fn remove(&mut self, id: &ResourceLocation) -> Option<AttributeModifier> { + pub fn remove(&mut self, id: &Identifier) -> Option<AttributeModifier> { self.modifiers_by_id.remove(id) } } #[derive(Clone, Debug, AzBuf, PartialEq)] pub struct AttributeModifier { - pub id: ResourceLocation, + pub id: Identifier, pub amount: f64, pub operation: AttributeModifierOperation, } @@ -94,21 +94,21 @@ pub enum AttributeModifierOperation { pub fn sprinting_modifier() -> AttributeModifier { AttributeModifier { - id: ResourceLocation::new("sprinting"), + id: Identifier::new("sprinting"), amount: 0.3f32 as f64, operation: AttributeModifierOperation::AddMultipliedTotal, } } pub fn base_attack_speed_modifier(amount: f64) -> AttributeModifier { AttributeModifier { - id: ResourceLocation::new("base_attack_speed"), + id: Identifier::new("base_attack_speed"), amount, operation: AttributeModifierOperation::AddValue, } } pub fn creative_block_interaction_range_modifier() -> AttributeModifier { AttributeModifier { - id: ResourceLocation::new("creative_mode_block_range"), + id: Identifier::new("creative_mode_block_range"), amount: 0.5, operation: AttributeModifierOperation::AddValue, } @@ -116,7 +116,7 @@ pub fn creative_block_interaction_range_modifier() -> AttributeModifier { pub fn creative_entity_interaction_range_modifier() -> AttributeModifier { AttributeModifier { - id: ResourceLocation::new("creative_mode_entity_range"), + id: Identifier::new("creative_mode_entity_range"), amount: 2.0, operation: AttributeModifierOperation::AddValue, } diff --git a/azalea-entity/src/lib.rs b/azalea-entity/src/lib.rs index 1f9e426e..927b4637 100644 --- a/azalea-entity/src/lib.rs +++ b/azalea-entity/src/lib.rs @@ -22,9 +22,9 @@ use azalea_block::{BlockState, fluid_state::FluidKind}; use azalea_buf::AzBuf; use azalea_core::{ aabb::Aabb, + identifier::Identifier, math, position::{BlockPos, ChunkPos, Vec3}, - resource_location::ResourceLocation, }; use azalea_registry::EntityKind; use azalea_world::{ChunkStorage, InstanceName}; @@ -496,7 +496,7 @@ impl EntityBundle { uuid: Uuid, pos: Vec3, kind: azalea_registry::EntityKind, - world_name: ResourceLocation, + world_name: Identifier, ) -> Self { let dimensions = EntityDimensions::from(kind); |
