diff --git a/Cargo.lock b/Cargo.lock index 085e425d1..5515af7dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -519,6 +519,7 @@ dependencies = [ "azalea-buf", "azalea-registry-macros", "once_cell", + "serde", "simdnbt", ] diff --git a/azalea-registry/Cargo.toml b/azalea-registry/Cargo.toml index 21515bb27..3e968b245 100644 --- a/azalea-registry/Cargo.toml +++ b/azalea-registry/Cargo.toml @@ -13,6 +13,7 @@ simdnbt = "0.6" 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" +serde = { version = "^1.0", optional = true } [features] -serde = ["azalea-registry-macros/serde"] +serde = ["azalea-registry-macros/serde", "dep:serde"] default = ["serde"] diff --git a/azalea-registry/azalea-registry-macros/src/lib.rs b/azalea-registry/azalea-registry-macros/src/lib.rs index 460ff06af..50a9f1991 100755 --- a/azalea-registry/azalea-registry-macros/src/lib.rs +++ b/azalea-registry/azalea-registry-macros/src/lib.rs @@ -76,6 +76,7 @@ pub fn registry(input: TokenStream) -> TokenStream { generated.extend(quote! { #(#attributes)* #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, azalea_buf::McBuf, simdnbt::ToNbtTag, simdnbt::FromNbtTag)] + #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[repr(u32)] pub enum #name { #enum_items