1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00

Update simdnbt dep (#148)

* Update simdnbt dep

* Fix not compiling (rust analyzer is still yapping, i trust you cargo check)

* Update simdnbt to 0.5.2

* finally everything works :prayge:
This commit is contained in:
veronoicc 2024-05-14 23:59:36 +02:00 committed by GitHub
parent b00106b7ff
commit 892869ad12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 28 additions and 34 deletions

23
Cargo.lock generated
View file

@ -1157,11 +1157,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]] [[package]]
name = "erased-serde" name = "erased-serde"
version = "0.4.4" version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b73807008a3c7f171cc40312f37d95ef0396e048b5848d775f54b1a4dd4a0d3" checksum = "24e2389d65ab4fab27dc2a5de7b191e1f6617d1f1c8855c0dc569c94a4cbb18d"
dependencies = [ dependencies = [
"serde", "serde",
"typeid",
] ]
[[package]] [[package]]
@ -2406,8 +2407,8 @@ dependencies = [
[[package]] [[package]]
name = "simdnbt" name = "simdnbt"
version = "0.4.3" version = "0.5.2"
source = "git+https://github.com/azalea-rs/simdnbt#c83d29855afbc224eb7c1d0d5a0ddf391b2eea54" source = "git+https://github.com/azalea-rs/simdnbt#07bb1e703664eb19328eb58e9a423585b1128687"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"flate2", "flate2",
@ -2419,8 +2420,8 @@ dependencies = [
[[package]] [[package]]
name = "simdnbt-derive" name = "simdnbt-derive"
version = "0.4.3" version = "0.5.2"
source = "git+https://github.com/azalea-rs/simdnbt#c83d29855afbc224eb7c1d0d5a0ddf391b2eea54" source = "git+https://github.com/azalea-rs/simdnbt#07bb1e703664eb19328eb58e9a423585b1128687"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2459,9 +2460,9 @@ dependencies = [
[[package]] [[package]]
name = "smol_str" name = "smol_str"
version = "0.2.1" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6845563ada680337a52d43bb0b29f396f2d911616f6573012645b9e3d048a49" checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead"
dependencies = [ dependencies = [
"serde", "serde",
] ]
@ -2846,6 +2847,12 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "typeid"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "059d83cc991e7a42fc37bd50941885db0888e34209f8cfd9aab07ddec03bc9cf"
[[package]] [[package]]
name = "typenum" name = "typenum"
version = "1.17.0" version = "1.17.0"

View file

@ -9,7 +9,7 @@ version = "0.10.1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [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" } azalea-buf-macros = { path = "./azalea-buf-macros", version = "0.10.0" }
byteorder = "^1.5.0" byteorder = "^1.5.0"
tracing = "0.1.40" tracing = "0.1.40"

View file

@ -359,7 +359,7 @@ impl McBufReadable for simdnbt::owned::NbtCompound {
impl McBufReadable for simdnbt::owned::Nbt { impl McBufReadable for simdnbt::owned::Nbt {
fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
Ok(simdnbt::owned::Nbt::read_unnamed(buf)?) Ok(simdnbt::owned::read_unnamed(buf)?)
} }
} }

View file

@ -19,7 +19,7 @@ azalea-buf = { path = "../azalea-buf", features = [
"serde_json", "serde_json",
], version = "0.10.0", optional = true } ], version = "0.10.0", optional = true }
azalea-language = { path = "../azalea-language", version = "0.10.0" } 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" tracing = "0.1.40"
once_cell = "1.19.0" once_cell = "1.19.0"
serde = { version = "^1.0", features = ["derive"] } serde = { version = "^1.0", features = ["derive"] }

View file

