Skip to content

Commit

Permalink
read nbt as optional in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-1 committed Dec 28, 2023
1 parent cacb047 commit cbb2ffa
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 19 deletions.
6 changes: 2 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion azalea-buf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion azalea-chat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
10 changes: 7 additions & 3 deletions azalea-chat/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion azalea-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion azalea-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion azalea-entity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ 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 = [
"azalea-buf",
] }
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"
Expand Down
2 changes: 1 addition & 1 deletion azalea-inventory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
2 changes: 1 addition & 1 deletion azalea-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -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" }
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
}
4 changes: 2 additions & 2 deletions azalea-registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion azalea-world/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down

0 comments on commit cbb2ffa

Please sign in to comment.