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

read nbt as optional in more places

This commit is contained in:
mat 2023-12-28 17:49:41 -06:00
parent cacb04718d
commit cbb2ffad92
12 changed files with 21 additions and 19 deletions

6
Cargo.lock generated
View file

@ -2439,8 +2439,7 @@ dependencies = [
[[package]]
name = "simdnbt"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3d42fda2b44594e802fc92a5b3c633cd442cdb1c0a31e0b624ec5c6aab0d063"
source = "git+https://github.com/azalea-rs/simdnbt#922701104ab432eea6185a1a5e96211eaeba5bda"
dependencies = [
"byteorder",
"flate2",
@ -2452,8 +2451,7 @@ dependencies = [
[[package]]
name = "simdnbt-derive"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6241f3aeb4a7cf50ab268d21af2d0cf5d5ede8d928d3c2709e01425fc7e8d54c"
source = "git+https://github.com/azalea-rs/simdnbt#922701104ab432eea6185a1a5e96211eaeba5bda"
dependencies = [
"proc-macro2",
"quote",

View file

@ -9,13 +9,13 @@ version = "0.9.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
simdnbt = { version = "0.3", git = "https://github.com/azalea-rs/simdnbt" }
azalea-buf-macros = { path = "./azalea-buf-macros", version = "0.9.0" }
byteorder = "^1.5.0"
tracing = "0.1.40"
serde_json = { version = "^1.0", optional = true }
thiserror = "1.0.50"
uuid = "^1.6.1"
simdnbt = "0.3"
[features]
serde_json = ["dep:serde_json"]

View file

@ -19,7 +19,7 @@ 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.3", optional = true }
simdnbt = { version = "0.3", optional = true, git = "https://github.com/azalea-rs/simdnbt" }
tracing = "0.1.40"
once_cell = "1.18.0"
serde = { version = "^1.0", features = ["derive"] }

View file

@ -412,9 +412,13 @@ impl simdnbt::FromNbtTag for FormattedText {
#[cfg(feature = "azalea-buf")]
impl McBufReadable for FormattedText {
fn read_from(buf: &mut std::io::Cursor<&[u8]>) -> Result<Self, BufReadError> {
let nbt = simdnbt::borrow::NbtTag::read(buf)?;
FormattedText::from_nbt_tag(&nbt)
.ok_or(BufReadError::Custom("couldn't read nbt".to_owned()))
let nbt = simdnbt::borrow::NbtTag::read_optional(buf)?;
if let Some(nbt) = nbt {
FormattedText::from_nbt_tag(&nbt)
.ok_or(BufReadError::Custom("couldn't read nbt".to_owned()))
} else {
Ok(FormattedText::default())
}
}
}

View file

@ -9,12 +9,12 @@ version = "0.9.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
simdnbt = { version = "0.3", git = "https://github.com/azalea-rs/simdnbt" }
reqwest = { version = "0.11.22", default-features = false }
anyhow = "1.0.75"
async-trait = "0.1.74"
azalea-auth = { path = "../azalea-auth", version = "0.9.0" }
azalea-block = { path = "../azalea-block", version = "0.9.0" }
simdnbt = "0.3"
azalea-chat = { path = "../azalea-chat", version = "0.9.0" }
azalea-core = { path = "../azalea-core", version = "0.9.0" }
azalea-crypto = { path = "../azalea-crypto", version = "0.9.0" }

View file

@ -9,9 +9,9 @@ version = "0.9.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
simdnbt = { version = "0.3", git = "https://github.com/azalea-rs/simdnbt" }
azalea-buf = { path = "../azalea-buf", version = "0.9.0" }
azalea-inventory = { version = "0.9.0", path = "../azalea-inventory" }
simdnbt = "0.3"
azalea-registry = { path = "../azalea-registry", version = "0.9.0" }
bevy_ecs = { version = "0.12.1", default-features = false, optional = true }
nohash-hasher = "0.2.0"

View file

@ -9,6 +9,7 @@ license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
simdnbt = { version = "0.3", git = "https://github.com/azalea-rs/simdnbt" }
azalea-block = { version = "0.9.0", path = "../azalea-block" }
azalea-buf = { version = "0.9.0", path = "../azalea-buf" }
azalea-chat = { version = "0.9.0", path = "../azalea-chat", features = [
@ -16,7 +17,6 @@ azalea-chat = { version = "0.9.0", path = "../azalea-chat", features = [
] }
azalea-core = { version = "0.9.0", path = "../azalea-core" }
azalea-inventory = { version = "0.9.0", path = "../azalea-inventory" }
simdnbt = "0.3"
azalea-registry = { version = "0.9.0", path = "../azalea-registry" }
azalea-world = { version = "0.9.0", path = "../azalea-world" }
bevy_app = "0.12.1"

View file

@ -9,7 +9,7 @@ version = "0.9.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
simdnbt = { version = "0.3", git = "https://github.com/azalea-rs/simdnbt" }
azalea-buf = { version = "0.9.0", path = "../azalea-buf" }
azalea-inventory-macros = { version = "0.9.0", path = "./azalea-inventory-macros" }
simdnbt = "0.3"
azalea-registry = { version = "0.9.0", path = "../azalea-registry" }

View file

@ -9,6 +9,7 @@ version = "0.9.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
simdnbt = { version = "0.3", git = "https://github.com/azalea-rs/simdnbt" }
async-recursion = "1.0.5"
azalea-auth = { path = "../azalea-auth", version = "0.9.0" }
azalea-block = { path = "../azalea-block", default-features = false, version = "0.9.0" }
@ -25,7 +26,6 @@ azalea-core = { path = "../azalea-core", optional = true, version = "0.9.0", fea
azalea-crypto = { path = "../azalea-crypto", version = "0.9.0" }
azalea-entity = { version = "0.9.0", path = "../azalea-entity" }
azalea-inventory = { version = "0.9.0", path = "../azalea-inventory" }
simdnbt = "0.3"
azalea-protocol-macros = { path = "./azalea-protocol-macros", version = "0.9.0" }
azalea-registry = { path = "../azalea-registry", version = "0.9.0" }
azalea-world = { path = "../azalea-world", version = "0.9.0" }

View file

@ -1,11 +1,11 @@
use azalea_buf::McBuf;
use azalea_core::position::BlockPos;
use azalea_protocol_macros::ClientboundGamePacket;
use simdnbt::owned::NbtTag;
use simdnbt::owned::Nbt;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundBlockEntityDataPacket {
pub pos: BlockPos,
pub block_entity_type: azalea_registry::BlockEntityKind,
pub tag: NbtTag,
pub tag: Nbt,
}

View file

@ -9,11 +9,11 @@ version = "0.9.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
simdnbt = { version = "0.3", git = "https://github.com/azalea-rs/simdnbt" }
azalea-buf = { path = "../azalea-buf", version = "0.9.0" }
azalea-registry-macros = { path = "./azalea-registry-macros", version = "0.9.0" }
once_cell = "1.18.0"
simdnbt = "0.3"
[features]
serde = ["azalea-registry-macros/serde"]
default = ["serde"]

View file

@ -9,13 +9,13 @@ version = "0.9.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
simdnbt = { version = "0.3", git = "https://github.com/azalea-rs/simdnbt" }
azalea-block = { path = "../azalea-block", default-features = false, version = "0.9.0" }
azalea-buf = { path = "../azalea-buf", version = "0.9.0" }
azalea-core = { path = "../azalea-core", version = "0.9.0", features = [
"bevy_ecs",
] }
azalea-inventory = { version = "0.9.0", path = "../azalea-inventory" }
simdnbt = "0.3"
azalea-registry = { path = "../azalea-registry", version = "0.9.0" }
bevy_ecs = "0.12.1"
derive_more = { version = "0.99.17", features = ["deref", "deref_mut"] }