[][src]Trait ozelot::Packet

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>>; }

Trait for the two enums ClientboundPacket and ServerboundPacket

Required methods

fn deserialize<R: Read>(r: &mut R, state: &ClientState) -> Result<Self>

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

fn get_packet_name(&self) -> &str

Returns the packet's name

fn get_clientstate(&self) -> ClientState

Returns the connection state in which the packet can be sent

fn get_id(&self) -> i32

Returns the ID of the packet

fn to_u8(&self) -> Result<Vec<u8>>

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

Loading content...

Implementors

impl Packet for ClientboundPacket[src]

impl Packet for ServerboundPacket[src]

Loading content...