chunkedge_protocol/packets/handshake/
intention_c2s.rs

1use chunkedge_binary::{Bounded, Decode, Encode, VarInt};
2
3use crate::{Packet, PacketState};
4
5#[derive(Clone, Debug, Encode, Decode, Packet)]
6#[packet(state = PacketState::Handshake)]
7/// This packet causes the server to switch into the target state.
8/// It should be sent right after opening the TCP connection to prevent the
9/// server from disconnecting.
10pub struct IntentionC2s<'a> {
11    pub protocol_version: VarInt,
12    pub server_address: Bounded<&'a str, 255>,
13    pub server_port: u16,
14    pub intent: HandShakeIntent,
15}
16
17#[derive(Copy, Clone, Debug, PartialEq, Eq, Encode, Decode)]
18pub enum HandShakeIntent {
19    #[packet(tag = 1)]
20    Status,
21    #[packet(tag = 2)]
22    Login,
23    #[packet(tag = 3)]
24    Transfer,
25}