diff --git a/Cargo.lock b/Cargo.lock index b78464ff..e134c286 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -295,6 +295,7 @@ dependencies = [ "azalea-buf", "azalea-chat", "azalea-nbt", + "bevy_ecs", "uuid", ] diff --git a/azalea-brigadier/src/suggestion/mod.rs b/azalea-brigadier/src/suggestion/mod.rs index 114a4c47..ea847f58 100755 --- a/azalea-brigadier/src/suggestion/mod.rs +++ b/azalea-brigadier/src/suggestion/mod.rs @@ -4,7 +4,7 @@ use crate::context::StringRange; #[cfg(feature = "azalea-buf")] use azalea_buf::McBufWritable; #[cfg(feature = "azalea-buf")] -use azalea_chat::Component; +use azalea_chat::FormattedText; #[cfg(feature = "azalea-buf")] use std::io::Write; pub use suggestions::*; @@ -58,7 +58,7 @@ impl Suggestion { } #[cfg(feature = "azalea-buf")] -impl McBufWritable for Suggestion { +impl McBufWritable for Suggestion { fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { self.text.write_into(buf)?; self.tooltip.write_into(buf)?; diff --git a/azalea-brigadier/src/suggestion/suggestions.rs b/azalea-brigadier/src/suggestion/suggestions.rs index 06ef9661..2a8b5e9e 100755 --- a/azalea-brigadier/src/suggestion/suggestions.rs +++ b/azalea-brigadier/src/suggestion/suggestions.rs @@ -5,7 +5,7 @@ use azalea_buf::{ BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, }; #[cfg(feature = "azalea-buf")] -use azalea_chat::Component; +use azalea_chat::FormattedText; #[cfg(feature = "azalea-buf")] use std::io::{Cursor, Write}; use std::{collections::HashSet, hash::Hash}; @@ -68,12 +68,12 @@ impl Default for Suggestions { } #[cfg(feature = "azalea-buf")] -impl McBufReadable for Suggestions { +impl McBufReadable for Suggestions { fn read_from(buf: &mut Cursor<&[u8]>) -> Result { #[derive(McBuf)] struct StandaloneSuggestion { pub text: String, - pub tooltip: Option, + pub tooltip: Option, } let start = u32::var_read_from(buf)? as usize; @@ -97,7 +97,7 @@ impl McBufReadable for Suggestions { } #[cfg(feature = "azalea-buf")] -impl McBufWritable for Suggestions { +impl McBufWritable for Suggestions { fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { (self.range.start() as u32).var_write_into(buf)?; (self.range.length() as u32).var_write_into(buf)?; diff --git a/azalea-chat/src/base_component.rs b/azalea-chat/src/base_component.rs index ab4f5e5d..43b35aef 100755 --- a/azalea-chat/src/base_component.rs +++ b/azalea-chat/src/base_component.rs @@ -1,11 +1,11 @@ -use crate::{style::Style, Component}; +use crate::{style::Style, FormattedText}; use serde::Serialize; #[derive(Clone, Debug, PartialEq, Serialize)] pub struct BaseComponent { // implements mutablecomponent #[serde(skip_serializing_if = "Vec::is_empty")] - pub siblings: Vec, + pub siblings: Vec, #[serde(flatten)] pub style: Style, } diff --git a/azalea-chat/src/component.rs b/azalea-chat/src/component.rs index d889f3ef..61c948ce 100755 --- a/azalea-chat/src/component.rs +++ b/azalea-chat/src/component.rs @@ -16,7 +16,7 @@ use std::{ /// A chat component, basically anything you can see in chat. #[derive(Clone, Debug, PartialEq, Serialize)] #[serde(untagged)] -pub enum Component { +pub enum FormattedText { Text(TextComponent), Translatable(TranslatableComponent), } @@ -27,7 +27,7 @@ pub static DEFAULT_STYLE: Lazy