From 9f5e5c092be9167e4d5222fdee4a1d2c419e5052 Mon Sep 17 00:00:00 2001 From: EightFactorial Date: Tue, 6 Dec 2022 18:48:48 -0800 Subject: Complete ClientboundCommand{Suggestion}sPacket, Serde support for NBT Tags (#49) * 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 * McBufWritable for BrigadierNodeStub * Thanks Clippy... * Implement suggestions in azalea-brigadier * Serde support for NBT Tags * Serde options * Forgot Options * Oops, that's McBufWritable for BrigadierParser * Fix McBufWritable for SlotData * Complete ClientboundUpdateRecipesPacket * fix some issues * better impl McBufReadable for Suggestions Co-authored-by: BuildTools Co-authored-by: mat --- azalea-nbt/src/encode.rs | 4 ++++ azalea-nbt/src/tag.rs | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'azalea-nbt/src') diff --git a/azalea-nbt/src/encode.rs b/azalea-nbt/src/encode.rs index 49c31192..87464fd9 100755 --- a/azalea-nbt/src/encode.rs +++ b/azalea-nbt/src/encode.rs @@ -193,6 +193,10 @@ impl Tag { write_compound(writer, value, false)?; Ok(()) } + Tag::End => { + 0u8.write_into(writer)?; + Ok(()) + } _ => Err(Error::InvalidTag), } } diff --git a/azalea-nbt/src/tag.rs b/azalea-nbt/src/tag.rs index de57b0a2..2bebe156 100755 --- a/azalea-nbt/src/tag.rs +++ b/azalea-nbt/src/tag.rs @@ -1,6 +1,8 @@ use ahash::AHashMap; +use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] pub enum Tag { End, // 0 Byte(i8), // 1 -- cgit v1.2.3