@@ -196,6 +196,8 @@ pub fn declare_state_packets(input: TokenStream) -> TokenStream {
196196 let mut serverbound_enum_contents = quote ! ( ) ;
197197 let mut clientbound_id_match_contents = quote ! ( ) ;
198198 let mut serverbound_id_match_contents = quote ! ( ) ;
199+ let mut clientbound_name_match_contents = quote ! ( ) ;
200+ let mut serverbound_name_match_contents = quote ! ( ) ;
199201 let mut clientbound_write_match_contents = quote ! ( ) ;
200202 let mut serverbound_write_match_contents = quote ! ( ) ;
201203 let mut clientbound_read_match_contents = quote ! ( ) ;
@@ -218,7 +220,10 @@ pub fn declare_state_packets(input: TokenStream) -> TokenStream {
218220 #variant_name( #module_name:: #struct_name) ,
219221 } ) ;
220222 clientbound_id_match_contents. extend ( quote ! {
221- #clientbound_state_name:: #variant_name( _packet) => #id,
223+ #clientbound_state_name:: #variant_name( ..) => #id,
224+ } ) ;
225+ clientbound_name_match_contents. extend ( quote ! {
226+ #clientbound_state_name:: #variant_name( ..) => #packet_name_litstr,
222227 } ) ;
223228 clientbound_write_match_contents. extend ( quote ! {
224229 #clientbound_state_name:: #variant_name( packet) => packet. write( buf) ,
@@ -267,7 +272,10 @@ pub fn declare_state_packets(input: TokenStream) -> TokenStream {
267272 #variant_name( #module_name:: #struct_name) ,
268273 } ) ;
269274 serverbound_id_match_contents. extend ( quote ! {
270- #serverbound_state_name:: #variant_name( _packet) => #id,
275+ #serverbound_state_name:: #variant_name( ..) => #id,
276+ } ) ;
277+ serverbound_name_match_contents. extend ( quote ! {
278+ #serverbound_state_name:: #variant_name( ..) => #packet_name_litstr,
271279 } ) ;
272280 serverbound_write_match_contents. extend ( quote ! {
273281 #serverbound_state_name:: #variant_name( packet) => packet. write( buf) ,
@@ -297,6 +305,9 @@ pub fn declare_state_packets(input: TokenStream) -> TokenStream {
297305 serverbound_id_match_contents. extend ( quote ! {
298306 _ => unreachable!( "This enum is empty and can't exist." )
299307 } ) ;
308+ serverbound_name_match_contents. extend ( quote ! {
309+ _ => unreachable!( "This enum is empty and can't exist." )
310+ } ) ;
300311 serverbound_write_match_contents. extend ( quote ! {
301312 _ => unreachable!( "This enum is empty and can't exist." )
302313 } ) ;
@@ -305,6 +316,9 @@ pub fn declare_state_packets(input: TokenStream) -> TokenStream {
305316 clientbound_id_match_contents. extend ( quote ! {
306317 _ => unreachable!( "This enum is empty and can't exist." )
307318 } ) ;
319+ clientbound_name_match_contents. extend ( quote ! {
320+ _ => unreachable!( "This enum is empty and can't exist." )
321+ } ) ;
308322 clientbound_write_match_contents. extend ( quote ! {
309323 _ => unreachable!( "This enum is empty and can't exist." )
310324 } ) ;
@@ -338,6 +352,12 @@ pub fn declare_state_packets(input: TokenStream) -> TokenStream {
338352 }
339353 }
340354
355+ fn name( & self ) -> & ' static str {
356+ match self {
357+ #serverbound_name_match_contents
358+ }
359+ }
360+
341361 fn write( & self , buf: & mut impl std:: io:: Write ) -> Result <( ) , std:: io:: Error > {
342362 match self {
343363 #serverbound_write_match_contents
@@ -376,6 +396,12 @@ pub fn declare_state_packets(input: TokenStream) -> TokenStream {
376396 }
377397 }
378398
399+ fn name( & self ) -> & ' static str {
400+ match self {
401+ #clientbound_name_match_contents
402+ }
403+ }
404+
379405 fn write( & self , buf: & mut impl std:: io:: Write ) -> Result <( ) , std:: io:: Error > {
380406 match self {
381407 #clientbound_write_match_contents
0 commit comments