diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2023-12-05 10:59:05 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-05 10:59:05 -0600 |
| commit | 7857a014b92e64361ee237ceae7ef1acc185ac46 (patch) | |
| tree | 5d70ea6b41943493873810e6a03c3483ff90a235 /azalea-chat/src/base_component.rs | |
| parent | ea3e8600126a58f5666d50fbf70dff8209d8979f (diff) | |
| download | azalea-drasl-7857a014b92e64361ee237ceae7ef1acc185ac46.tar.xz | |
1.20.3 (#110)
* 23w40a
* 23w41a
* 23w42a
* 23w43a
* 23w44a
* serialize FormattedText as nbt in network
* use azalea-nbt/serde in azalea-chat
* 23w45a
* fix 23w45a to compile
* handle Object in codegen
* 1.20.3-pre2
* remove unused clientbound_resource_pack_packet.rs
* merge main and make azalea-chat use simdnbt
* 1.20.3-rc1
* fix tests
* use simdnbt 0.3
* fix ServerboundSetJigsawBlockPacket
* 1.20.3
Diffstat (limited to 'azalea-chat/src/base_component.rs')
| -rwxr-xr-x | azalea-chat/src/base_component.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/azalea-chat/src/base_component.rs b/azalea-chat/src/base_component.rs index dcc28ecc..8f70ecb7 100755 --- a/azalea-chat/src/base_component.rs +++ b/azalea-chat/src/base_component.rs @@ -19,6 +19,26 @@ impl BaseComponent { } } +#[cfg(feature = "simdnbt")] +impl simdnbt::Serialize for BaseComponent { + fn to_compound(self) -> simdnbt::owned::NbtCompound { + let mut compound = simdnbt::owned::NbtCompound::new(); + if !self.siblings.is_empty() { + compound.insert( + "extra", + simdnbt::owned::NbtList::from( + self.siblings + .into_iter() + .map(|component| component.to_compound()) + .collect::<Vec<_>>(), + ), + ); + } + compound.extend(self.style.to_compound()); + compound + } +} + impl Default for BaseComponent { fn default() -> Self { Self::new() |
