From 730297cf561d42fd9132eb201d1aec0d3d7c7e00 Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 26 Sep 2025 06:16:33 +0800 Subject: fix compile error with new serde version, and update deps --- azalea-chat/src/hover_event.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'azalea-chat/src/hover_event.rs') diff --git a/azalea-chat/src/hover_event.rs b/azalea-chat/src/hover_event.rs index a18a3047..825c253b 100644 --- a/azalea-chat/src/hover_event.rs +++ b/azalea-chat/src/hover_event.rs @@ -1,4 +1,6 @@ use serde::Serialize; +#[cfg(feature = "simdnbt")] +use simdnbt::owned::NbtCompound; use crate::FormattedText; @@ -18,3 +20,29 @@ pub enum HoverEvent { name: Box, }, } + +#[cfg(feature = "simdnbt")] +impl simdnbt::Serialize for HoverEvent { + fn to_compound(self) -> NbtCompound { + let mut compound = NbtCompound::new(); + let mut action = |s: &str| { + compound.insert("action", s); + }; + match self { + HoverEvent::ShowText { value } => { + action("show_text"); + compound.insert("value", value.to_compound()); + } + HoverEvent::ShowItem { .. } => { + action("show_item"); + } + HoverEvent::ShowEntity { id, name } => { + action("show_entity"); + compound.insert("id", id); + // compound.insert("uuid", uuid.to_string()); + compound.insert("name", name.to_compound()); + } + } + compound + } +} -- cgit v1.2.3