Trait ozelot::Packet

source ·
pub trait Packet: Sized {
    fn deserialize<R: Read>(r: &mut R, state: &ClientState) -> Result<Self>;
    fn get_packet_name(&self) -> &str;
    fn get_clientstate(&self) -> ClientState;
    fn get_id(&self) -> i32;
    fn to_u8(&self) -> Result<Vec<u8>>;
}
Expand description

Trait for the two enums ClientboundPacket and ServerboundPacket

Required Methods§

Deserializes a Read type into a packet. You usually won’t need to use this.

Returns the packet’s name

Returns the connection state in which the packet can be sent

Returns the ID of the packet

Serializes the packet into Vec. You usually won’t need to use this.

Implementors§