aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src/packets/login/clientbound_hello_packet.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2022-06-08 23:37:54 +0000
committerGitHub <noreply@github.com>2022-06-08 23:37:54 +0000
commit601637bd48fcba826da01725430268f706181449 (patch)
tree5b58723b931450d358d7e4387d87cc8e8b9166b2 /azalea-protocol/src/packets/login/clientbound_hello_packet.rs
parentea7249fb77a8e07d232600081c9c3df5f698d70f (diff)
parentfb1d419a3d4207a293a1ad6001253192f1b4d12f (diff)
downloadazalea-drasl-601637bd48fcba826da01725430268f706181449.tar.xz
Merge pull request #7 from mat-1/1.19
1.19
Diffstat (limited to 'azalea-protocol/src/packets/login/clientbound_hello_packet.rs')
-rwxr-xr-xazalea-protocol/src/packets/login/clientbound_hello_packet.rs36
1 files changed, 5 insertions, 31 deletions
diff --git a/azalea-protocol/src/packets/login/clientbound_hello_packet.rs b/azalea-protocol/src/packets/login/clientbound_hello_packet.rs
index f7de4c21..58d48ffe 100755
--- a/azalea-protocol/src/packets/login/clientbound_hello_packet.rs
+++ b/azalea-protocol/src/packets/login/clientbound_hello_packet.rs
@@ -1,37 +1,11 @@
-use std::{
- hash::Hash,
- io::{Read, Write},
-};
+use packet_macros::LoginPacket;
+use packet_macros::McBuf;
-use super::LoginPacket;
-use crate::mc_buf::Readable;
-
-#[derive(Hash, Clone, Debug)]
+#[derive(Clone, Debug, McBuf, LoginPacket)]
pub struct ClientboundHelloPacket {
+ // TODO: make this len thing work
+ // #[len(20)]
pub server_id: String,
pub public_key: Vec<u8>,
pub nonce: Vec<u8>,
}
-
-impl ClientboundHelloPacket {
- pub fn get(self) -> LoginPacket {
- LoginPacket::ClientboundHelloPacket(self)
- }
-
- pub fn write(&self, _buf: &mut impl Write) -> Result<(), std::io::Error> {
- panic!("ClientboundHelloPacket::write not implemented")
- }
-
- pub fn read(buf: &mut impl Read) -> Result<LoginPacket, String> {
- let server_id = buf.read_utf_with_len(20)?;
- let public_key = buf.read_byte_array()?;
- let nonce = buf.read_byte_array()?;
-
- Ok(ClientboundHelloPacket {
- server_id,
- public_key,
- nonce,
- }
- .get())
- }
-}