aboutsummaryrefslogtreecommitdiff
path: root/azalea-nbt
diff options
context:
space:
mode:
authorEightFactorial <29801334+EightFactorial@users.noreply.github.com>2023-03-11 14:00:10 -0800
committerGitHub <noreply@github.com>2023-03-11 16:00:10 -0600
commitc57c68ddf8cb9e4e8d27cf3e08f267a8a020c1c0 (patch)
tree3209e7c0f93f81c09d48fb13cd3a240c04aaa3b8 /azalea-nbt
parentf28efd5637cf3e129af018066421c090cb73ad50 (diff)
downloadazalea-drasl-c57c68ddf8cb9e4e8d27cf3e08f267a8a020c1c0.tar.xz
Add RegistryHolder struct and serde features (#81)
* Make RegistryHolder struct * Update deps * Move RegistryHolder to azalea-protocol * Convert bytes to bools and back * Rename and shuffle logic * Move logic into trait, rename methods * Final touchups * Ah, merge mistakes * Add serde support for ResourceLocation * Reuse structs * Error when serde skips values in debug mode Add missing attributes * Strict_registry feature, require packet feature * Add test * Move into packets * Docs and touchups * Reword docs * Move into module inside ClientboundLoginPacket * Add azalea-nbt serde feature * remove duplicate comment and type_ -> kind --------- Co-authored-by: mat <github@matdoes.dev>
Diffstat (limited to 'azalea-nbt')
-rw-r--r--azalea-nbt/Cargo.toml16
-rwxr-xr-xazalea-nbt/src/tag.rs6
2 files changed, 14 insertions, 8 deletions
diff --git a/azalea-nbt/Cargo.toml b/azalea-nbt/Cargo.toml
index b67c90c8..007da55a 100644
--- a/azalea-nbt/Cargo.toml
+++ b/azalea-nbt/Cargo.toml
@@ -9,17 +9,21 @@ repository = "https://github.com/mat-1/azalea/tree/main/azalea-nbt"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-ahash = { version = "^0.8.0", features = ["serde"]}
-azalea-buf = {path = "../azalea-buf", version = "^0.6.0" }
+ahash = { version = "^0.8.3" }
+azalea-buf = { path = "../azalea-buf", version = "^0.6.0" }
byteorder = "^1.4.3"
-flate2 = "^1.0.23"
+flate2 = "^1.0.25"
log = "0.4.17"
num-derive = "^0.3.3"
-num-traits = "^0.2.14"
-serde = {version = "^1.0.148", features = ["derive"]}
+num-traits = "^0.2.15"
+serde = { version = "1.0.152", features = ["derive"], optional = true }
[dev-dependencies]
-criterion = {version = "^0.3.5", features = ["html_reports"]}
+criterion = {version = "^0.4.0", features = ["html_reports"]}
+
+[features]
+default = []
+serde = ["dep:serde", "ahash/serde"]
[profile.release]
lto = true
diff --git a/azalea-nbt/src/tag.rs b/azalea-nbt/src/tag.rs
index a18a42b1..23bed1d4 100755
--- a/azalea-nbt/src/tag.rs
+++ b/azalea-nbt/src/tag.rs
@@ -1,9 +1,11 @@
use ahash::AHashMap;
+
+#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
/// An NBT value.
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
-#[serde(untagged)]
+#[derive(Clone, Debug, PartialEq, Default)]
+#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(untagged))]
pub enum Tag {
#[default]
End, // 0