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 ++++++++++++++++++++++++- minecraft-protocol/src/packets/handshake/mod.rs | 2 -- 2 files changed, 40 insertions(+), 3 deletions(-) (limited to 'minecraft-protocol/src/packets') 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()), + } + } +} diff --git a/minecraft-protocol/src/packets/handshake/mod.rs b/minecraft-protocol/src/packets/handshake/mod.rs index 792588b5..01010e1e 100644 --- a/minecraft-protocol/src/packets/handshake/mod.rs +++ b/minecraft-protocol/src/packets/handshake/mod.rs @@ -1,7 +1,5 @@ pub mod client_intention_packet; -use std::f32::consts::E; - use async_trait::async_trait; use tokio::io::BufReader; -- cgit v1.2.3