diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-12-09 13:29:59 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-09 13:29:59 -0600 |
| commit | 26d619c9a329087a23d6577ee74bd764f50cd773 (patch) | |
| tree | 8020fe902257764a23a445c6ed9987ea4848189d /azalea-registry/src | |
| parent | 84cd261118c9d1e3145d4d1751c0d22098cd8cd8 (diff) | |
| download | azalea-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-registry/src')
| -rw-r--r-- | azalea-registry/src/lib.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/azalea-registry/src/lib.rs b/azalea-registry/src/lib.rs index 42950167..fd3fc3b5 100644 --- a/azalea-registry/src/lib.rs +++ b/azalea-registry/src/lib.rs @@ -20,6 +20,7 @@ pub use data::*; pub use extra::*; #[cfg(feature = "serde")] use serde::Serialize; +use simdnbt::{FromNbtTag, borrow::NbtTag}; pub trait Registry: AzaleaRead + AzaleaWrite where @@ -257,6 +258,19 @@ impl<R: Registry + Serialize, Direct: AzaleaRead + AzaleaWrite + Serialize> Seri } } +impl< + R: Registry + Serialize + FromNbtTag, + Direct: AzaleaRead + AzaleaWrite + Serialize + FromNbtTag, +> FromNbtTag for Holder<R, Direct> +{ + fn from_nbt_tag(tag: NbtTag) -> Option<Self> { + if let Some(reference) = R::from_nbt_tag(tag) { + return Some(Self::Reference(reference)); + }; + Direct::from_nbt_tag(tag).map(Self::Direct) + } +} + registry! { /// The AI code that's currently being executed for the entity. enum Activity { |
