blob: 424c645f71226700935ede90729af3d635d4eaaf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use std::hash::Hash;
use crate::mc_buf;
use super::{ConnectionProtocol, Packet};
#[derive(Hash)]
pub struct ClientIntentionPacket<'a> {
pub protocol_version: u32,
pub hostname: &'a String,
pub port: u16,
/// 1 for status, 2 for login
pub intention: ConnectionProtocol,
}
// implement "Packet" for "ClientIntentionPacket"
impl<'a> Packet for ClientIntentionPacket<'a> {
fn get_id(&self) -> u32 {
0x00
}
// implement "from_reader" for "ClientIntentionPacket"
fn write(&self, buf: &mut Vec<u8>) {
mc_buf::write_varint(buf, self.protocol_version as i32);
mc_buf::write_utf(buf, &self.hostname);
mc_buf::write_short(buf, self.port);
mc_buf::write_varint(buf, self.intention.clone() as i32);
}
fn parse<T: tokio::io::AsyncRead + std::marker::Unpin>(&self, buf: T) -> () {}
}
|