From 3b93fc641250c4d01ab7f0764b7d5faec2f8ae5b Mon Sep 17 00:00:00 2001 From: EightFactorial Date: Sat, 3 Dec 2022 17:08:05 -0800 Subject: 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 Co-authored-by: mat --- azalea-chat/src/base_component.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'azalea-chat/src/base_component.rs') 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, + #[serde(flatten)] pub style: Style, } -- cgit v1.2.3