diff options
| author | mat <git@matdoes.dev> | 2025-06-17 06:49:07 -1200 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-06-17 06:49:07 -1200 |
| commit | ffbe7a3e426e66c21c7156780728f96f8277c68a (patch) | |
| tree | 5358ab47c013cc848dd7d24781676062fc87da4e /azalea-protocol/src | |
| parent | 319d144995e0ca635806941cbb5d6ceaf0fcf515 (diff) | |
| download | azalea-drasl-ffbe7a3e426e66c21c7156780728f96f8277c68a.tar.xz | |
1.21.6 (#215)
Diffstat (limited to 'azalea-protocol/src')
| -rw-r--r-- | azalea-protocol/src/packets/config/c_clear_dialog.rs | 5 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/config/c_show_dialog.rs | 9 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/config/mod.rs | 53 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/config/s_custom_click_action.rs | 9 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/game/c_clear_dialog.rs | 5 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/game/c_commands.rs | 40 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/game/c_show_dialog.rs | 9 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/game/c_waypoint.rs | 90 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/game/mod.rs | 395 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/game/s_change_game_mode.rs | 8 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/game/s_custom_click_action.rs | 9 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/game/s_player_command.rs | 16 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/handshake/mod.rs | 2 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/login/mod.rs | 22 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/mod.rs | 6 | ||||
| -rw-r--r-- | azalea-protocol/src/packets/status/mod.rs | 8 |
16 files changed, 423 insertions, 263 deletions
diff --git a/azalea-protocol/src/packets/config/c_clear_dialog.rs b/azalea-protocol/src/packets/config/c_clear_dialog.rs new file mode 100644 index 00000000..7114cc28 --- /dev/null +++ b/azalea-protocol/src/packets/config/c_clear_dialog.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundClearDialog {} diff --git a/azalea-protocol/src/packets/config/c_show_dialog.rs b/azalea-protocol/src/packets/config/c_show_dialog.rs new file mode 100644 index 00000000..7933f960 --- /dev/null +++ b/azalea-protocol/src/packets/config/c_show_dialog.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundConfigPacket; +use azalea_registry::Holder; +use simdnbt::owned::Nbt; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundShowDialog { + pub dialog: Holder<azalea_registry::Dialog, Nbt>, +} diff --git a/azalea-protocol/src/packets/config/mod.rs b/azalea-protocol/src/packets/config/mod.rs index e7aea8fd..58e00ad5 100644 --- a/azalea-protocol/src/packets/config/mod.rs +++ b/azalea-protocol/src/packets/config/mod.rs @@ -5,32 +5,35 @@ use azalea_protocol_macros::declare_state_packets; declare_state_packets!(ConfigPacket, Clientbound => [ - cookie_request, // 0x00 - custom_payload, // 0x01 - disconnect, // 0x02 - finish_configuration, // 0x03 - keep_alive, // 0x04 - ping, // 0x05 - reset_chat, // 0x06 - registry_data, // 0x07 - resource_pack_pop, // 0x08 - resource_pack_push, // 0x09 - store_cookie, // 0x0A - transfer, // 0x0B - update_enabled_features, // 0x0C - update_tags, // 0x0D - select_known_packs, // 0x0E - custom_report_details, // 0x0F - server_links, // 0x10 + cookie_request, + custom_payload, + disconnect, + finish_configuration, + keep_alive, + ping, + reset_chat, + registry_data, + resource_pack_pop, + resource_pack_push, + store_cookie, + transfer, + update_enabled_features, + update_tags, + select_known_packs, + custom_report_details, + server_links, + clear_dialog, + show_dialog, ], Serverbound => [ - client_information, // 0x00 - cookie_response, // 0x01 - custom_payload, // 0x02 - finish_configuration, // 0x03 - keep_alive, // 0x04 - pong, // 0x05 - resource_pack, // 0x06 - select_known_packs, // 0x07 + client_information, + cookie_response, + custom_payload, + finish_configuration, + keep_alive, + pong, + resource_pack, + select_known_packs, + custom_click_action, ] ); diff --git a/azalea-protocol/src/packets/config/s_custom_click_action.rs b/azalea-protocol/src/packets/config/s_custom_click_action.rs new file mode 100644 index 00000000..4c168884 --- /dev/null +++ b/azalea-protocol/src/packets/config/s_custom_click_action.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ServerboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ServerboundConfigPacket)] +pub struct ServerboundCustomClickAction { + pub id: ResourceLocation, + pub payload: Option<String>, +} diff --git a/azalea-protocol/src/packets/game/c_clear_dialog.rs b/azalea-protocol/src/packets/game/c_clear_dialog.rs new file mode 100644 index 00000000..98aaf8cf --- /dev/null +++ b/azalea-protocol/src/packets/game/c_clear_dialog.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundClearDialog; diff --git a/azalea-protocol/src/packets/game/c_commands.rs b/azalea-protocol/src/packets/game/c_commands.rs index d2fa79a7..7eeff658 100644 --- a/azalea-protocol/src/packets/game/c_commands.rs +++ b/azalea-protocol/src/packets/game/c_commands.rs @@ -18,6 +18,7 @@ pub struct BrigadierNodeStub { pub children: Vec<u32>, pub redirect_node: Option<u32>, pub node_type: NodeType, + pub is_restricted: bool, } #[derive(Debug, Clone, Eq)] @@ -91,8 +92,8 @@ pub enum BrigadierString { GreedyPhrase = 2, } -// see ArgumentTypeInfo -#[derive(Debug, Clone, AzBuf, PartialEq)] +// see ArgumentTypeInfos.java +#[derive(Debug, Clone, PartialEq, AzBuf)] pub enum BrigadierParser { Bool, Float(BrigadierNumber<f32>), @@ -111,6 +112,7 @@ pub enum BrigadierParser { ItemStack, ItemPredicate, Color, + HexColor, FormattedText, Style, Message, @@ -148,6 +150,7 @@ pub enum BrigadierParser { LootTable, LootPredicate, LootModifier, + Dialog, Uuid, } @@ -183,9 +186,9 @@ impl AzaleaWrite for EntityParser { impl AzaleaRead for BrigadierNodeStub { fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { let flags = FixedBitSet::<8>::azalea_read(buf)?; - if flags.index(5) || flags.index(6) || flags.index(7) { + if flags.index(6) || flags.index(7) { warn!( - "The flags from a Brigadier node are over 31. This is a bug, BrigadierParser probably needs updating.", + "The flags from a Brigadier node are over 63. This is a bug, BrigadierParser probably needs updating.", ); } @@ -193,6 +196,7 @@ impl AzaleaRead for BrigadierNodeStub { let is_executable = flags.index(2); let has_redirect = flags.index(3); let has_suggestions_type = flags.index(4); + let is_restricted = flags.index(5); let children = Vec::<u32>::azalea_read_var(buf)?; let redirect_node = if has_redirect { @@ -210,7 +214,7 @@ impl AzaleaRead for BrigadierNodeStub { } else { None }; - let node = BrigadierNodeStub { + Ok(BrigadierNodeStub { is_executable, children, redirect_node, @@ -219,25 +223,28 @@ impl AzaleaRead for BrigadierNodeStub { parser, suggestions_type, }, - }; - return Ok(node); + is_restricted, + }) } // literal node else if node_type == 1 { let name = String::azalea_read(buf)?; - return Ok(BrigadierNodeStub { + Ok(BrigadierNodeStub { is_executable, children, redirect_node, node_type: NodeType::Literal { name }, - }); + is_restricted, + }) + } else { + Ok(BrigadierNodeStub { + is_executable, + children, + redirect_node, + node_type: NodeType::Root, + is_restricted, + }) } - Ok(BrigadierNodeStub { - is_executable, - children, - redirect_node, - node_type: NodeType::Root, - }) } } @@ -336,6 +343,7 @@ mod tests { children: vec![1, 2], redirect_node: None, node_type: NodeType::Root, + is_restricted: false, }; let mut buf = Vec::new(); data.azalea_write(&mut buf).unwrap(); @@ -353,6 +361,7 @@ mod tests { node_type: NodeType::Literal { name: "String".to_string(), }, + is_restricted: false, }; let mut buf = Vec::new(); data.azalea_write(&mut buf).unwrap(); @@ -372,6 +381,7 @@ mod tests { parser: BrigadierParser::Vec3, suggestions_type: Some(ResourceLocation::new("minecraft:test_suggestion")), }, + is_restricted: false, }; let mut buf = Vec::new(); data.azalea_write(&mut buf).unwrap(); diff --git a/azalea-protocol/src/packets/game/c_show_dialog.rs b/azalea-protocol/src/packets/game/c_show_dialog.rs new file mode 100644 index 00000000..d059f843 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_show_dialog.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; +use azalea_registry::Holder; +use simdnbt::owned::Nbt; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundShowDialog { + pub dialog: Holder<azalea_registry::Dialog, Nbt>, +} diff --git a/azalea-protocol/src/packets/game/c_waypoint.rs b/azalea-protocol/src/packets/game/c_waypoint.rs new file mode 100644 index 00000000..0724d019 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_waypoint.rs @@ -0,0 +1,90 @@ +use std::io::{self, Cursor, Write}; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError}; +use azalea_core::{color::RgbColor, position::Vec3i, resource_location::ResourceLocation}; +use azalea_protocol_macros::ClientboundGamePacket; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundWaypoint { + pub operation: WaypointOperation, + pub waypoint: TrackedWaypoint, +} + +#[derive(AzBuf, Copy, Clone, Debug)] +pub enum WaypointOperation { + Track, + Untrack, + Update, +} + +#[derive(AzBuf, Clone, Debug)] +pub struct TrackedWaypoint { + pub identifier: WaypointIdentifier, + pub icon: WaypointIcon, + pub data: WaypointData, +} + +#[derive(AzBuf, Clone, Debug)] +pub enum WaypointIdentifier { + String(String), + Uuid(Uuid), +} + +#[derive(Clone, Debug)] +pub struct WaypointIcon { + pub style: ResourceLocation, + pub color: Option<RgbColor>, +} +impl AzaleaWrite for WaypointIcon { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), io::Error> { + self.style.azalea_write(buf)?; + let color = self.color.map(|c| CompactRgbColor { + r: c.red(), + g: c.green(), + b: c.blue(), + }); + color.azalea_write(buf)?; + Ok(()) + } +} +impl AzaleaRead for WaypointIcon { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> { + let style = ResourceLocation::azalea_read(buf)?; + let color = Option::<CompactRgbColor>::azalea_read(buf)?; + let color = color.map(|c| RgbColor::new(c.r, c.g, c.b)); + + Ok(Self { style, color }) + } +} + +// usually RgbColor is encoded as 4 bytes, except here where it's 3 +#[derive(AzBuf)] +struct CompactRgbColor { + r: u8, + g: u8, + b: u8, +} + +#[derive(AzBuf, Clone, Debug)] +pub struct WaypointIconFade { + pub near_dist: i32, + pub far_dist: i32, + pub near_alpha: u8, + pub far_alpha: u8, +} + +#[derive(AzBuf, Clone, Debug)] +pub enum WaypointData { + Empty, + Vec3i(Vec3i), + Chunk { + #[var] + x: i32, + #[var] + z: i32, + }, + Azimuth { + angle: f32, + }, +} diff --git a/azalea-protocol/src/packets/game/mod.rs b/azalea-protocol/src/packets/game/mod.rs index eb73b9de..264892b0 100644 --- a/azalea-protocol/src/packets/game/mod.rs +++ b/azalea-protocol/src/packets/game/mod.rs @@ -5,202 +5,207 @@ use azalea_protocol_macros::declare_state_packets; declare_state_packets!(GamePacket, Clientbound => [ - bundle_delimiter, // 0x00 - add_entity, // 0x01 - animate, // 0x02 - award_stats, // 0x03 - block_changed_ack, // 0x04 - block_destruction, // 0x05 - block_entity_data, // 0x06 - block_event, // 0x07 - block_update, // 0x08 - boss_event, // 0x09 - change_difficulty, // 0x0A - chunk_batch_finished, // 0x0B - chunk_batch_start, // 0x0C - chunks_biomes, // 0x0D - clear_titles, // 0x0E - command_suggestions, // 0x0F - commands, // 0x10 - container_close, // 0x11 - container_set_content, // 0x12 - container_set_data, // 0x13 - container_set_slot, // 0x14 - cookie_request, // 0x15 - cooldown, // 0x16 - custom_chat_completions, // 0x17 - custom_payload, // 0x18 - damage_event, // 0x19 - debug_sample, // 0x1A - delete_chat, // 0x1B - disconnect, // 0x1C - disguised_chat, // 0x1D - entity_event, // 0x1E - entity_position_sync, // 0x1F - explode, // 0x20 - forget_level_chunk, // 0x21 - game_event, // 0x22 - horse_screen_open, // 0x23 - hurt_animation, // 0x24 - initialize_border, // 0x25 - keep_alive, // 0x26 - level_chunk_with_light, // 0x27 - level_event, // 0x28 - level_particles, // 0x29 - light_update, // 0x2A - login, // 0x2B - map_item_data, // 0x2C - merchant_offers, // 0x2D - move_entity_pos, // 0x2E - move_entity_pos_rot, // 0x2F - move_minecart_along_track, // 0x30 - move_entity_rot, // 0x31 - move_vehicle, // 0x32 - open_book, // 0x33 - open_screen, // 0x34 - open_sign_editor, // 0x35 - ping, // 0x36 - pong_response, // 0x37 - place_ghost_recipe, // 0x38 - player_abilities, // 0x39 - player_chat, // 0x3A - player_combat_end, // 0x3B - player_combat_enter, // 0x3C - player_combat_kill, // 0x3D - player_info_remove, // 0x3E - player_info_update, // 0x3F - player_look_at, // 0x40 - player_position, // 0x41 - player_rotation, // 0x42 - recipe_book_add, // 0x43 - recipe_book_remove, // 0x44 - recipe_book_settings, // 0x45 - remove_entities, // 0x46 - remove_mob_effect, // 0x47 - reset_score, // 0x48 - resource_pack_pop, // 0x49 - resource_pack_push, // 0x4A - respawn, // 0x4B - rotate_head, // 0x4C - section_blocks_update, // 0x4D - select_advancements_tab, // 0x4E - server_data, // 0x4F - set_action_bar_text, // 0x50 - set_border_center, // 0x51 - set_border_lerp_size, // 0x52 - set_border_size, // 0x53 - set_border_warning_delay, // 0x54 - set_border_warning_distance, // 0x55 - set_camera, // 0x56 - set_chunk_cache_center, // 0x57 - set_chunk_cache_radius, // 0x58 - set_cursor_item, // 0x59 - set_default_spawn_position, // 0x5A - set_display_objective, // 0x5B - set_entity_data, // 0x5C - set_entity_link, // 0x5D - set_entity_motion, // 0x5E - set_equipment, // 0x5F - set_experience, // 0x60 - set_health, // 0x61 - set_held_slot, // 0x62 - set_objective, // 0x63 - set_passengers, // 0x64 - set_player_inventory, // 0x65 - set_player_team, // 0x66 - set_score, // 0x67 - set_simulation_distance, // 0x68 - set_subtitle_text, // 0x69 - set_time, // 0x6A - set_title_text, // 0x6B - set_titles_animation, // 0x6C - sound_entity, // 0x6D - sound, // 0x6E - start_configuration, // 0x6F - stop_sound, // 0x70 - store_cookie, // 0x71 - system_chat, // 0x72 - tab_list, // 0x73 - tag_query, // 0x74 - take_item_entity, // 0x75 - teleport_entity, // 0x76 - test_instance_block_status, // 0x77 - ticking_state, // 0x78 - ticking_step, // 0x79 - transfer, // 0x7A - update_advancements, // 0x7B - update_attributes, // 0x7C - update_mob_effect, // 0x7D - update_recipes, // 0x7E - update_tags, // 0x7F - projectile_power, // 0x80 - custom_report_details, // 0x81 - server_links, // 0x82 + bundle_delimiter, + add_entity, + animate, + award_stats, + block_changed_ack, + block_destruction, + block_entity_data, + block_event, + block_update, + boss_event, + change_difficulty, + chunk_batch_finished, + chunk_batch_start, + chunks_biomes, + clear_titles, + command_suggestions, + commands, + container_close, + container_set_content, + container_set_data, + container_set_slot, + cookie_request, + cooldown, + custom_chat_completions, + custom_payload, + damage_event, + debug_sample, + delete_chat, + disconnect, + disguised_chat, + entity_event, + entity_position_sync, + explode, + forget_level_chunk, + game_event, + horse_screen_open, + hurt_animation, + initialize_border, + keep_alive, + level_chunk_with_light, + level_event, + level_particles, + light_update, + login, + map_item_data, + merchant_offers, + move_entity_pos, + move_entity_pos_rot, + move_minecart_along_track, + move_entity_rot, + move_vehicle, + open_book, + open_screen, + open_sign_editor, + ping, + pong_response, + place_ghost_recipe, + player_abilities, + player_chat, + player_combat_end, + player_combat_enter, + player_combat_kill, + player_info_remove, + player_info_update, + player_look_at, + player_position, + player_rotation, + recipe_book_add, + recipe_book_remove, + recipe_book_settings, + remove_entities, + remove_mob_effect, + reset_score, + resource_pack_pop, + resource_pack_push, + respawn, + rotate_head, + section_blocks_update, + select_advancements_tab, + server_data, + set_action_bar_text, + set_border_center, + set_border_lerp_size, + set_border_size, + set_border_warning_delay, + set_border_warning_distance, + set_camera, + set_chunk_cache_center, + set_chunk_cache_radius, + set_cursor_item, + set_default_spawn_position, + set_display_objective, + set_entity_data, + set_entity_link, + set_entity_motion, + set_equipment, + set_experience, + set_health, + set_held_slot, + set_objective, + set_passengers, + set_player_inventory, + set_player_team, + set_score, + set_simulation_distance, + set_subtitle_text, + set_time, + set_title_text, + set_titles_animation, + sound_entity, + sound, + start_configuration, + stop_sound, + store_cookie, + system_chat, + tab_list, + tag_query, + take_item_entity, + teleport_entity, + test_instance_block_status, + ticking_state, + ticking_step, + transfer, + update_advancements, + update_attributes, + update_mob_effect, + update_recipes, + update_tags, + projectile_power, + custom_report_details, + server_links, + waypoint, + clear_dialog, + show_dialog, ], Serverbound => [ - accept_teleportation, // 0x00 - block_entity_tag_query, // 0x01 - bundle_item_selected, // 0x02 - change_difficulty, // 0x03 - chat_ack, // 0x04 - chat_command, // 0x05 - chat_command_signed, // 0x06 - chat, // 0x07 - chat_session_update, // 0x08 - chunk_batch_received, // 0x09 - client_command, // 0x0A - client_tick_end, // 0x0B - client_information, // 0x0C - command_suggestion, // 0x0D - configuration_acknowledged, // 0x0E - container_button_click, // 0x0F - container_click, // 0x10 - container_close, // 0x11 - container_slot_state_changed, // 0x12 - cookie_response, // 0x13 - custom_payload, // 0x14 - debug_sample_subscription, // 0x15 - edit_book, // 0x16 - entity_tag_query, // 0x17 - interact, // 0x18 - jigsaw_generate, // 0x19 - keep_alive, // 0x1A - lock_difficulty, // 0x1B - move_player_pos, // 0x1C - move_player_pos_rot, // 0x1D - move_player_rot, // 0x1E - move_player_status_only, // 0x1F - move_vehicle, // 0x20 - paddle_boat, // 0x21 - pick_item_from_block, // 0x22 - pick_item_from_entity, // 0x23 - ping_request, // 0x24 - place_recipe, // 0x25 - player_abilities, // 0x26 - player_action, // 0x27 - player_command, // 0x28 - player_input, // 0x29 - player_loaded, // 0x2A - pong, // 0x2B - recipe_book_change_settings, // 0x2C - recipe_book_seen_recipe, // 0x2D - rename_item, // 0x2E - resource_pack, // 0x2F - seen_advancements, // 0x30 - select_trade, // 0x31 - set_beacon, // 0x32 - set_carried_item, // 0x33 - set_command_block, // 0x34 - set_command_minecart, // 0x35 - set_creative_mode_slot, // 0x36 - set_jigsaw_block, // 0x37 - set_structure_block, // 0x38 - set_test_block, // 0x39 - sign_update, // 0x3A - swing, // 0x3B - teleport_to_entity, // 0x3C - test_instance_block_action, // 0x3D - use_item_on, // 0x3E - use_item, // 0x3F + accept_teleportation, + block_entity_tag_query, + bundle_item_selected, + change_difficulty, + change_game_mode, + chat_ack, + chat_command, + chat_command_signed, + chat, + chat_session_update, + chunk_batch_received, + client_command, + client_tick_end, + client_information, + command_suggestion, + configuration_acknowledged, + container_button_click, + container_click, + container_close, + container_slot_state_changed, + cookie_response, + custom_payload, + debug_sample_subscription, + edit_book, + entity_tag_query, + interact, + jigsaw_generate, + keep_alive, + lock_difficulty, + move_player_pos, + move_player_pos_rot, + move_player_rot, + move_player_status_only, + move_vehicle, + paddle_boat, + pick_item_from_block, + pick_item_from_entity, + ping_request, + place_recipe, + player_abilities, + player_action, + player_command, + player_input, + player_loaded, + pong, + recipe_book_change_settings, + recipe_book_seen_recipe, + rename_item, + resource_pack, + seen_advancements, + select_trade, + set_beacon, + set_carried_item, + set_command_block, + set_command_minecart, + set_creative_mode_slot, + set_jigsaw_block, + set_structure_block, + set_test_block, + sign_update, + swing, + teleport_to_entity, + test_instance_block_action, + use_item_on, + use_item, + custom_click_action, ] ); diff --git a/azalea-protocol/src/packets/game/s_change_game_mode.rs b/azalea-protocol/src/packets/game/s_change_game_mode.rs new file mode 100644 index 00000000..2dfabd2d --- /dev/null +++ b/azalea-protocol/src/packets/game/s_change_game_mode.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_core::game_type::GameMode; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChangeGameMode { + pub mode: GameMode, +} diff --git a/azalea-protocol/src/packets/game/s_custom_click_action.rs b/azalea-protocol/src/packets/game/s_custom_click_action.rs new file mode 100644 index 00000000..7215aaf6 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_custom_click_action.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundCustomClickAction { + pub id: ResourceLocation, + pub payload: Option<String>, +} diff --git a/azalea-protocol/src/packets/game/s_player_command.rs b/azalea-protocol/src/packets/game/s_player_command.rs index f620b847..48ce5975 100644 --- a/azalea-protocol/src/packets/game/s_player_command.rs +++ b/azalea-protocol/src/packets/game/s_player_command.rs @@ -13,13 +13,11 @@ pub struct ServerboundPlayerCommand { #[derive(AzBuf, Clone, Copy, Debug)] pub enum Action { - PressShiftKey = 0, - ReleaseShiftKey = 1, - StopSleeping = 2, - StartSprinting = 3, - StopSprinting = 4, - StartRidingJump = 5, - StopRidingJump = 6, - OpenInventory = 7, - StartFallFlying = 8, + StopSleeping, + StartSprinting, + StopSprinting, + StartRidingJump, + StopRidingJump, + OpenInventory, + StartFallFlying, } diff --git a/azalea-protocol/src/packets/handshake/mod.rs b/azalea-protocol/src/packets/handshake/mod.rs index 8f14c8fb..8d23a13c 100644 --- a/azalea-protocol/src/packets/handshake/mod.rs +++ b/azalea-protocol/src/packets/handshake/mod.rs @@ -7,6 +7,6 @@ declare_state_packets!(HandshakePacket, Clientbound => [ ], Serverbound => [ - intention, // 0x00 + intention, ] ); diff --git a/azalea-protocol/src/packets/login/mod.rs b/azalea-protocol/src/packets/login/mod.rs index 39f1565b..2038cdcd 100644 --- a/azalea-protocol/src/packets/login/mod.rs +++ b/azalea-protocol/src/packets/login/mod.rs @@ -5,18 +5,18 @@ use azalea_protocol_macros::declare_state_packets; declare_state_packets!(LoginPacket, Clientbound => [ - login_disconnect, // 0x00 - hello, // 0x01 - login_finished, // 0x02 - login_compression, // 0x03 - custom_query, // 0x04 - cookie_request, // 0x05 + login_disconnect, + hello, + login_finished, + login_compression, + custom_query, + cookie_request, ], Serverbound => [ - hello, // 0x00 - key, // 0x01 - custom_query_answer, // 0x02 - login_acknowledged, // 0x03 - cookie_response, // 0x04 + hello, + key, + custom_query_answer, + login_acknowledged, + cookie_response, ] ); diff --git a/azalea-protocol/src/packets/mod.rs b/azalea-protocol/src/packets/mod.rs index 773ce591..09426b8d 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 = 770; -pub const VERSION_NAME: &str = "1.21.5"; +pub const PROTOCOL_VERSION: i32 = 771; +pub const VERSION_NAME: &str = "1.21.6"; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum ConnectionProtocol { @@ -101,4 +101,4 @@ impl AzaleaWrite for ClientIntention { fn azalea_write(&self, buf: &mut impl Write) -> io::Result<()> { (*self as i32).azalea_write_var(buf) } -}
\ No newline at end of file +} diff --git a/azalea-protocol/src/packets/status/mod.rs b/azalea-protocol/src/packets/status/mod.rs index 57ed9970..de7cc1ae 100644 --- a/azalea-protocol/src/packets/status/mod.rs +++ b/azalea-protocol/src/packets/status/mod.rs @@ -5,11 +5,11 @@ use azalea_protocol_macros::declare_state_packets; declare_state_packets!(StatusPacket, Clientbound => [ - status_response, // 0x00 - pong_response, // 0x01 + status_response, + pong_response, ], Serverbound => [ - status_request, // 0x00 - ping_request, // 0x01 + status_request, + ping_request, ] ); |
