diff options
Diffstat (limited to 'minecraft-protocol/src/packets')
| -rw-r--r-- | minecraft-protocol/src/packets/game/mod.rs | 41 | ||||
| -rw-r--r-- | minecraft-protocol/src/packets/handshake/mod.rs | 2 |
2 files changed, 40 insertions, 3 deletions
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<u8>) { + match self { + _ => (), + } + } + + /// Read a packet by its id, ConnectionProtocol, and flow + async fn read<T: tokio::io::AsyncRead + std::marker::Unpin + std::marker::Send>( + id: u32, + flow: &PacketFlow, + buf: &mut BufReader<T>, + ) -> Result<GamePacket, String> + 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; |
