diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-09-30 10:56:34 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-30 10:56:34 -0500 |
| commit | 643fcb98c0e6cdc63218dd39960d9053b209d9a6 (patch) | |
| tree | 6bddb7fe39b8fcc3ab3fb2665574533bb227898a /azalea-protocol/src/packets | |
| parent | a80d8d1b242430c4a251876fa67bfd26af7a0de9 (diff) | |
| download | azalea-drasl-643fcb98c0e6cdc63218dd39960d9053b209d9a6.tar.xz | |
1.21.9 (#235)
* start updating to 25w33a
* 1.21.9-pre2
* clippy
* cleanup, and fix c_explode and c_player_rotation
* mc update should be in Changed section in the changelog
* 1.21.9
Diffstat (limited to 'azalea-protocol/src/packets')
20 files changed, 109 insertions, 62 deletions
diff --git a/azalea-protocol/src/packets/config/c_code_of_conduct.rs b/azalea-protocol/src/packets/config/c_code_of_conduct.rs new file mode 100644 index 00000000..03f133a8 --- /dev/null +++ b/azalea-protocol/src/packets/config/c_code_of_conduct.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, PartialEq, ClientboundConfigPacket)] +pub struct ClientboundCodeOfConduct { + pub code_of_conduct: String, +} diff --git a/azalea-protocol/src/packets/config/mod.rs b/azalea-protocol/src/packets/config/mod.rs index 58e00ad5..863655f2 100644 --- a/azalea-protocol/src/packets/config/mod.rs +++ b/azalea-protocol/src/packets/config/mod.rs @@ -24,6 +24,7 @@ declare_state_packets!(ConfigPacket, server_links, clear_dialog, show_dialog, + code_of_conduct, ], Serverbound => [ client_information, @@ -35,5 +36,6 @@ declare_state_packets!(ConfigPacket, resource_pack, select_known_packs, custom_click_action, + accept_code_of_conduct, ] ); diff --git a/azalea-protocol/src/packets/config/s_accept_code_of_conduct.rs b/azalea-protocol/src/packets/config/s_accept_code_of_conduct.rs new file mode 100644 index 00000000..c5fea5dd --- /dev/null +++ b/azalea-protocol/src/packets/config/s_accept_code_of_conduct.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, PartialEq, ServerboundConfigPacket)] +pub struct ServerboundAcceptCodeOfConduct; diff --git a/azalea-protocol/src/packets/game/c_add_entity.rs b/azalea-protocol/src/packets/game/c_add_entity.rs index e71499c5..7fb680a1 100644 --- a/azalea-protocol/src/packets/game/c_add_entity.rs +++ b/azalea-protocol/src/packets/game/c_add_entity.rs @@ -1,5 +1,5 @@ use azalea_buf::AzBuf; -use azalea_core::{delta::PositionDelta8, position::Vec3, resource_location::ResourceLocation}; +use azalea_core::{delta::LpVec3, position::Vec3, resource_location::ResourceLocation}; use azalea_entity::{EntityBundle, metadata::apply_default_metadata}; use azalea_protocol_macros::ClientboundGamePacket; use azalea_world::MinecraftEntityId; @@ -13,6 +13,7 @@ pub struct ClientboundAddEntity { pub uuid: Uuid, pub entity_type: azalea_registry::EntityKind, pub position: Vec3, + pub movement: LpVec3, pub x_rot: i8, pub y_rot: i8, pub y_head_rot: i8, @@ -26,7 +27,6 @@ pub struct ClientboundAddEntity { /// for more information about this field. #[var] pub data: u32, - pub velocity: PositionDelta8, } impl ClientboundAddEntity { diff --git a/azalea-protocol/src/packets/game/c_debug_block_value.rs b/azalea-protocol/src/packets/game/c_debug_block_value.rs new file mode 100644 index 00000000..1c78b6d5 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_debug_block_value.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_core::position::BlockPos; +use azalea_protocol_macros::ClientboundGamePacket; + +use crate::common::debug_subscription::DebugSubscriptionUpdate; + +#[derive(Clone, Debug, AzBuf, PartialEq, ClientboundGamePacket)] +pub struct ClientboundDebugBlockValue { + pub block_pos: BlockPos, + pub update: DebugSubscriptionUpdate, +} diff --git a/azalea-protocol/src/packets/game/c_debug_chunk_value.rs b/azalea-protocol/src/packets/game/c_debug_chunk_value.rs new file mode 100644 index 00000000..7948c733 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_debug_chunk_value.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_core::position::ChunkPos; +use azalea_protocol_macros::ClientboundGamePacket; + +use crate::common::debug_subscription::DebugSubscriptionUpdate; + +#[derive(Clone, Debug, AzBuf, PartialEq, ClientboundGamePacket)] +pub struct ClientboundDebugChunkValue { + pub chunk_pos: ChunkPos, + pub update: DebugSubscriptionUpdate, +} diff --git a/azalea-protocol/src/packets/game/c_debug_entity_value.rs b/azalea-protocol/src/packets/game/c_debug_entity_value.rs new file mode 100644 index 00000000..a57e5548 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_debug_entity_value.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; +use azalea_world::MinecraftEntityId; + +use crate::common::debug_subscription::DebugSubscriptionUpdate; + +#[derive(Clone, Debug, AzBuf, PartialEq, ClientboundGamePacket)] +pub struct ClientboundDebugEntityValue { + pub entity_id: MinecraftEntityId, + pub update: DebugSubscriptionUpdate, +} diff --git a/azalea-protocol/src/packets/game/c_debug_event.rs b/azalea-protocol/src/packets/game/c_debug_event.rs new file mode 100644 index 00000000..c53e5e12 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_debug_event.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +use crate::common::debug_subscription::DebugSubscriptionEvent; + +#[derive(Clone, Debug, AzBuf, PartialEq, ClientboundGamePacket)] +pub struct ClientboundDebugEvent { + pub event: DebugSubscriptionEvent, +} diff --git a/azalea-protocol/src/packets/game/c_debug_sample.rs b/azalea-protocol/src/packets/game/c_debug_sample.rs index 8c170419..67769b1b 100644 --- a/azalea-protocol/src/packets/game/c_debug_sample.rs +++ b/azalea-protocol/src/packets/game/c_debug_sample.rs @@ -1,10 +1,13 @@ use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; -use super::s_debug_sample_subscription::RemoteDebugSampleType; - #[derive(Clone, Debug, AzBuf, PartialEq, ClientboundGamePacket)] pub struct ClientboundDebugSample { pub sample: Vec<u64>, pub debug_sample_type: RemoteDebugSampleType, } + +#[derive(Clone, Copy, Debug, AzBuf, PartialEq)] +pub enum RemoteDebugSampleType { + TickTime, +} diff --git a/azalea-protocol/src/packets/game/c_explode.rs b/azalea-protocol/src/packets/game/c_explode.rs index e6ffa15c..15e036ea 100644 --- a/azalea-protocol/src/packets/game/c_explode.rs +++ b/azalea-protocol/src/packets/game/c_explode.rs @@ -7,7 +7,17 @@ use azalea_registry::SoundEvent; #[derive(Clone, Debug, AzBuf, PartialEq, ClientboundGamePacket)] pub struct ClientboundExplode { pub center: Vec3, - pub knockback: Option<Vec3>, + pub radius: f32, + pub block_count: i32, + pub player_knockback: Option<Vec3>, pub explosion_particle: Particle, pub explosion_sound: SoundEvent, + pub block_particles: Vec<ExplosionParticleInfo>, +} + +#[derive(Clone, Debug, AzBuf, PartialEq)] +pub struct ExplosionParticleInfo { + pub particle: Particle, + pub scaling: f32, + pub speed: f32, } diff --git a/azalea-protocol/src/packets/game/c_game_test_highlight_pos.rs b/azalea-protocol/src/packets/game/c_game_test_highlight_pos.rs new file mode 100644 index 00000000..c7c117df --- /dev/null +++ b/azalea-protocol/src/packets/game/c_game_test_highlight_pos.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_core::position::BlockPos; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, PartialEq, ClientboundGamePacket)] +pub struct ClientboundGameTestHighlightPos { + pub absolute_pos: BlockPos, + pub relative_pos: BlockPos, +} diff --git a/azalea-protocol/src/packets/game/c_level_particles.rs b/azalea-protocol/src/packets/game/c_level_particles.rs index b93e0de8..8fd05138 100644 --- a/azalea-protocol/src/packets/game/c_level_particles.rs +++ b/azalea-protocol/src/packets/game/c_level_particles.rs @@ -15,23 +15,3 @@ pub struct ClientboundLevelParticles { pub count: u32, pub particle: Particle, } - -#[cfg(test)] -mod tests { - use std::io::Cursor; - - use azalea_buf::AzaleaRead; - - use super::*; - - #[test] - fn test_c_level_particles_packet() { - #[rustfmt::skip] - let slice = [0, 0, 192, 159, 104, 133, 28, 126, 5, 107, 192, 59, 0, 0, 0, 0, 0, 0, 64, 140, 27, 255, 120, 249, 188, 204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 47, 1, 251, 245, 15, 64, 29, 194, 144, 12]; - let mut bytes = Cursor::new(slice.as_slice()); - - let packet = ClientboundLevelParticles::azalea_read(&mut bytes).unwrap(); - println!("{packet:?}"); - assert_eq!(bytes.position(), slice.len() as u64); - } -} diff --git a/azalea-protocol/src/packets/game/c_player_info_update.rs b/azalea-protocol/src/packets/game/c_player_info_update.rs index 6f0ae3f7..64a2b5b0 100644 --- a/azalea-protocol/src/packets/game/c_player_info_update.rs +++ b/azalea-protocol/src/packets/game/c_player_info_update.rs @@ -1,9 +1,9 @@ use std::{ - collections::HashMap, io::{self, Cursor, Write}, + sync::Arc, }; -use azalea_auth::game_profile::{GameProfile, ProfilePropertyValue}; +use azalea_auth::game_profile::{GameProfile, GameProfileProperties}; use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; use azalea_chat::FormattedText; use azalea_core::{bitset::FixedBitSet, game_type::GameMode}; @@ -33,7 +33,7 @@ pub struct PlayerInfoEntry { #[derive(Clone, Debug, AzBuf)] pub struct AddPlayerAction { pub name: String, - pub properties: HashMap<String, ProfilePropertyValue>, + pub properties: GameProfileProperties, } #[derive(Clone, Debug, AzBuf)] pub struct InitializeChatAction { @@ -80,7 +80,7 @@ impl AzaleaRead for ClientboundPlayerInfoUpdate { if actions.add_player { let action = AddPlayerAction::azalea_read(buf)?; entry.profile.name = action.name; - entry.profile.properties = action.properties.into(); + entry.profile.properties = Arc::new(action.properties); } if actions.initialize_chat { let action = InitializeChatAction::azalea_read(buf)?; diff --git a/azalea-protocol/src/packets/game/c_player_rotation.rs b/azalea-protocol/src/packets/game/c_player_rotation.rs index c3d72720..fc1da719 100644 --- a/azalea-protocol/src/packets/game/c_player_rotation.rs +++ b/azalea-protocol/src/packets/game/c_player_rotation.rs @@ -1,8 +1,10 @@ use azalea_buf::AzBuf; -use azalea_entity::LookDirection; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, AzBuf, PartialEq, ClientboundGamePacket)] pub struct ClientboundPlayerRotation { - pub look_direction: LookDirection, + pub y_rot: f32, + pub relative_y: bool, + pub x_rot: f32, + pub relative_x: bool, } diff --git a/azalea-protocol/src/packets/game/c_set_entity_data.rs b/azalea-protocol/src/packets/game/c_set_entity_data.rs index 666f6643..f51a42a4 100644 --- a/azalea-protocol/src/packets/game/c_set_entity_data.rs +++ b/azalea-protocol/src/packets/game/c_set_entity_data.rs @@ -19,20 +19,6 @@ mod tests { use super::*; #[test] - fn test_read_write_hypixel_entity_data() { - let contents = [161, 226, 1, 10, 18, 1, 20, 38, 124, 175, 198, 255]; - let mut buf = Cursor::new(contents.as_slice()); - let packet = ClientboundSetEntityData::azalea_read(&mut buf).unwrap(); - println!("{packet:?}"); - - assert_eq!(buf.position(), contents.len() as u64); - - let mut buf = Vec::new(); - packet.write(&mut buf).unwrap(); - assert_eq!(buf, contents); - } - - #[test] fn test_read_hypixel_entity_data_2() { let contents = [ 161, 21, 2, 6, 0, 5, 8, 0, 6, 21, 0, 7, 1, 0, 1, 1, 172, 2, 3, 8, 0, 4, 8, 0, 9, 1, 0, diff --git a/azalea-protocol/src/packets/game/c_set_entity_motion.rs b/azalea-protocol/src/packets/game/c_set_entity_motion.rs index ecbe17a6..a48ec885 100644 --- a/azalea-protocol/src/packets/game/c_set_entity_motion.rs +++ b/azalea-protocol/src/packets/game/c_set_entity_motion.rs @@ -1,5 +1,5 @@ use azalea_buf::AzBuf; -use azalea_core::delta::PositionDelta8; +use azalea_core::delta::LpVec3; use azalea_protocol_macros::ClientboundGamePacket; use azalea_world::MinecraftEntityId; @@ -7,5 +7,5 @@ use azalea_world::MinecraftEntityId; pub struct ClientboundSetEntityMotion { #[var] pub id: MinecraftEntityId, - pub delta: PositionDelta8, + pub delta: LpVec3, } diff --git a/azalea-protocol/src/packets/game/mod.rs b/azalea-protocol/src/packets/game/mod.rs index 264892b0..60de984d 100644 --- a/azalea-protocol/src/packets/game/mod.rs +++ b/azalea-protocol/src/packets/game/mod.rs @@ -31,6 +31,10 @@ declare_state_packets!(GamePacket, custom_chat_completions, custom_payload, damage_event, + debug_block_value, + debug_chunk_value, + debug_entity_value, + debug_event, debug_sample, delete_chat, disconnect, @@ -40,6 +44,7 @@ declare_state_packets!(GamePacket, explode, forget_level_chunk, game_event, + game_test_highlight_pos, horse_screen_open, hurt_animation, initialize_border, @@ -163,7 +168,7 @@ declare_state_packets!(GamePacket, container_slot_state_changed, cookie_response, custom_payload, - debug_sample_subscription, + debug_subscription_request, edit_book, entity_tag_query, interact, diff --git a/azalea-protocol/src/packets/game/s_debug_sample_subscription.rs b/azalea-protocol/src/packets/game/s_debug_sample_subscription.rs deleted file mode 100644 index f2b505f3..00000000 --- a/azalea-protocol/src/packets/game/s_debug_sample_subscription.rs +++ /dev/null @@ -1,12 +0,0 @@ -use azalea_buf::AzBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, AzBuf, PartialEq, ServerboundGamePacket)] -pub struct ServerboundDebugSampleSubscription { - pub sample_type: RemoteDebugSampleType, -} - -#[derive(Clone, Copy, Debug, AzBuf, PartialEq)] -pub enum RemoteDebugSampleType { - TickTime, -} diff --git a/azalea-protocol/src/packets/game/s_debug_subscription_request.rs b/azalea-protocol/src/packets/game/s_debug_subscription_request.rs new file mode 100644 index 00000000..ea31b113 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_debug_subscription_request.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; +use azalea_registry::DebugSubscription; + +#[derive(Clone, Debug, AzBuf, PartialEq, ServerboundGamePacket)] +pub struct ServerboundDebugSubscriptionRequest { + pub subscriptions: Vec<DebugSubscription>, +} diff --git a/azalea-protocol/src/packets/mod.rs b/azalea-protocol/src/packets/mod.rs index 26369bdb..61c0113e 100644 --- a/azalea-protocol/src/packets/mod.rs +++ b/azalea-protocol/src/packets/mod.rs @@ -11,8 +11,8 @@ use azalea_buf::{AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; use crate::read::ReadPacketError; -pub const PROTOCOL_VERSION: i32 = 772; -pub const VERSION_NAME: &str = "1.21.8"; +pub const PROTOCOL_VERSION: i32 = 773; +pub const VERSION_NAME: &str = "1.21.9"; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum ConnectionProtocol { |
