diff options
| author | mat <github@matdoes.dev> | 2022-01-02 17:07:01 -0600 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-01-02 17:07:01 -0600 |
| commit | bb566aa54131a23b6d9e605c81a8ff4d1d1c21d7 (patch) | |
| tree | 157b88ee64215516e27d9f765513d3aa4fef0d64 /azalea-protocol/packet-macros/src | |
| parent | bb57273f48294355d7ac863c291d80878f711c16 (diff) | |
| download | azalea-drasl-bb566aa54131a23b6d9e605c81a8ff4d1d1c21d7.tar.xz | |
implement for Vec<u8>
Diffstat (limited to 'azalea-protocol/packet-macros/src')
| -rw-r--r-- | azalea-protocol/packet-macros/src/lib.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/azalea-protocol/packet-macros/src/lib.rs b/azalea-protocol/packet-macros/src/lib.rs index 22c39ea9..5b2088a1 100644 --- a/azalea-protocol/packet-macros/src/lib.rs +++ b/azalea-protocol/packet-macros/src/lib.rs @@ -29,9 +29,6 @@ fn as_packet_derive( quote! { buf.write_utf(&self.#field_name)?; } } else if path.is_ident("ResourceLocation") { quote! { buf.write_resource_location(&self.#field_name)?; } - // i don't know how to do this in a way that isn't terrible - } else if path.to_token_stream().to_string() == "Vec < u8 >" { - quote! { buf.write_bytes(&self.#field_name)?; } } else if path.is_ident("u32") { if f.attrs.iter().any(|attr| attr.path.is_ident("varint")) { quote! { buf.write_varint(self.#field_name as i32)?; } @@ -49,7 +46,7 @@ fn as_packet_derive( } } else { quote! { - crate::mc_buf::McBufVarintWritable::write_into(&self.#field_name, buf)?; + crate::mc_buf::McBufWritable::write_into(&self.#field_name, buf)?; } } @@ -77,8 +74,6 @@ fn as_packet_derive( quote! { let #field_name = buf.read_utf().await?; } } else if path.is_ident("ResourceLocation") { quote! { let #field_name = buf.read_resource_location().await?; } - } else if path.to_token_stream().to_string() == "Vec < u8 >" { - quote! { let #field_name = buf.read_bytes().await?; } } else if path.is_ident("u32") { if f.attrs.iter().any(|a| a.path.is_ident("varint")) { quote! { let #field_name = buf.read_varint().await? as u32; } |
