blob: 80c9ce663639caf086959ec4ae14b01531e990d9 (
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
|
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) -> u8 {
0x00
}
// implement "from_reader" for "ClientIntentionPacket"
fn write(&self, buf: &mut Vec<u8>) {
mc_buf::write_varint(buf, self.protocol_version);
mc_buf::write_utf(buf, &self.hostname);
mc_buf::write_short(buf, self.port);
mc_buf::write_varint(buf, self.intention.clone() as u32);
}
}
|