aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src/packets/login/clientbound_hello_packet.rs
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-26 17:55:07 -0500
committermat <github@matdoes.dev>2022-05-26 17:55:07 -0500
commit0530c5757925c615d0529926b1550da05f0669d9 (patch)
tree24b40c461a8117dee019c8941e205f375e3a3c21 /azalea-protocol/src/packets/login/clientbound_hello_packet.rs
parent1e145a82b80fb0402e8a64624454d9bfee77bc72 (diff)
downloadazalea-drasl-0530c5757925c615d0529926b1550da05f0669d9.tar.xz
Fixes
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())
- }
-}