aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src/packets/common.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-protocol/src/packets/common.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-protocol/src/packets/common.rs')
-rw-r--r--azalea-protocol/src/packets/common.rs24
1 files changed, 6 insertions, 18 deletions
diff --git a/azalea-protocol/src/packets/common.rs b/azalea-protocol/src/packets/common.rs
index fcbf0b05..eb377683 100644
--- a/azalea-protocol/src/packets/common.rs
+++ b/azalea-protocol/src/packets/common.rs
@@ -4,7 +4,7 @@ use azalea_core::{
game_type::{GameMode, OptionalGameType},
identifier::Identifier,
position::GlobalPos,
- registry_holder::{DimensionTypeElement, RegistryHolder},
+ registry_holder::{RegistryHolder, dimension_type::DimensionTypeElement},
};
use tracing::error;
@@ -24,27 +24,15 @@ pub struct CommonPlayerSpawnInfo {
pub sea_level: i32,
}
impl CommonPlayerSpawnInfo {
- pub fn dimension_type(
+ pub fn dimension_type<'a>(
&self,
- registry_holder: &RegistryHolder,
- ) -> Option<(Identifier, DimensionTypeElement)> {
- let dimension_res = self
- .dimension_type
- .resolve_and_deserialize::<DimensionTypeElement>(registry_holder);
- let Some(dimension_res) = dimension_res else {
+ registry_holder: &'a RegistryHolder,
+ ) -> Option<(&'a Identifier, &'a DimensionTypeElement)> {
+ let dimension_res = self.dimension_type.resolve(registry_holder);
+ let Some((dimension_type, dimension_data)) = dimension_res else {
error!("Couldn't resolve dimension_type {:?}", self.dimension_type);
return None;
};
- let (dimension_type, dimension_data) = match dimension_res {
- Ok(d) => d,
- Err(err) => {
- error!(
- "Couldn't deserialize dimension_type {:?}: {err:?}",
- self.dimension_type
- );
- return None;
- }
- };
Some((dimension_type, dimension_data))
}