aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-07 20:00:59 -0500
committermat <github@matdoes.dev>2022-05-07 20:00:59 -0500
commitd8049a5d0c9a2c79d576785dc1681ae60e44a04b (patch)
tree585e7a3bd0c8535c7cf3e9f2999c132878961b53
parente53ef8b0ddd46b3a85e597e7da57139960304e35 (diff)
downloadazalea-drasl-d8049a5d0c9a2c79d576785dc1681ae60e44a04b.tar.xz
move entity and rotate head packets
-rwxr-xr-xazalea-client/src/connect.rs6
-rw-r--r--azalea-protocol/src/packets/game/clientbound_move_entity_packet.rs11
-rw-r--r--azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs8
-rwxr-xr-xazalea-protocol/src/packets/game/mod.rs4
-rw-r--r--code-generator/packetcodegen.py5
5 files changed, 32 insertions, 2 deletions
diff --git a/azalea-client/src/connect.rs b/azalea-client/src/connect.rs
index a73e0146..0fc7273b 100755
--- a/azalea-client/src/connect.rs
+++ b/azalea-client/src/connect.rs
@@ -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!();
diff --git a/azalea-protocol/src/packets/game/clientbound_move_entity_packet.rs b/azalea-protocol/src/packets/game/clientbound_move_entity_packet.rs
new file mode 100644
index 00000000..285a45a4
--- /dev/null
+++ b/azalea-protocol/src/packets/game/clientbound_move_entity_packet.rs
@@ -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,
+}
diff --git a/azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs b/azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs
new file mode 100644
index 00000000..d423885d
--- /dev/null
+++ b/azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs
@@ -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,
+}
diff --git a/azalea-protocol/src/packets/game/mod.rs b/azalea-protocol/src/packets/game/mod.rs
index db1c0b11..0f7d00d0 100755
--- a/azalea-protocol/src/packets/game/mod.rs
+++ b/azalea-protocol/src/packets/game/mod.rs
@@ -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,
diff --git a/code-generator/packetcodegen.py b/code-generator/packetcodegen.py
index bd8f0b3b..fbb38eeb 100644
--- a/code-generator/packetcodegen.py
+++ b/code-generator/packetcodegen.py
@@ -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']