@@ -5,13 +5,9 @@ use std::{
55 sync:: LazyLock ,
66} ;
77
8- #[ cfg( feature = "azalea-buf" ) ]
8+ #[ cfg( all ( feature = "azalea-buf" , feature = "simdnbt" ) ) ]
99use azalea_buf:: { AzaleaRead , AzaleaWrite , BufReadError } ;
1010use serde:: { Deserialize , Deserializer , Serialize , de} ;
11- #[ cfg( feature = "simdnbt" ) ]
12- use simdnbt:: { Deserialize as _, FromNbtTag as _, Serialize as _} ;
13- #[ cfg( all( feature = "azalea-buf" , feature = "simdnbt" ) ) ]
14- use tracing:: { debug, trace, warn} ;
1511
1612use crate :: {
1713 base_component:: BaseComponent ,
@@ -66,6 +62,8 @@ impl FormattedText {
6662
6763 #[ cfg( feature = "simdnbt" ) ]
6864 fn parse_separator_nbt ( nbt : & simdnbt:: borrow:: NbtCompound ) -> Option < FormattedText > {
65+ use simdnbt:: FromNbtTag ;
66+
6967 if let Some ( separator) = nbt. get ( "separator" ) {
7068 FormattedText :: from_nbt_tag ( separator)
7169 } else {
@@ -447,6 +445,8 @@ impl FormattedText {
447445 FormattedText :: from ( s)
448446 }
449447 fn from_nbt_list ( list : simdnbt:: borrow:: NbtList ) -> Option < FormattedText > {
448+ use tracing:: debug;
449+
450450 let mut component;
451451 if let Some ( compounds) = list. compounds ( ) {
452452 component = FormattedText :: from_nbt_compound ( compounds. first ( ) ?) ?;
@@ -466,6 +466,9 @@ impl FormattedText {
466466 }
467467
468468 pub fn from_nbt_compound ( compound : simdnbt:: borrow:: NbtCompound ) -> Option < Self > {
469+ use simdnbt:: { Deserialize , FromNbtTag } ;
470+ use tracing:: { trace, warn} ;
471+
469472 let mut component: FormattedText ;
470473
471474 if let Some ( text) = compound. get ( "text" ) {
@@ -617,6 +620,9 @@ impl From<&simdnbt::Mutf8Str> for FormattedText {
617620#[ cfg( all( feature = "azalea-buf" , feature = "simdnbt" ) ) ]
618621impl AzaleaRead for FormattedText {
619622 fn azalea_read ( buf : & mut Cursor < & [ u8 ] > ) -> Result < Self , BufReadError > {
623+ use simdnbt:: FromNbtTag ;
624+ use tracing:: trace;
625+
620626 let nbt = simdnbt:: borrow:: read_optional_tag ( buf) ?;
621627 trace ! (
622628 "Reading NBT for FormattedText: {:?}" ,
@@ -634,6 +640,8 @@ impl AzaleaRead for FormattedText {
634640#[ cfg( all( feature = "azalea-buf" , feature = "simdnbt" ) ) ]
635641impl AzaleaWrite for FormattedText {
636642 fn azalea_write ( & self , buf : & mut impl Write ) -> io:: Result < ( ) > {
643+ use simdnbt:: Serialize ;
644+
637645 let mut out = Vec :: new ( ) ;
638646 simdnbt:: owned:: BaseNbt :: write_unnamed ( & ( self . clone ( ) . to_compound ( ) . into ( ) ) , & mut out) ;
639647 buf. write_all ( & out)
0 commit comments