diff --git a/Cargo.lock b/Cargo.lock index a6e3906a..9cac9d85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1157,11 +1157,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erased-serde" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b73807008a3c7f171cc40312f37d95ef0396e048b5848d775f54b1a4dd4a0d3" +checksum = "24e2389d65ab4fab27dc2a5de7b191e1f6617d1f1c8855c0dc569c94a4cbb18d" dependencies = [ "serde", + "typeid", ] [[package]] @@ -2406,8 +2407,8 @@ dependencies = [ [[package]] name = "simdnbt" -version = "0.4.3" -source = "git+https://github.com/azalea-rs/simdnbt#c83d29855afbc224eb7c1d0d5a0ddf391b2eea54" +version = "0.5.2" +source = "git+https://github.com/azalea-rs/simdnbt#07bb1e703664eb19328eb58e9a423585b1128687" dependencies = [ "byteorder", "flate2", @@ -2419,8 +2420,8 @@ dependencies = [ [[package]] name = "simdnbt-derive" -version = "0.4.3" -source = "git+https://github.com/azalea-rs/simdnbt#c83d29855afbc224eb7c1d0d5a0ddf391b2eea54" +version = "0.5.2" +source = "git+https://github.com/azalea-rs/simdnbt#07bb1e703664eb19328eb58e9a423585b1128687" dependencies = [ "proc-macro2", "quote", @@ -2459,9 +2460,9 @@ dependencies = [ [[package]] name = "smol_str" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6845563ada680337a52d43bb0b29f396f2d911616f6573012645b9e3d048a49" +checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" dependencies = [ "serde", ] @@ -2846,6 +2847,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "typeid" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "059d83cc991e7a42fc37bd50941885db0888e34209f8cfd9aab07ddec03bc9cf" + [[package]] name = "typenum" version = "1.17.0" diff --git a/azalea-buf/Cargo.toml b/azalea-buf/Cargo.toml index 8095e6ac..f7909b29 100644 --- a/azalea-buf/Cargo.toml +++ b/azalea-buf/Cargo.toml @@ -9,7 +9,7 @@ version = "0.10.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -simdnbt = { version = "0.4", git = "https://github.com/azalea-rs/simdnbt" } +simdnbt = { version = "0.5", git = "https://github.com/azalea-rs/simdnbt" } azalea-buf-macros = { path = "./azalea-buf-macros", version = "0.10.0" } byteorder = "^1.5.0" tracing = "0.1.40" diff --git a/azalea-buf/src/read.rs b/azalea-buf/src/read.rs index b3352a80..40889c64 100755 --- a/azalea-buf/src/read.rs +++ b/azalea-buf/src/read.rs @@ -359,7 +359,7 @@ impl McBufReadable for simdnbt::owned::NbtCompound { impl McBufReadable for simdnbt::owned::Nbt { fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - Ok(simdnbt::owned::Nbt::read_unnamed(buf)?) + Ok(simdnbt::owned::read_unnamed(buf)?) } } diff --git a/azalea-chat/Cargo.toml b/azalea-chat/Cargo.toml index 85733e8e..e293aeca 100644 --- a/azalea-chat/Cargo.toml +++ b/azalea-chat/Cargo.toml @@ -19,7 +19,7 @@ azalea-buf = { path = "../azalea-buf", features = [ "serde_json", ], version = "0.10.0", optional = true } azalea-language = { path = "../azalea-language", version = "0.10.0" } -simdnbt = { version = "0.4", optional = true, git = "https://github.com/azalea-rs/simdnbt" } +simdnbt = { version = "0.5", optional = true, git = "https://github.com/azalea-rs/simdnbt" } tracing = "0.1.40" once_cell = "1.19.0" serde = { version = "^1.0", features = ["derive"] } diff --git a/azalea-chat/src/component.rs b/azalea-chat/src/component.rs index 01c3a370..94d653e8 100755 --- a/azalea-chat/src/component.rs +++ b/azalea-chat/src/component.rs @@ -470,8 +470,7 @@ impl simdnbt::FromNbtTag for FormattedText { #[cfg(feature = "azalea-buf")] impl McBufReadable for FormattedText { fn read_from(buf: &mut std::io::Cursor<&[u8]>) -> Result { - let alloc = Default::default(); - let nbt = simdnbt::borrow::NbtTag::read_optional(buf, &alloc)?; + let nbt = simdnbt::borrow::read_optional_tag(buf)?; if let Some(nbt) = nbt { FormattedText::from_nbt_tag(&nbt).ok_or(BufReadError::Custom( "couldn't convert nbt to chat message".to_owned(), diff --git a/azalea-chat/src/numbers.rs b/azalea-chat/src/numbers.rs index 21c30591..a5a88c4f 100644 --- a/azalea-chat/src/numbers.rs +++ b/azalea-chat/src/numbers.rs @@ -24,7 +24,7 @@ impl McBufReadable for NumberFormat { match kind { NumberFormatKind::Blank => Ok(NumberFormat::Blank), NumberFormatKind::Styled => Ok(NumberFormat::Styled { - style: Nbt::read(buf)?, + style: simdnbt::owned::read(buf)?, }), NumberFormatKind::Fixed => Ok(NumberFormat::Fixed { value: FormattedText::read_from(buf)?, diff --git a/azalea-client/Cargo.toml b/azalea-client/Cargo.toml index b7c58b2c..85d61e6d 100644 --- a/azalea-client/Cargo.toml +++ b/azalea-client/Cargo.toml @@ -9,7 +9,7 @@ version = "0.10.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -simdnbt = { version = "0.4", git = "https://github.com/azalea-rs/simdnbt" } +simdnbt = { version = "0.5", git = "https://github.com/azalea-rs/simdnbt" } reqwest = { version = "0.12.4", default-features = false } anyhow = "1.0.82" async-trait = "0.1.80" diff --git a/azalea-core/Cargo.toml b/azalea-core/Cargo.toml index 8511cdfa..8808bf8e 100644 --- a/azalea-core/Cargo.toml +++ b/azalea-core/Cargo.toml @@ -9,7 +9,7 @@ version = "0.10.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -simdnbt = { version = "0.4", git = "https://github.com/azalea-rs/simdnbt" } +simdnbt = { version = "0.5", git = "https://github.com/azalea-rs/simdnbt" } azalea-buf = { path = "../azalea-buf", version = "0.10.0" } azalea-registry = { path = "../azalea-registry", version = "0.10.0" } bevy_ecs = { version = "0.13.2", default-features = false, optional = true } diff --git a/azalea-core/src/registry_holder.rs b/azalea-core/src/registry_holder.rs index 7e179e6f..68dfcf29 100644 --- a/azalea-core/src/registry_holder.rs +++ b/azalea-core/src/registry_holder.rs @@ -51,9 +51,8 @@ impl RegistryHolder { // convert the value to T let mut nbt_bytes = Vec::new(); value.write(&mut nbt_bytes); - let alloc = Default::default(); let nbt_borrow_compound = - simdnbt::borrow::NbtCompound::read(&mut Cursor::new(&nbt_bytes), &alloc).ok()?; + simdnbt::borrow::read_compound(&mut Cursor::new(&nbt_bytes)).ok()?; let value = match T::from_compound(&nbt_borrow_compound) { Ok(value) => value, Err(err) => { @@ -136,18 +135,12 @@ pub struct ChatTypeStyle { #[simdnbt(deny_unknown_fields)] pub struct DimensionTypeElement { pub ambient_light: f32, - #[serde(with = "Convert")] pub bed_works: bool, pub coordinate_scale: f32, pub effects: ResourceLocation, - #[serde(default)] - #[serde(skip_serializing_if = "Option::is_none")] pub fixed_time: Option, - #[serde(with = "Convert")] pub has_ceiling: bool, - #[serde(with = "Convert")] pub has_raids: bool, - #[serde(with = "Convert")] pub has_skylight: bool, pub height: u32, pub infiniburn: ResourceLocation, @@ -155,13 +148,9 @@ pub struct DimensionTypeElement { pub min_y: i32, pub monster_spawn_block_light_limit: u32, pub monster_spawn_light_level: MonsterSpawnLightLevel, - #[serde(with = "Convert")] pub natural: bool, - #[serde(with = "Convert")] pub piglin_safe: bool, - #[serde(with = "Convert")] pub respawn_anchor_works: bool, - #[serde(with = "Convert")] pub ultrawarm: bool, } @@ -181,7 +170,6 @@ pub struct DimensionTypeElement { /// max. #[derive(Debug, Clone)] // #[serde(untagged)] -#[cfg_attr(feature = "strict_registry", simdnbt(deny_unknown_fields))] pub enum MonsterSpawnLightLevel { /// A simple minimum value. Simple(u32), diff --git a/azalea-entity/Cargo.toml b/azalea-entity/Cargo.toml index 99dc5f11..f2b46908 100644 --- a/azalea-entity/Cargo.toml +++ b/azalea-entity/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -simdnbt = { version = "0.4", git = "https://github.com/azalea-rs/simdnbt" } +simdnbt = { version = "0.5", git = "https://github.com/azalea-rs/simdnbt" } azalea-block = { version = "0.10.0", path = "../azalea-block" } azalea-buf = { version = "0.10.0", path = "../azalea-buf" } azalea-chat = { version = "0.10.0", path = "../azalea-chat", features = [ diff --git a/azalea-inventory/Cargo.toml b/azalea-inventory/Cargo.toml index e381119b..b6208171 100644 --- a/azalea-inventory/Cargo.toml +++ b/azalea-inventory/Cargo.toml @@ -9,7 +9,7 @@ version = "0.10.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -simdnbt = { version = "0.4", git = "https://github.com/azalea-rs/simdnbt" } +simdnbt = { version = "0.5", git = "https://github.com/azalea-rs/simdnbt" } azalea-buf = { version = "0.10.0", path = "../azalea-buf" } azalea-inventory-macros = { version = "0.10.0", path = "./azalea-inventory-macros" } azalea-registry = { version = "0.10.0", path = "../azalea-registry" } diff --git a/azalea-protocol/Cargo.toml b/azalea-protocol/Cargo.toml index 284a98f1..e3a02db4 100644 --- a/azalea-protocol/Cargo.toml +++ b/azalea-protocol/Cargo.toml @@ -9,7 +9,7 @@ version = "0.10.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -simdnbt = { version = "0.4", git = "https://github.com/azalea-rs/simdnbt" } +simdnbt = { version = "0.5", git = "https://github.com/azalea-rs/simdnbt" } async-recursion = "1.1.0" azalea-auth = { path = "../azalea-auth", version = "0.10.0" } azalea-block = { path = "../azalea-block", default-features = false, version = "0.10.0" } diff --git a/azalea-registry/Cargo.toml b/azalea-registry/Cargo.toml index 6bd5a7a0..6a554593 100644 --- a/azalea-registry/Cargo.toml +++ b/azalea-registry/Cargo.toml @@ -9,7 +9,7 @@ version = "0.10.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -simdnbt = { version = "0.4", git = "https://github.com/azalea-rs/simdnbt" } +simdnbt = { version = "0.5", git = "https://github.com/azalea-rs/simdnbt" } azalea-buf = { path = "../azalea-buf", version = "0.10.0" } azalea-registry-macros = { path = "./azalea-registry-macros", version = "0.10.0" } once_cell = "1.19.0" diff --git a/azalea-world/Cargo.toml b/azalea-world/Cargo.toml index 7cac22e6..b4ded798 100644 --- a/azalea-world/Cargo.toml +++ b/azalea-world/Cargo.toml @@ -9,7 +9,7 @@ version = "0.10.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -simdnbt = { version = "0.4", git = "https://github.com/azalea-rs/simdnbt" } +simdnbt = { version = "0.5", git = "https://github.com/azalea-rs/simdnbt" } azalea-block = { path = "../azalea-block", default-features = false, version = "0.10.0" } azalea-buf = { path = "../azalea-buf", version = "0.10.0" } azalea-core = { path = "../azalea-core", version = "0.10.0", features = [