@ -470,8 +470,7 @@ impl simdnbt::FromNbtTag for FormattedText {
#[cfg(feature = "azalea-buf")] #[cfg(feature = "azalea-buf")]
impl McBufReadable for FormattedText { impl McBufReadable for FormattedText {
fn read_from(buf: &mut std::io::Cursor<&[u8]>) -> Result<Self, BufReadError> { fn read_from(buf: &mut std::io::Cursor<&[u8]>) -> Result<Self, BufReadError> {
let alloc = Default::default(); let nbt = simdnbt::borrow::read_optional_tag(buf)?;
let nbt = simdnbt::borrow::NbtTag::read_optional(buf, &alloc)?;
if let Some(nbt) = nbt { if let Some(nbt) = nbt {
FormattedText::from_nbt_tag(&nbt).ok_or(BufReadError::Custom( FormattedText::from_nbt_tag(&nbt).ok_or(BufReadError::Custom(
"couldn't convert nbt to chat message".to_owned(), "couldn't convert nbt to chat message".to_owned(),

View file

@ -24,7 +24,7 @@ impl McBufReadable for NumberFormat {
match kind { match kind {
NumberFormatKind::Blank => Ok(NumberFormat::Blank), NumberFormatKind::Blank => Ok(NumberFormat::Blank),
NumberFormatKind::Styled => Ok(NumberFormat::Styled { NumberFormatKind::Styled => Ok(NumberFormat::Styled {
style: Nbt::read(buf)?, style: simdnbt::owned::read(buf)?,
}), }),
NumberFormatKind::Fixed => Ok(NumberFormat::Fixed { NumberFormatKind::Fixed => Ok(NumberFormat::Fixed {
value: FormattedText::read_from(buf)?, value: FormattedText::read_from(buf)?,

View file

@ -9,7 +9,7 @@ version = "0.10.1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [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 } reqwest = { version = "0.12.4", default-features = false }
anyhow = "1.0.82" anyhow = "1.0.82"
async-trait = "0.1.80" async-trait = "0.1.80"

View file

@ -9,7 +9,7 @@ version = "0.10.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [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-buf = { path = "../azalea-buf", version = "0.10.0" }
azalea-registry = { path = "../azalea-registry", version = "0.10.0" } azalea-registry = { path = "../azalea-registry", version = "0.10.0" }
bevy_ecs = { version = "0.13.2", default-features = false, optional = true } bevy_ecs = { version = "0.13.2", default-features = false, optional = true }

View file

@ -51,9 +51,8 @@ impl RegistryHolder {
// convert the value to T // convert the value to T
let mut nbt_bytes = Vec::new(); let mut nbt_bytes = Vec::new();
value.write(&mut nbt_bytes); value.write(&mut nbt_bytes);
let alloc = Default::default();
let nbt_borrow_compound = 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) { let value = match T::from_compound(&nbt_borrow_compound) {
Ok(value) => value, Ok(value) => value,
Err(err) => { Err(err) => {
@ -136,18 +135,12 @@ pub struct ChatTypeStyle {
#[simdnbt(deny_unknown_fields)] #[simdnbt(deny_unknown_fields)]
pub struct DimensionTypeElement { pub struct DimensionTypeElement {
pub ambient_light: f32, pub ambient_light: f32,
#[serde(with = "Convert")]
pub bed_works: bool, pub bed_works: bool,
pub coordinate_scale: f32, pub coordinate_scale: f32,
pub effects: ResourceLocation, pub effects: ResourceLocation,
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub fixed_time: Option<u32>, pub fixed_time: Option<u32>,
#[serde(with = "Convert")]
pub has_ceiling: bool, pub has_ceiling: bool,
#[serde(with = "Convert")]
pub has_raids: bool, pub has_raids: bool,
#[serde(with = "Convert")]
pub has_skylight: bool, pub has_skylight: bool,
pub height: u32, pub height: u32,
pub infiniburn: ResourceLocation, pub infiniburn: ResourceLocation,
@ -155,13 +148,9 @@ pub struct DimensionTypeElement {
pub min_y: i32, pub min_y: i32,
pub monster_spawn_block_light_limit: u32, pub monster_spawn_block_light_limit: u32,
pub monster_spawn_light_level: MonsterSpawnLightLevel, pub monster_spawn_light_level: MonsterSpawnLightLevel,
#[serde(with = "Convert")]
pub natural: bool, pub natural: bool,
#[serde(with = "Convert")]
pub piglin_safe: bool, pub piglin_safe: bool,
#[serde(with = "Convert")]
pub respawn_anchor_works: bool, pub respawn_anchor_works: bool,
#[serde(with = "Convert")]
pub ultrawarm: bool, pub ultrawarm: bool,
} }
@ -181,7 +170,6 @@ pub struct DimensionTypeElement {
/// max. /// max.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
// #[serde(untagged)] // #[serde(untagged)]
#[cfg_attr(feature = "strict_registry", simdnbt(deny_unknown_fields))]
pub enum MonsterSpawnLightLevel { pub enum MonsterSpawnLightLevel {
/// A simple minimum value. /// A simple minimum value.
Simple(u32), Simple(u32),

View file

@ -9,7 +9,7 @@ license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [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-block = { version = "0.10.0", path = "../azalea-block" }
azalea-buf = { version = "0.10.0", path = "../azalea-buf" } azalea-buf = { version = "0.10.0", path = "../azalea-buf" }
azalea-chat = { version = "0.10.0", path = "../azalea-chat", features = [ azalea-chat = { version = "0.10.0", path = "../azalea-chat", features = [

View file

@ -9,7 +9,7 @@ version = "0.10.1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [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-buf = { version = "0.10.0", path = "../azalea-buf" }
azalea-inventory-macros = { version = "0.10.0", path = "./azalea-inventory-macros" } azalea-inventory-macros = { version = "0.10.0", path = "./azalea-inventory-macros" }
azalea-registry = { version = "0.10.0", path = "../azalea-registry" } azalea-registry = { version = "0.10.0", path = "../azalea-registry" }

View file

@ -9,7 +9,7 @@ version = "0.10.1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [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" async-recursion = "1.1.0"
azalea-auth = { path = "../azalea-auth", version = "0.10.0" } azalea-auth = { path = "../azalea-auth", version = "0.10.0" }
azalea-block = { path = "../azalea-block", default-features = false, version = "0.10.0" } azalea-block = { path = "../azalea-block", default-features = false, version = "0.10.0" }

View file

@ -9,7 +9,7 @@ version = "0.10.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [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-buf = { path = "../azalea-buf", version = "0.10.0" }
azalea-registry-macros = { path = "./azalea-registry-macros", version = "0.10.0" } azalea-registry-macros = { path = "./azalea-registry-macros", version = "0.10.0" }
once_cell = "1.19.0" once_cell = "1.19.0"

View file

@ -9,7 +9,7 @@ version = "0.10.1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [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-block = { path = "../azalea-block", default-features = false, version = "0.10.0" }
azalea-buf = { path = "../azalea-buf", version = "0.10.0" } azalea-buf = { path = "../azalea-buf", version = "0.10.0" }
azalea-core = { path = "../azalea-core", version = "0.10.0", features = [ azalea-core = { path = "../azalea-core", version = "0.10.0", features = [