aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/azalea-protocol-macros/src
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-protocol/azalea-protocol-macros/src')
-rwxr-xr-xazalea-protocol/azalea-protocol-macros/src/lib.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/azalea-protocol/azalea-protocol-macros/src/lib.rs b/azalea-protocol/azalea-protocol-macros/src/lib.rs
index b536e73a..5cbf2925 100755
--- a/azalea-protocol/azalea-protocol-macros/src/lib.rs
+++ b/azalea-protocol/azalea-protocol-macros/src/lib.rs
@@ -364,7 +364,7 @@ pub fn declare_state_packets(input: TokenStream) -> TokenStream {
}
}
- /// Read a packet by its id, ConnectionProtocol, and flow
+ /// Read a packet by its id, ConnectionProtocol, and flow.
fn read(
id: u32,
buf: &mut std::io::Cursor<&[u8]>,
@@ -408,7 +408,7 @@ pub fn declare_state_packets(input: TokenStream) -> TokenStream {
}
}
- /// Read a packet by its id, ConnectionProtocol, and flow
+ /// Read a packet by its id, ConnectionProtocol, and flow.
fn read(
id: u32,
buf: &mut std::io::Cursor<&[u8]>,
@@ -422,6 +422,13 @@ pub fn declare_state_packets(input: TokenStream) -> TokenStream {
})
}
}
+
+ impl crate::packets::Packet<#clientbound_state_name> for #clientbound_state_name {
+ /// No-op, exists so you can pass a packet enum when a Packet<> is expected.
+ fn into_variant(self) -> #clientbound_state_name {
+ self
+ }
+ }
});
contents.into()