aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/azalea-protocol-macros/src
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-03-29 23:10:55 +0000
committermat <git@matdoes.dev>2025-03-29 23:10:55 +0000
commit43ebbee94a24e1f797759d3abe002b8ddfe0523c (patch)
tree8c861f2cfaf3b0df11d8999c929d39700454751b /azalea-protocol/azalea-protocol-macros/src
parentd0b459e82764987e1f820978e2af2d01a4b91084 (diff)
downloadazalea-drasl-43ebbee94a24e1f797759d3abe002b8ddfe0523c.tar.xz
update ServerboundContainerClick to use HashedStack from 1.21.5
Diffstat (limited to 'azalea-protocol/azalea-protocol-macros/src')
-rwxr-xr-xazalea-protocol/azalea-protocol-macros/src/lib.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/azalea-protocol/azalea-protocol-macros/src/lib.rs b/azalea-protocol/azalea-protocol-macros/src/lib.rs
index a33d21e0..a1255519 100755
--- a/azalea-protocol/azalea-protocol-macros/src/lib.rs
+++ b/azalea-protocol/azalea-protocol-macros/src/lib.rs
@@ -9,13 +9,16 @@ use syn::{
fn as_packet_derive(input: TokenStream, state: proc_macro2::TokenStream) -> TokenStream {
let DeriveInput { ident, data, .. } = parse_macro_input!(input);
+ // technically it would still work with enums and non-named structs but for
+ // consistency in the api it's nicer if they are all just structs, which is why
+ // we enforce this here
let syn::Data::Struct(syn::DataStruct { fields, .. }) = &data else {
panic!("#[derive(*Packet)] can only be used on structs")
};
-
let (syn::Fields::Named(_) | syn::Fields::Unit) = fields else {
panic!("#[derive(*Packet)] can only be used on structs with named fields")
};
+
let variant_name = variant_name_from(&ident);
let contents = quote! {