diff --git a/azalea-chat_new/Cargo.toml b/azalea-chat_new/Cargo.toml deleted file mode 100644 index 2536bfaa7..000000000 --- a/azalea-chat_new/Cargo.toml +++ /dev/null @@ -1,27 +0,0 @@ -[package] -description = "Parse Minecraft chat messages." -edition = "2021" -license = "MIT" -name = "azalea-chat" -repository = "https://github.com/azalea-rs/azalea/tree/main/azalea-chat" -version = "0.9.0" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[features] -default = [] -azalea-buf = ["dep:azalea-buf", "simdnbt"] -numbers = ["dep:azalea-registry", "dep:simdnbt"] -simdnbt = ["dep:simdnbt"] - -[dependencies] -azalea-buf = { path = "../azalea-buf", features = [ - "serde_json", -], version = "0.9.0", optional = true } -azalea-language = { path = "../azalea-language", version = "0.9.0" } -simdnbt = { version = "0.4", optional = true, git = "https://github.com/azalea-rs/simdnbt" } -tracing = "0.1.40" -once_cell = "1.19.0" -serde = { version = "^1.0", features = ["derive"] } -serde_json = "^1.0.113" -azalea-registry = { path = "../azalea-registry", version = "0.9.0", optional = true } diff --git a/azalea-chat_new/README.md b/azalea-chat_new/README.md deleted file mode 100644 index e79d273ac..000000000 --- a/azalea-chat_new/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# Azalea Chat - -Things for working with Minecraft formatted text components. - -# Examples - -``` -// convert a Minecraft formatted text JSON into colored text that can be printed to the terminal. - -use azalea_chat::FormattedText; -use serde_json::Value; -use serde::Deserialize; - -let j: Value = serde_json::from_str( - r#"{"text": "hello","color": "red","bold": true}"# -) -.unwrap(); -let text = FormattedText::deserialize(&j).unwrap(); -assert_eq!( - text.to_ansi(), - "\u{1b}[1m\u{1b}[38;2;255;85;85mhello\u{1b}[m" -); -``` diff --git a/azalea-chat_new/src/base_component.rs b/azalea-chat_new/src/base_component.rs deleted file mode 100644 index 8f70ecb7f..000000000 --- a/azalea-chat_new/src/base_component.rs +++ /dev/null @@ -1,46 +0,0 @@ -use crate::{style::Style, FormattedText}; -use serde::Serialize; - -#[derive(Clone, Debug, PartialEq, Serialize, Eq, Hash)] -pub struct BaseComponent { - // implements mutablecomponent - #[serde(skip_serializing_if = "Vec::is_empty")] - pub siblings: Vec, - #[serde(flatten)] - pub style: Style, -} - -impl BaseComponent { - pub fn new() -> Self { - Self { - siblings: Vec::new(), - style: Style::default(), - } - } -} - -#[cfg(feature = "simdnbt")] -impl simdnbt::Serialize for BaseComponent { - fn to_compound(self) -> simdnbt::owned::NbtCompound { - let mut compound = simdnbt::owned::NbtCompound::new(); - if !self.siblings.is_empty() { - compound.insert( - "extra", - simdnbt::owned::NbtList::from( - self.siblings - .into_iter() - .map(|component| component.to_compound()) - .collect::>(), - ), - ); - } - compound.extend(self.style.to_compound()); - compound - } -} - -impl Default for BaseComponent { - fn default() -> Self { - Self::new() - } -} diff --git a/azalea-chat_new/src/component.rs b/azalea-chat_new/src/component.rs deleted file mode 100644 index d301aba15..000000000 --- a/azalea-chat_new/src/component.rs +++ /dev/null @@ -1,496 +0,0 @@ -use crate::{ - base_component::BaseComponent, - style::{ChatFormatting, Style}, - text_component::TextComponent, - translatable_component::{StringOrComponent, TranslatableComponent}, -}; -#[cfg(feature = "azalea-buf")] -use azalea_buf::{BufReadError, McBufReadable, McBufWritable}; -use once_cell::sync::Lazy; -use serde::{de, Deserialize, Deserializer, Serialize}; -#[cfg(feature = "simdnbt")] -use simdnbt::{Deserialize as _, FromNbtTag as _, Serialize as _}; -use std::fmt::Display; -use tracing::{trace, warn}; - -/// A chat component, basically anything you can see in chat. -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Hash)] -#[serde(untagged)] -pub enum FormattedText { - Text(TextComponent), - Translatable(TranslatableComponent), -} - -pub static DEFAULT_STYLE: Lazy