Before only Clientbound Packet IDs where parsed from JSON, Now Serverbound Packet IDs are parsed from JSON as well. This makes porting to new minecraft version much easier
22 lines
465 B
Rust
22 lines
465 B
Rust
use pumpkin_macros::server_packet;
|
|
|
|
use crate::{
|
|
bytebuf::{ByteBuffer, DeserializerError},
|
|
ServerPacket,
|
|
};
|
|
|
|
#[server_packet("login:hello")]
|
|
pub struct SLoginStart {
|
|
pub name: String, // 16
|
|
pub uuid: uuid::Uuid,
|
|
}
|
|
|
|
impl ServerPacket for SLoginStart {
|
|
fn read(bytebuf: &mut ByteBuffer) -> Result<Self, DeserializerError> {
|
|
Ok(Self {
|
|
name: bytebuf.get_string_len(16)?,
|
|
uuid: bytebuf.get_uuid()?,
|
|
})
|
|
}
|
|
}
|