From 732de94d7b9f1bf2bc9239c8138a37c53242b470 Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 15 Dec 2021 13:43:57 -0600 Subject: oh yeah it compiles --- minecraft-protocol/src/packets/game/mod.rs | 41 +++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'minecraft-protocol/src/packets/game') diff --git a/minecraft-protocol/src/packets/game/mod.rs b/minecraft-protocol/src/packets/game/mod.rs index 08444697..06d8ae4c 100644 --- a/minecraft-protocol/src/packets/game/mod.rs +++ b/minecraft-protocol/src/packets/game/mod.rs @@ -1,2 +1,41 @@ +use async_trait::async_trait; +use tokio::io::BufReader; + +use crate::connect::PacketFlow; + +use super::ProtocolPacket; + #[derive(Clone, Debug)] -pub enum GamePacket {} +pub enum GamePacket +where + Self: Sized, {} + +#[async_trait] +impl ProtocolPacket for GamePacket { + fn id(&self) -> u32 { + match self { + _ => 0x00, + } + } + + fn write(&self, buf: &mut Vec) { + match self { + _ => (), + } + } + + /// Read a packet by its id, ConnectionProtocol, and flow + async fn read( + id: u32, + flow: &PacketFlow, + buf: &mut BufReader, + ) -> Result + where + Self: Sized, + { + match flow { + PacketFlow::ServerToClient => Err("HandshakePacket::read not implemented".to_string()), + PacketFlow::ClientToServer => Err("HandshakePacket::read not implemented".to_string()), + } + } +} -- cgit v1.2.3