aboutsummaryrefslogtreecommitdiff
path: root/azalea-chat/src/base_component.rs
diff options
context:
space:
mode:
authorEightFactorial <murphkev000@gmail.com>2022-12-03 17:08:05 -0800
committerGitHub <noreply@github.com>2022-12-03 19:08:05 -0600
commit3b93fc641250c4d01ab7f0764b7d5faec2f8ae5b (patch)
tree727b94c9f90bba59f8571ecebeab1a33e0f4af07 /azalea-chat/src/base_component.rs
parent661c3622bebc111a1523bc80792dc90d9d571b24 (diff)
downloadazalea-drasl-3b93fc641250c4d01ab7f0764b7d5faec2f8ae5b.tar.xz
Serialize Component (#47)
* Serializing ClientboundStatusResponsePacket Enable serialization of ClientboundStatusResponsePacket * Update clientbound_status_response_packet.rs Add options previewsChat and enforcesSecureChat * Serialize Style and TextColor * Serialize BaseComponent * Serialize TextComponent * Fix Style * Serialize Component * Fix multiple formats per message, fix reset tag * Fix Style, again * Use FlatMapSerializer * Forgot italics * Count struct fields, reorganize logic * Serialize TranslatableComponent * Rewrite TextComponent Serializer * Fix using TextColor::Parse * Code Cleanup * Add default attribute, just in case * Clippy * use serde derive feature + preferred formatting choices Co-authored-by: BuildTools <unconfigured@null.spigotmc.org> Co-authored-by: mat <github@matdoes.dev>
Diffstat (limited to 'azalea-chat/src/base_component.rs')
-rwxr-xr-xazalea-chat/src/base_component.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/azalea-chat/src/base_component.rs b/azalea-chat/src/base_component.rs
index e532de11..ab4f5e5d 100755
--- a/azalea-chat/src/base_component.rs
+++ b/azalea-chat/src/base_component.rs
@@ -1,9 +1,12 @@
use crate::{style::Style, Component};
+use serde::Serialize;
-#[derive(Clone, Debug, PartialEq)]
+#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct BaseComponent {
// implements mutablecomponent
+ #[serde(skip_serializing_if = "Vec::is_empty")]
pub siblings: Vec<Component>,
+ #[serde(flatten)]
pub style: Style,
}