Update packets

This commit is contained in:
Ryan 2022-06-23 04:50:27 -07:00
parent a9cdff3dca
commit a58258e8d3
3 changed files with 49 additions and 26 deletions

View file

@ -156,8 +156,6 @@ pub struct Client {
new_game_mode: GameMode,
old_game_mode: GameMode,
settings: Option<Settings>,
// TODO: latency
// TODO: time, weather
}
pub struct ClientMut<'a>(&'a mut Client);

View file

@ -434,12 +434,12 @@ pub mod login {
def_struct! {
LoginStart 0x00 {
username: BoundedString<3, 16>,
sig_data: Option<LoginStartSignatureData>,
sig_data: Option<SignatureData>,
}
}
def_struct! {
LoginStartSignatureData {
SignatureData {
timestamp: i64,
public_key: Vec<u8>,
signature: Vec<u8>,
@ -472,6 +472,8 @@ pub mod login {
/// Packets and types used during the play state.
pub mod play {
pub mod s2c {
use crate::packets::login::{s2c::Property, c2s::SignatureData};
use super::super::*;
def_struct! {
@ -635,28 +637,6 @@ pub mod play {
}
}
def_struct! {
ChatMessageClientbound 0x30 {
message: Text,
typ: ChatMessageType,
sender: Uuid,
// TODO more fields
}
}
def_enum! {
ChatMessageType: VarInt {
Chat = 0,
SystemMessage = 1,
GameInfo = 2,
SayCommand = 3,
MsgCommand = 4,
TeamMsgCommand = 5,
EmoteCommand = 6,
TellrawCommand = 7,
}
}
def_struct! {
ClearTitles 0x0d {
reset: bool,
@ -1014,6 +994,50 @@ pub mod play {
}
}
def_struct! {
ChatMessageClientbound 0x30 {
message: Text,
typ: ChatMessageType,
sender: Uuid,
// TODO more fields
}
}
def_enum! {
ChatMessageType: VarInt {
Chat = 0,
SystemMessage = 1,
GameInfo = 2,
SayCommand = 3,
MsgCommand = 4,
TeamMsgCommand = 5,
EmoteCommand = 6,
TellrawCommand = 7,
}
}
def_enum! {
PlayerInfo 0x34: VarInt {
AddPlayer: Vec<PlayerInfoAddPlayer> = 0,
UpdateGameMode: Vec<(Uuid, GameMode)> = 1,
UpdateLatency: Vec<(Uuid, VarInt)> = 2,
UpdateDisplayName: Vec<(Uuid, Option<Text>)> = 3,
RemovePlayer: Vec<Uuid> = 4,
}
}
def_struct! {
PlayerInfoAddPlayer {
uuid: Uuid,
username: BoundedString<3, 16>,
properties: Vec<Property>,
game_mode: GameMode,
ping: VarInt,
display_name: Option<Text>,
sig_data: Option<SignatureData>,
}
}
def_struct! {
PlayerPositionAndLook 0x36 {
position: Vec3<f64>,

View file

@ -183,6 +183,7 @@ impl<'a> WorldMut<'a> {
pub struct WorldMeta {
dimension: DimensionId,
is_flat: bool,
// TODO: time, weather
}
impl WorldMeta {