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

move entity and rotate head packets

This commit is contained in:
mat 2022-05-07 20:00:59 -05:00
parent e53ef8b0dd
commit d8049a5d0c
5 changed files with 32 additions and 2 deletions

View file

@ -282,6 +282,12 @@ impl Client {
GamePacket::ClientboundUpdateAdvancementsPacket(p) => {
println!("Got update advancements packet {:?}", p);
}
GamePacket::ClientboundRotateHeadPacket(p) => {
println!("Got rotate head packet {:?}", p);
}
GamePacket::ClientboundMoveEntityPacket(p) => {
println!("Got move entity packet {:?}", p);
}
_ => panic!("Unexpected packet {:?}", packet),
}
println!();

View file

@ -0,0 +1,11 @@
use packet_macros::GamePacket;
#[derive(Clone, Debug, GamePacket)]
pub struct ClientboundMoveEntityPacket {
#[var]
pub entity_id: u32,
pub y_rot: i16,
pub x_rot: i16,
pub z_rot: i16,
pub on_ground: bool,
}

View file

@ -0,0 +1,8 @@
use packet_macros::GamePacket;
#[derive(Clone, Debug, GamePacket)]
pub struct ClientboundRotateHeadPacket {
#[var]
pub entity_id: u32,
pub y_head_rot: i8,
}

View file

@ -12,10 +12,12 @@ pub mod clientbound_initialize_border_packet;
pub mod clientbound_level_chunk_with_light_packet;
pub mod clientbound_light_update_packet;
pub mod clientbound_login_packet;
pub mod clientbound_move_entity_packet;
pub mod clientbound_player_abilities_packet;
pub mod clientbound_player_info_packet;
pub mod clientbound_player_position_packet;
pub mod clientbound_recipe_packet;
pub mod clientbound_rotate_head_packet;
pub mod clientbound_set_carried_item_packet;
pub mod clientbound_set_chunk_cache_center;
pub mod clientbound_set_default_spawn_position_packet;
@ -53,10 +55,12 @@ declare_state_packets!(
0x22: clientbound_level_chunk_with_light_packet::ClientboundLevelChunkWithLightPacket,
0x25: clientbound_light_update_packet::ClientboundLightUpdatePacket,
0x26: clientbound_login_packet::ClientboundLoginPacket,
0x29: clientbound_move_entity_packet::ClientboundMoveEntityPacket,
0x32: clientbound_player_abilities_packet::ClientboundPlayerAbilitiesPacket,
0x36: clientbound_player_info_packet::ClientboundPlayerInfoPacket,
0x38: clientbound_player_position_packet::ClientboundPlayerPositionPacket,
0x39: clientbound_recipe_packet::ClientboundRecipePacket,
0x3e: clientbound_rotate_head_packet::ClientboundRotateHeadPacket,
0x48: clientbound_set_carried_item_packet::ClientboundSetCarriedItemPacket,
0x49: clientbound_set_chunk_cache_center::ClientboundSetChunkCacheCenterPacket,
0x4a: clientbound_update_view_distance_packet::ClientboundUpdateViewDistancePacket,

View file

@ -87,7 +87,7 @@ def generate(burger_packets, mappings: Mappings, target_packet_id, target_packet
f'#[derive(Clone, Debug, {to_camel_case(state)}Packet)]')
uses.add(f'packet_macros::{to_camel_case(state)}Packet')
obfuscated_class_name = packet['class'].split('.')[0]
obfuscated_class_name = packet['class'].split('.')[0].split('$')[0]
class_name = mappings.get_class(
obfuscated_class_name).split('.')[-1].split('$')[0]
@ -103,7 +103,8 @@ def generate(burger_packets, mappings: Mappings, target_packet_id, target_packet
field_name = mappings.get_field(
obfuscated_class_name, obfuscated_field_name)
if not field_name:
generated_packet_code.append(f'// TODO: {instruction}')
generated_packet_code.append(
f'// TODO: unknown field {instruction}')
continue
field_type = instruction['type']