From 43ebbee94a24e1f797759d3abe002b8ddfe0523c Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 29 Mar 2025 23:10:55 +0000 Subject: update ServerboundContainerClick to use HashedStack from 1.21.5 --- azalea-protocol/azalea-protocol-macros/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'azalea-protocol/azalea-protocol-macros/src') 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! { -- cgit v1.2.3