diff options
| author | mat <github@matdoes.dev> | 2021-12-15 13:08:36 -0600 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2021-12-15 13:08:36 -0600 |
| commit | ace140500734d33fe53126086a8d9278fa861e21 (patch) | |
| tree | 7ed5ab284631272afd81ccc2ee2d3b774555a975 /minecraft-protocol/src/packets/login/clientbound_hello_packet.rs | |
| parent | 0d6e4179e6cc16594a4be3ecd62d89411115f319 (diff) | |
| download | azalea-drasl-ace140500734d33fe53126086a8d9278fa861e21.tar.xz | |
isolate packets
Diffstat (limited to 'minecraft-protocol/src/packets/login/clientbound_hello_packet.rs')
| -rw-r--r-- | minecraft-protocol/src/packets/login/clientbound_hello_packet.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/minecraft-protocol/src/packets/login/clientbound_hello_packet.rs b/minecraft-protocol/src/packets/login/clientbound_hello_packet.rs index c0ec85f3..7e69e3ce 100644 --- a/minecraft-protocol/src/packets/login/clientbound_hello_packet.rs +++ b/minecraft-protocol/src/packets/login/clientbound_hello_packet.rs @@ -4,6 +4,8 @@ use tokio::io::BufReader; use crate::{mc_buf, packets::Packet}; +use super::LoginPacket; + #[derive(Hash, Clone, Debug)] pub struct ClientboundHelloPacket { pub server_id: String, @@ -12,16 +14,17 @@ pub struct ClientboundHelloPacket { } impl ClientboundHelloPacket { - fn get(self) -> Packet { - Packet::ClientboundHelloPacket(self) + pub fn get(self) -> LoginPacket { + LoginPacket::ClientboundHelloPacket(self) } - fn write(&self, _buf: &mut Vec<u8>) { + + pub fn write(&self, _buf: &mut Vec<u8>) { panic!("ClientboundHelloPacket::write not implemented") } - async fn read<T: tokio::io::AsyncRead + std::marker::Unpin + std::marker::Send>( + pub async fn read<T: tokio::io::AsyncRead + std::marker::Unpin + std::marker::Send>( buf: &mut BufReader<T>, - ) -> Result<Packet, String> { + ) -> Result<LoginPacket, String> { let server_id = mc_buf::read_utf_with_len(buf, 20).await?; let public_key = mc_buf::read_byte_array(buf).await?; let nonce = mc_buf::read_byte_array(buf).await?; |
