1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00

fix some packets

This commit is contained in:
mat 2022-05-26 19:12:19 -05:00
parent 7c302b4b29
commit 0c0fec0065
4 changed files with 18 additions and 4829 deletions

View file

@ -200,12 +200,12 @@ impl Client {
let mut state = state.lock().await;
// write p into login.txt
std::io::Write::write_all(
&mut std::fs::File::create("login.txt").unwrap(),
format!("{:#?}", p).as_bytes(),
)
.unwrap();
// // write p into login.txt
// std::io::Write::write_all(
// &mut std::fs::File::create("login.txt").unwrap(),
// format!("{:#?}", p).as_bytes(),
// )
// .unwrap();
state.player.entity.id = p.player_id;
@ -444,6 +444,9 @@ impl Client {
GamePacket::ClientboundLevelParticlesPacket(p) => {
println!("Got level particles packet {:?}", p);
}
GamePacket::ClientboundServerDataPacket(p) => {
println!("Got server data packet {:?}", p);
}
_ => panic!("Unexpected packet {:?}", packet),
}
}

View file

@ -354,7 +354,7 @@ pub fn declare_state_packets(input: TokenStream) -> TokenStream {
});
}
for PacketIdPair { id, module, name } in input.clientbound.packets {
let name_litstr = syn::LitStr::new(&name.to_string(), name.span());
// let name_litstr = syn::LitStr::new(&name.to_string(), name.span());
enum_contents.extend(quote! {
#name(#module::#name),
});
@ -365,10 +365,7 @@ pub fn declare_state_packets(input: TokenStream) -> TokenStream {
#state_name::#name(packet) => packet.write(buf),
});
clientbound_read_match_contents.extend(quote! {
#id => {
println!("reading packet {}", #name_litstr);
#module::#name::read(buf)?
},
#id => #module::#name::read(buf)?,
});
}

View file

@ -4,9 +4,9 @@ use uuid::Uuid;
#[derive(Clone, Debug, McBuf, GamePacket)]
pub struct ClientboundAddEntityPacket {
#[var]
pub id: i32,
pub id: u32,
pub uuid: Uuid,
// TODO: have an entity type struct
// TODO: have an entity type enum/struct
#[var]
pub entity_type: i32,
pub x: f64,
@ -14,9 +14,10 @@ pub struct ClientboundAddEntityPacket {
pub z: f64,
pub x_rot: i8,
pub y_rot: i8,
// pub y_head_rot: i8,
pub y_head_rot: i8,
#[var]
pub data: i32,
pub x_vel: u16,
pub y_vel: u16,
pub z_vel: u16,
pub x_vel: i16,
pub y_vel: i16,
pub z_vel: i16,
}

4812
login.txt

File diff suppressed because it is too large Load diff