From 08958c2278b15ebeac8a964f392ebb792e479b61 Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Wed, 27 Nov 2024 19:31:40 -0600 Subject: Refactor azalea-protocol (#190) * start updating to 1.21.4 * fix block codegen and stop using block data from burger * rename packet related modules and structs to be simpler * ItemSlot -> ItemStack for more consistency with mojmap * .get() -> .into_packet() * simplify declare_state_packets by removing packet ids * rename read_from and write_into to azalea_read and azalea_write * rename McBufReadable and McBufWritable to AzaleaRead and AzaleaWrite * McBuf -> AzBuf * remove most uses of into_variant * update codegen and use resourcelocation names for packets * implement #[limit(i)] attribute for AzBuf derive macro * fixes for 1.21.4 * fix examples * update some physics code and fix ChatType * remove unused imports in codegen * re-add some things to migrate.py and update +mc version numbers automatically * downgrade to 1.21.3 lol --- azalea-protocol/src/common/client_information.rs | 187 +++++++ azalea-protocol/src/common/mod.rs | 4 + azalea-protocol/src/common/server_links.rs | 28 + azalea-protocol/src/connect.rs | 87 ++- azalea-protocol/src/lib.rs | 21 +- azalea-protocol/src/packets/common.rs | 4 +- .../src/packets/config/c_cookie_request.rs | 8 + .../src/packets/config/c_custom_payload.rs | 10 + .../src/packets/config/c_custom_report_details.rs | 9 + azalea-protocol/src/packets/config/c_disconnect.rs | 8 + .../src/packets/config/c_finish_configuration.rs | 5 + azalea-protocol/src/packets/config/c_keep_alive.rs | 7 + azalea-protocol/src/packets/config/c_ping.rs | 7 + .../src/packets/config/c_registry_data.rs | 12 + azalea-protocol/src/packets/config/c_reset_chat.rs | 5 + .../src/packets/config/c_resource_pack.rs | 11 + .../src/packets/config/c_resource_pack_pop.rs | 8 + .../src/packets/config/c_resource_pack_push.rs | 13 + .../src/packets/config/c_select_known_packs.rs | 9 + .../src/packets/config/c_server_links.rs | 9 + .../src/packets/config/c_store_cookie.rs | 9 + azalea-protocol/src/packets/config/c_transfer.rs | 9 + .../packets/config/c_update_enabled_features.rs | 8 + .../src/packets/config/c_update_tags.rs | 74 +++ azalea-protocol/src/packets/config/mod.rs | 36 ++ .../src/packets/config/s_client_information.rs | 9 + .../src/packets/config/s_cookie_response.rs | 9 + .../src/packets/config/s_custom_payload.rs | 10 + .../src/packets/config/s_finish_configuration.rs | 5 + azalea-protocol/src/packets/config/s_keep_alive.rs | 7 + azalea-protocol/src/packets/config/s_pong.rs | 7 + .../src/packets/config/s_resource_pack.rs | 20 + .../src/packets/config/s_select_known_packs.rs | 14 + .../clientbound_cookie_request_packet.rs | 8 - .../clientbound_custom_payload_packet.rs | 10 - .../configuration/clientbound_disconnect_packet.rs | 8 - .../clientbound_finish_configuration_packet.rs | 5 - .../configuration/clientbound_keep_alive_packet.rs | 7 - .../configuration/clientbound_ping_packet.rs | 7 - .../clientbound_registry_data_packet.rs | 12 - .../configuration/clientbound_reset_chat_packet.rs | 5 - .../clientbound_resource_pack_packet.rs | 11 - .../clientbound_resource_pack_pop_packet.rs | 8 - .../clientbound_resource_pack_push_packet.rs | 13 - .../clientbound_select_known_packs_packet.rs | 9 - .../clientbound_store_cookie_packet.rs | 9 - .../configuration/clientbound_transfer_packet.rs | 9 - .../clientbound_update_enabled_features_packet.rs | 8 - .../clientbound_update_tags_packet.rs | 74 --- azalea-protocol/src/packets/configuration/mod.rs | 56 -- .../serverbound_client_information_packet.rs | 193 ------- .../serverbound_cookie_response_packet.rs | 9 - .../serverbound_custom_payload_packet.rs | 10 - .../serverbound_finish_configuration_packet.rs | 5 - .../configuration/serverbound_keep_alive_packet.rs | 7 - .../configuration/serverbound_pong_packet.rs | 7 - .../serverbound_resource_pack_packet.rs | 20 - .../serverbound_select_known_packs_packet.rs | 14 - azalea-protocol/src/packets/game/c_add_entity.rs | 37 ++ .../src/packets/game/c_add_experience_orb.rs | 12 + azalea-protocol/src/packets/game/c_add_player.rs | 27 + azalea-protocol/src/packets/game/c_animate.rs | 21 + azalea-protocol/src/packets/game/c_award_stats.rs | 23 + .../src/packets/game/c_block_changed_ack.rs | 8 + .../src/packets/game/c_block_destruction.rs | 13 + .../src/packets/game/c_block_entity_data.rs | 11 + azalea-protocol/src/packets/game/c_block_event.rs | 12 + azalea-protocol/src/packets/game/c_block_update.rs | 10 + azalea-protocol/src/packets/game/c_boss_event.rs | 143 +++++ .../src/packets/game/c_bundle_delimiter.rs | 5 + .../src/packets/game/c_change_difficulty.rs | 9 + azalea-protocol/src/packets/game/c_chat_preview.rs | 9 + .../src/packets/game/c_chunk_batch_finished.rs | 8 + .../src/packets/game/c_chunk_batch_start.rs | 5 + .../src/packets/game/c_chunks_biomes.rs | 14 + azalea-protocol/src/packets/game/c_clear_titles.rs | 7 + .../src/packets/game/c_command_suggestions.rs | 37 ++ azalea-protocol/src/packets/game/c_commands.rs | 378 +++++++++++++ .../src/packets/game/c_container_close.rs | 7 + .../src/packets/game/c_container_set_content.rs | 12 + .../src/packets/game/c_container_set_data.rs | 9 + .../src/packets/game/c_container_set_slot.rs | 12 + .../src/packets/game/c_cookie_request.rs | 8 + azalea-protocol/src/packets/game/c_cooldown.rs | 9 + .../src/packets/game/c_custom_chat_completions.rs | 15 + .../src/packets/game/c_custom_payload.rs | 10 + .../src/packets/game/c_custom_report_details.rs | 14 + azalea-protocol/src/packets/game/c_custom_sound.rs | 28 + azalea-protocol/src/packets/game/c_damage_event.rs | 35 ++ azalea-protocol/src/packets/game/c_debug_sample.rs | 10 + azalea-protocol/src/packets/game/c_delete_chat.rs | 9 + azalea-protocol/src/packets/game/c_disconnect.rs | 8 + .../src/packets/game/c_disguised_chat.rs | 42 ++ azalea-protocol/src/packets/game/c_entity_event.rs | 8 + .../src/packets/game/c_entity_position_sync.rs | 19 + azalea-protocol/src/packets/game/c_explode.rs | 164 ++++++ .../src/packets/game/c_forget_level_chunk.rs | 8 + azalea-protocol/src/packets/game/c_game_event.rs | 26 + .../src/packets/game/c_horse_screen_open.rs | 10 + .../src/packets/game/c_hurt_animation.rs | 9 + .../src/packets/game/c_initialize_border.rs | 18 + azalea-protocol/src/packets/game/c_keep_alive.rs | 7 + .../src/packets/game/c_level_chunk_with_light.rs | 65 +++ azalea-protocol/src/packets/game/c_level_event.rs | 11 + .../src/packets/game/c_level_particles.rs | 39 ++ azalea-protocol/src/packets/game/c_light_update.rs | 22 + azalea-protocol/src/packets/game/c_login.rs | 27 + .../src/packets/game/c_map_item_data.rs | 88 +++ .../src/packets/game/c_merchant_offers.rs | 30 ++ .../src/packets/game/c_move_entity_pos.rs | 11 + .../src/packets/game/c_move_entity_pos_rot.rs | 14 + .../src/packets/game/c_move_entity_rot.rs | 11 + .../packets/game/c_move_minecart_along_track.rs | 19 + azalea-protocol/src/packets/game/c_move_vehicle.rs | 11 + azalea-protocol/src/packets/game/c_open_book.rs | 9 + azalea-protocol/src/packets/game/c_open_screen.rs | 11 + .../src/packets/game/c_open_sign_editor.rs | 9 + azalea-protocol/src/packets/game/c_ping.rs | 7 + .../src/packets/game/c_place_ghost_recipe.rs | 9 + .../src/packets/game/c_player_abilities.rs | 53 ++ azalea-protocol/src/packets/game/c_player_chat.rs | 160 ++++++ .../src/packets/game/c_player_chat_header.rs | 10 + .../src/packets/game/c_player_combat_end.rs | 9 + .../src/packets/game/c_player_combat_enter.rs | 6 + .../src/packets/game/c_player_combat_kill.rs | 11 + .../src/packets/game/c_player_info_remove.rs | 8 + .../src/packets/game/c_player_info_update.rs | 326 ++++++++++++ .../src/packets/game/c_player_look_at.rs | 24 + .../src/packets/game/c_player_position.rs | 61 +++ .../src/packets/game/c_player_rotation.rs | 8 + .../src/packets/game/c_pong_response.rs | 7 + .../src/packets/game/c_projectile_power.rs | 8 + .../src/packets/game/c_recipe_book_add.rs | 79 +++ .../src/packets/game/c_recipe_book_remove.rs | 12 + .../src/packets/game/c_recipe_book_settings.rs | 22 + .../src/packets/game/c_remove_entities.rs | 8 + .../src/packets/game/c_remove_mob_effect.rs | 9 + azalea-protocol/src/packets/game/c_reset_score.rs | 8 + .../src/packets/game/c_resource_pack_pop.rs | 8 + .../src/packets/game/c_resource_pack_push.rs | 13 + azalea-protocol/src/packets/game/c_respawn.rs | 10 + azalea-protocol/src/packets/game/c_rotate_head.rs | 9 + .../src/packets/game/c_section_blocks_update.rs | 43 ++ .../src/packets/game/c_select_advancements_tab.rs | 8 + azalea-protocol/src/packets/game/c_server_data.rs | 9 + azalea-protocol/src/packets/game/c_server_links.rs | 9 + .../src/packets/game/c_set_action_bar_text.rs | 8 + .../src/packets/game/c_set_border_center.rs | 8 + .../src/packets/game/c_set_border_lerp_size.rs | 10 + .../src/packets/game/c_set_border_size.rs | 7 + .../src/packets/game/c_set_border_warning_delay.rs | 8 + .../packets/game/c_set_border_warning_distance.rs | 8 + azalea-protocol/src/packets/game/c_set_camera.rs | 8 + .../src/packets/game/c_set_chunk_cache_center.rs | 10 + .../src/packets/game/c_set_chunk_cache_radius.rs | 8 + .../src/packets/game/c_set_cursor_item.rs | 8 + .../packets/game/c_set_default_spawn_position.rs | 9 + .../src/packets/game/c_set_display_chat_preview.rs | 7 + .../src/packets/game/c_set_display_objective.rs | 31 ++ .../src/packets/game/c_set_entity_data.rs | 10 + .../src/packets/game/c_set_entity_link.rs | 8 + .../src/packets/game/c_set_entity_motion.rs | 11 + .../src/packets/game/c_set_equipment.rs | 81 +++ .../src/packets/game/c_set_experience.rs | 11 + azalea-protocol/src/packets/game/c_set_health.rs | 10 + .../src/packets/game/c_set_held_slot.rs | 7 + .../src/packets/game/c_set_objective.rs | 82 +++ .../src/packets/game/c_set_passengers.rs | 10 + .../src/packets/game/c_set_player_inventory.rs | 10 + .../src/packets/game/c_set_player_team.rs | 74 +++ azalea-protocol/src/packets/game/c_set_score.rs | 13 + .../src/packets/game/c_set_simulation_distance.rs | 8 + .../src/packets/game/c_set_subtitle_text.rs | 8 + azalea-protocol/src/packets/game/c_set_time.rs | 9 + .../src/packets/game/c_set_title_text.rs | 8 + .../src/packets/game/c_set_titles_animation.rs | 9 + azalea-protocol/src/packets/game/c_sound.rs | 29 + azalea-protocol/src/packets/game/c_sound_entity.rs | 27 + .../src/packets/game/c_start_configuration.rs | 5 + azalea-protocol/src/packets/game/c_stop_sound.rs | 51 ++ azalea-protocol/src/packets/game/c_store_cookie.rs | 9 + azalea-protocol/src/packets/game/c_system_chat.rs | 45 ++ azalea-protocol/src/packets/game/c_tab_list.rs | 28 + azalea-protocol/src/packets/game/c_tag_query.rs | 10 + .../src/packets/game/c_take_item_entity.rs | 12 + .../src/packets/game/c_teleport_entity.rs | 13 + .../src/packets/game/c_ticking_state.rs | 8 + azalea-protocol/src/packets/game/c_ticking_step.rs | 8 + azalea-protocol/src/packets/game/c_transfer.rs | 9 + .../src/packets/game/c_update_advancements.rs | 205 +++++++ .../src/packets/game/c_update_attributes.rs | 18 + .../src/packets/game/c_update_enabled_features.rs | 8 + .../src/packets/game/c_update_mob_effect.rs | 15 + .../src/packets/game/c_update_recipes.rs | 74 +++ azalea-protocol/src/packets/game/c_update_tags.rs | 74 +++ .../packets/game/clientbound_add_entity_packet.rs | 37 -- .../game/clientbound_add_experience_orb_packet.rs | 12 - .../packets/game/clientbound_add_player_packet.rs | 27 - .../src/packets/game/clientbound_animate_packet.rs | 21 - .../packets/game/clientbound_award_stats_packet.rs | 23 - .../game/clientbound_block_changed_ack_packet.rs | 8 - .../game/clientbound_block_destruction_packet.rs | 13 - .../game/clientbound_block_entity_data_packet.rs | 11 - .../packets/game/clientbound_block_event_packet.rs | 12 - .../game/clientbound_block_update_packet.rs | 10 - .../packets/game/clientbound_boss_event_packet.rs | 145 ----- .../src/packets/game/clientbound_bundle_packet.rs | 5 - .../game/clientbound_change_difficulty_packet.rs | 9 - .../game/clientbound_chat_preview_packet.rs | 9 - .../clientbound_chunk_batch_finished_packet.rs | 8 - .../game/clientbound_chunk_batch_start_packet.rs | 5 - .../game/clientbound_chunks_biomes_packet.rs | 14 - .../game/clientbound_clear_titles_packet.rs | 7 - .../game/clientbound_command_suggestions_packet.rs | 37 -- .../packets/game/clientbound_commands_packet.rs | 380 ------------- .../game/clientbound_container_close_packet.rs | 7 - .../clientbound_container_set_content_packet.rs | 12 - .../game/clientbound_container_set_data_packet.rs | 9 - .../game/clientbound_container_set_slot_packet.rs | 12 - .../game/clientbound_cookie_request_packet.rs | 8 - .../packets/game/clientbound_cooldown_packet.rs | 9 - .../clientbound_custom_chat_completions_packet.rs | 15 - .../game/clientbound_custom_payload_packet.rs | 10 - .../clientbound_custom_report_details_packet.rs | 14 - .../game/clientbound_custom_sound_packet.rs | 28 - .../game/clientbound_damage_event_packet.rs | 35 -- .../game/clientbound_debug_sample_packet.rs | 10 - .../packets/game/clientbound_delete_chat_packet.rs | 9 - .../packets/game/clientbound_disconnect_packet.rs | 8 - .../game/clientbound_disguised_chat_packet.rs | 42 -- .../game/clientbound_entity_event_packet.rs | 8 - .../clientbound_entity_position_sync_packet.rs | 19 - .../src/packets/game/clientbound_explode_packet.rs | 166 ------ .../game/clientbound_forget_level_chunk_packet.rs | 8 - .../packets/game/clientbound_game_event_packet.rs | 26 - .../game/clientbound_horse_screen_open_packet.rs | 10 - .../game/clientbound_hurt_animation_packet.rs | 9 - .../game/clientbound_initialize_border_packet.rs | 18 - .../packets/game/clientbound_keep_alive_packet.rs | 7 - .../clientbound_level_chunk_with_light_packet.rs | 66 --- .../packets/game/clientbound_level_event_packet.rs | 11 - .../game/clientbound_level_particles_packet.rs | 39 -- .../game/clientbound_light_update_packet.rs | 22 - .../src/packets/game/clientbound_login_packet.rs | 27 - .../game/clientbound_map_item_data_packet.rs | 88 --- .../game/clientbound_merchant_offers_packet.rs | 30 -- .../game/clientbound_move_entity_pos_packet.rs | 11 - .../game/clientbound_move_entity_pos_rot_packet.rs | 14 - .../game/clientbound_move_entity_rot_packet.rs | 11 - .../game/clientbound_move_minecart_packet.rs | 19 - .../game/clientbound_move_vehicle_packet.rs | 11 - .../packets/game/clientbound_open_book_packet.rs | 9 - .../packets/game/clientbound_open_screen_packet.rs | 11 - .../game/clientbound_open_sign_editor_packet.rs | 9 - .../src/packets/game/clientbound_ping_packet.rs | 7 - .../game/clientbound_place_ghost_recipe_packet.rs | 9 - .../game/clientbound_player_abilities_packet.rs | 53 -- .../game/clientbound_player_chat_header_packet.rs | 10 - .../packets/game/clientbound_player_chat_packet.rs | 202 ------- .../game/clientbound_player_combat_end_packet.rs | 9 - .../game/clientbound_player_combat_enter_packet.rs | 6 - .../game/clientbound_player_combat_kill_packet.rs | 11 - .../game/clientbound_player_info_remove_packet.rs | 8 - .../game/clientbound_player_info_update_packet.rs | 313 ----------- .../game/clientbound_player_look_at_packet.rs | 24 - .../game/clientbound_player_position_packet.rs | 61 --- .../game/clientbound_player_rotation_packet.rs | 8 - .../game/clientbound_pong_response_packet.rs | 7 - .../game/clientbound_projectile_power_packet.rs | 8 - .../game/clientbound_recipe_book_add_packet.rs | 79 --- .../game/clientbound_recipe_book_remove_packet.rs | 15 - .../clientbound_recipe_book_settings_packet.rs | 22 - .../game/clientbound_remove_entities_packet.rs | 8 - .../game/clientbound_remove_mob_effect_packet.rs | 9 - .../packets/game/clientbound_reset_score_packet.rs | 8 - .../game/clientbound_resource_pack_pop_packet.rs | 8 - .../game/clientbound_resource_pack_push_packet.rs | 13 - .../src/packets/game/clientbound_respawn_packet.rs | 10 - .../packets/game/clientbound_rotate_head_packet.rs | 9 - .../clientbound_section_blocks_update_packet.rs | 45 -- .../clientbound_select_advancements_tab_packet.rs | 8 - .../packets/game/clientbound_server_data_packet.rs | 9 - .../game/clientbound_server_links_packet.rs | 34 -- .../game/clientbound_set_action_bar_text_packet.rs | 8 - .../game/clientbound_set_border_center_packet.rs | 8 - .../clientbound_set_border_lerp_size_packet.rs | 10 - .../game/clientbound_set_border_size_packet.rs | 7 - .../clientbound_set_border_warning_delay_packet.rs | 8 - ...ientbound_set_border_warning_distance_packet.rs | 8 - .../packets/game/clientbound_set_camera_packet.rs | 8 - .../clientbound_set_chunk_cache_center_packet.rs | 10 - .../clientbound_set_chunk_cache_radius_packet.rs | 8 - .../game/clientbound_set_cursor_item_packet.rs | 8 - ...lientbound_set_default_spawn_position_packet.rs | 9 - .../clientbound_set_display_chat_preview_packet.rs | 7 - .../clientbound_set_display_objective_packet.rs | 31 -- .../game/clientbound_set_entity_data_packet.rs | 10 - .../game/clientbound_set_entity_link_packet.rs | 8 - .../game/clientbound_set_entity_motion_packet.rs | 11 - .../game/clientbound_set_equipment_packet.rs | 81 --- .../game/clientbound_set_experience_packet.rs | 11 - .../packets/game/clientbound_set_health_packet.rs | 10 - .../game/clientbound_set_held_slot_packet.rs | 7 - .../game/clientbound_set_objective_packet.rs | 82 --- .../game/clientbound_set_passengers_packet.rs | 10 - .../clientbound_set_player_inventory_packet.rs | 10 - .../game/clientbound_set_player_team_packet.rs | 74 --- .../packets/game/clientbound_set_score_packet.rs | 13 - .../clientbound_set_simulation_distance_packet.rs | 8 - .../game/clientbound_set_subtitle_text_packet.rs | 8 - .../packets/game/clientbound_set_time_packet.rs | 9 - .../game/clientbound_set_title_text_packet.rs | 8 - .../clientbound_set_titles_animation_packet.rs | 9 - .../game/clientbound_sound_entity_packet.rs | 27 - .../src/packets/game/clientbound_sound_packet.rs | 29 - .../game/clientbound_start_configuration_packet.rs | 5 - .../packets/game/clientbound_stop_sound_packet.rs | 51 -- .../game/clientbound_store_cookie_packet.rs | 9 - .../packets/game/clientbound_system_chat_packet.rs | 45 -- .../packets/game/clientbound_tab_list_packet.rs | 28 - .../packets/game/clientbound_tag_query_packet.rs | 10 - .../game/clientbound_take_item_entity_packet.rs | 12 - .../game/clientbound_teleport_entity_packet.rs | 13 - .../game/clientbound_ticking_state_packet.rs | 8 - .../game/clientbound_ticking_step_packet.rs | 8 - .../packets/game/clientbound_transfer_packet.rs | 9 - .../game/clientbound_update_advancements_packet.rs | 205 ------- .../game/clientbound_update_attributes_packet.rs | 18 - .../clientbound_update_enabled_features_packet.rs | 8 - .../game/clientbound_update_mob_effect_packet.rs | 15 - .../game/clientbound_update_recipes_packet.rs | 74 --- .../packets/game/clientbound_update_tags_packet.rs | 74 --- azalea-protocol/src/packets/game/mod.rs | 588 +++++++-------------- .../src/packets/game/s_accept_teleportation.rs | 8 + .../src/packets/game/s_block_entity_tag_query.rs | 10 + .../src/packets/game/s_bundle_item_selected.rs | 10 + .../src/packets/game/s_change_difficulty.rs | 8 + azalea-protocol/src/packets/game/s_chat.rs | 20 + azalea-protocol/src/packets/game/s_chat_ack.rs | 8 + azalea-protocol/src/packets/game/s_chat_command.rs | 7 + .../src/packets/game/s_chat_command_signed.rs | 20 + azalea-protocol/src/packets/game/s_chat_preview.rs | 8 + .../src/packets/game/s_chat_session_update.rs | 21 + .../src/packets/game/s_chunk_batch_received.rs | 7 + .../src/packets/game/s_client_command.rs | 13 + .../src/packets/game/s_client_information.rs | 9 + .../src/packets/game/s_client_tick_end.rs | 5 + .../src/packets/game/s_command_suggestion.rs | 9 + .../packets/game/s_configuration_acknowledged.rs | 5 + .../src/packets/game/s_container_button_click.rs | 8 + .../src/packets/game/s_container_click.rs | 17 + .../src/packets/game/s_container_close.rs | 7 + .../packets/game/s_container_slot_state_changed.rs | 11 + .../src/packets/game/s_cookie_response.rs | 9 + .../src/packets/game/s_custom_payload.rs | 10 + .../packets/game/s_debug_sample_subscription.rs | 12 + azalea-protocol/src/packets/game/s_edit_book.rs | 10 + .../src/packets/game/s_entity_tag_query.rs | 10 + azalea-protocol/src/packets/game/s_interact.rs | 86 +++ .../src/packets/game/s_jigsaw_generate.rs | 11 + azalea-protocol/src/packets/game/s_keep_alive.rs | 7 + .../src/packets/game/s_lock_difficulty.rs | 7 + .../src/packets/game/s_move_player_pos.rs | 10 + .../src/packets/game/s_move_player_pos_rot.rs | 12 + .../src/packets/game/s_move_player_rot.rs | 9 + .../src/packets/game/s_move_player_status_only.rs | 7 + azalea-protocol/src/packets/game/s_move_vehicle.rs | 11 + azalea-protocol/src/packets/game/s_paddle_boat.rs | 8 + azalea-protocol/src/packets/game/s_pick_item.rs | 8 + .../src/packets/game/s_pick_item_from_entity.rs | 9 + azalea-protocol/src/packets/game/s_ping_request.rs | 7 + azalea-protocol/src/packets/game/s_place_recipe.rs | 10 + .../src/packets/game/s_player_abilities.rs | 31 ++ .../src/packets/game/s_player_action.rs | 24 + .../src/packets/game/s_player_command.rs | 24 + azalea-protocol/src/packets/game/s_player_input.rs | 60 +++ .../src/packets/game/s_player_loaded.rs | 5 + azalea-protocol/src/packets/game/s_pong.rs | 7 + .../packets/game/s_recipe_book_change_settings.rs | 17 + .../src/packets/game/s_recipe_book_seen_recipe.rs | 8 + azalea-protocol/src/packets/game/s_rename_item.rs | 7 + .../src/packets/game/s_resource_pack.rs | 20 + .../src/packets/game/s_seen_advancements.rs | 41 ++ azalea-protocol/src/packets/game/s_select_trade.rs | 8 + azalea-protocol/src/packets/game/s_set_beacon.rs | 10 + .../src/packets/game/s_set_carried_item.rs | 7 + .../src/packets/game/s_set_command_block.rs | 63 +++ .../src/packets/game/s_set_command_minecart.rs | 10 + .../src/packets/game/s_set_creative_mode_slot.rs | 9 + .../src/packets/game/s_set_jigsaw_block.rs | 51 ++ .../src/packets/game/s_set_structure_block.rs | 98 ++++ azalea-protocol/src/packets/game/s_sign_update.rs | 10 + azalea-protocol/src/packets/game/s_swing.rs | 9 + .../src/packets/game/s_teleport_to_entity.rs | 8 + azalea-protocol/src/packets/game/s_use_item.rs | 13 + azalea-protocol/src/packets/game/s_use_item_on.rs | 74 +++ .../serverbound_accept_teleportation_packet.rs | 8 - .../game/serverbound_block_entity_tag_query.rs | 10 - .../serverbound_block_entity_tag_query_packet.rs | 10 - .../game/serverbound_change_difficulty_packet.rs | 8 - .../packets/game/serverbound_chat_ack_packet.rs | 8 - .../game/serverbound_chat_command_packet.rs | 7 - .../game/serverbound_chat_command_signed_packet.rs | 20 - .../src/packets/game/serverbound_chat_packet.rs | 20 - .../game/serverbound_chat_preview_packet.rs | 8 - .../game/serverbound_chat_session_update_packet.rs | 21 - .../serverbound_chunk_batch_received_packet.rs | 7 - .../game/serverbound_client_command_packet.rs | 13 - .../game/serverbound_client_information_packet.rs | 9 - .../game/serverbound_client_tick_end_packet.rs | 5 - .../game/serverbound_command_suggestion_packet.rs | 9 - ...erverbound_configuration_acknowledged_packet.rs | 5 - .../serverbound_container_button_click_packet.rs | 8 - .../game/serverbound_container_click_packet.rs | 17 - .../game/serverbound_container_close_packet.rs | 7 - ...verbound_container_slot_state_changed_packet.rs | 11 - .../game/serverbound_cookie_response_packet.rs | 9 - .../game/serverbound_custom_payload_packet.rs | 10 - .../game/serverbound_debug_sample_subscription.rs | 12 - .../packets/game/serverbound_edit_book_packet.rs | 10 - .../packets/game/serverbound_entity_tag_query.rs | 10 - .../game/serverbound_entity_tag_query_packet.rs | 10 - .../packets/game/serverbound_interact_packet.rs | 86 --- .../game/serverbound_jigsaw_generate_packet.rs | 11 - .../packets/game/serverbound_keep_alive_packet.rs | 7 - .../game/serverbound_lock_difficulty_packet.rs | 7 - .../game/serverbound_move_player_pos_packet.rs | 10 - .../game/serverbound_move_player_pos_rot_packet.rs | 12 - .../game/serverbound_move_player_rot_packet.rs | 9 - .../serverbound_move_player_status_only_packet.rs | 7 - .../game/serverbound_move_vehicle_packet.rs | 11 - .../packets/game/serverbound_paddle_boat_packet.rs | 8 - .../packets/game/serverbound_pick_item_packet.rs | 8 - .../game/serverbound_ping_request_packet.rs | 7 - .../game/serverbound_place_recipe_packet.rs | 10 - .../game/serverbound_player_abilities_packet.rs | 31 -- .../game/serverbound_player_action_packet.rs | 24 - .../game/serverbound_player_command_packet.rs | 24 - .../game/serverbound_player_input_packet.rs | 60 --- .../src/packets/game/serverbound_pong_packet.rs | 7 - ...rverbound_recipe_book_change_settings_packet.rs | 17 - .../serverbound_recipe_book_seen_recipe_packet.rs | 8 - .../packets/game/serverbound_rename_item_packet.rs | 7 - .../game/serverbound_resource_pack_packet.rs | 20 - .../game/serverbound_seen_advancements_packet.rs | 41 -- .../game/serverbound_select_bundle_item_packet.rs | 10 - .../game/serverbound_select_trade_packet.rs | 8 - .../packets/game/serverbound_set_beacon_packet.rs | 10 - .../game/serverbound_set_carried_item_packet.rs | 7 - .../game/serverbound_set_command_block_packet.rs | 63 --- .../serverbound_set_command_minecart_packet.rs | 10 - .../serverbound_set_creative_mode_slot_packet.rs | 9 - .../game/serverbound_set_jigsaw_block_packet.rs | 51 -- .../game/serverbound_set_structure_block_packet.rs | 98 ---- .../packets/game/serverbound_sign_update_packet.rs | 10 - .../src/packets/game/serverbound_swing_packet.rs | 9 - .../game/serverbound_teleport_to_entity_packet.rs | 8 - .../packets/game/serverbound_use_item_on_packet.rs | 74 --- .../packets/game/serverbound_use_item_packet.rs | 13 - azalea-protocol/src/packets/handshake/mod.rs | 12 + .../src/packets/handshake/s_intention.rs | 15 + .../packets/handshaking/client_intention_packet.rs | 15 - azalea-protocol/src/packets/handshaking/mod.rs | 11 - .../src/packets/login/c_cookie_request.rs | 8 + .../src/packets/login/c_custom_query.rs | 13 + azalea-protocol/src/packets/login/c_hello.rs | 11 + .../src/packets/login/c_login_compression.rs | 10 + .../src/packets/login/c_login_disconnect.rs | 32 ++ .../src/packets/login/c_login_finished.rs | 8 + .../login/clientbound_cookie_request_packet.rs | 8 - .../login/clientbound_custom_query_packet.rs | 13 - .../src/packets/login/clientbound_hello_packet.rs | 12 - .../login/clientbound_login_compression_packet.rs | 10 - .../login/clientbound_login_disconnect_packet.rs | 34 -- .../login/clientbound_login_finished_packet.rs | 8 - azalea-protocol/src/packets/login/mod.rs | 46 +- .../src/packets/login/s_cookie_response.rs | 9 + .../src/packets/login/s_custom_query.rs | 9 + .../src/packets/login/s_custom_query_answer.rs | 11 + azalea-protocol/src/packets/login/s_hello.rs | 31 ++ azalea-protocol/src/packets/login/s_key.rs | 8 + .../src/packets/login/s_login_acknowledged.rs | 5 + .../login/serverbound_cookie_response_packet.rs | 9 - .../serverbound_custom_query_answer_packet.rs | 11 - .../login/serverbound_custom_query_packet.rs | 9 - .../src/packets/login/serverbound_hello_packet.rs | 30 -- .../src/packets/login/serverbound_key_packet.rs | 8 - .../login/serverbound_login_acknowledged_packet.rs | 5 - azalea-protocol/src/packets/mod.rs | 28 +- .../src/packets/status/c_pong_response.rs | 7 + .../src/packets/status/c_status_response.rs | 61 +++ .../status/clientbound_pong_response_packet.rs | 7 - .../status/clientbound_status_response_packet.rs | 61 --- azalea-protocol/src/packets/status/mod.rs | 25 +- .../src/packets/status/s_ping_request.rs | 7 + .../src/packets/status/s_status_request.rs | 5 + .../status/serverbound_ping_request_packet.rs | 7 - .../status/serverbound_status_request_packet.rs | 5 - azalea-protocol/src/read.rs | 10 +- azalea-protocol/src/write.rs | 126 ++--- 500 files changed, 6019 insertions(+), 6278 deletions(-) create mode 100644 azalea-protocol/src/common/client_information.rs create mode 100644 azalea-protocol/src/common/mod.rs create mode 100644 azalea-protocol/src/common/server_links.rs create mode 100644 azalea-protocol/src/packets/config/c_cookie_request.rs create mode 100644 azalea-protocol/src/packets/config/c_custom_payload.rs create mode 100644 azalea-protocol/src/packets/config/c_custom_report_details.rs create mode 100644 azalea-protocol/src/packets/config/c_disconnect.rs create mode 100644 azalea-protocol/src/packets/config/c_finish_configuration.rs create mode 100644 azalea-protocol/src/packets/config/c_keep_alive.rs create mode 100644 azalea-protocol/src/packets/config/c_ping.rs create mode 100644 azalea-protocol/src/packets/config/c_registry_data.rs create mode 100644 azalea-protocol/src/packets/config/c_reset_chat.rs create mode 100644 azalea-protocol/src/packets/config/c_resource_pack.rs create mode 100644 azalea-protocol/src/packets/config/c_resource_pack_pop.rs create mode 100644 azalea-protocol/src/packets/config/c_resource_pack_push.rs create mode 100644 azalea-protocol/src/packets/config/c_select_known_packs.rs create mode 100644 azalea-protocol/src/packets/config/c_server_links.rs create mode 100644 azalea-protocol/src/packets/config/c_store_cookie.rs create mode 100644 azalea-protocol/src/packets/config/c_transfer.rs create mode 100644 azalea-protocol/src/packets/config/c_update_enabled_features.rs create mode 100644 azalea-protocol/src/packets/config/c_update_tags.rs create mode 100755 azalea-protocol/src/packets/config/mod.rs create mode 100644 azalea-protocol/src/packets/config/s_client_information.rs create mode 100644 azalea-protocol/src/packets/config/s_cookie_response.rs create mode 100644 azalea-protocol/src/packets/config/s_custom_payload.rs create mode 100644 azalea-protocol/src/packets/config/s_finish_configuration.rs create mode 100644 azalea-protocol/src/packets/config/s_keep_alive.rs create mode 100644 azalea-protocol/src/packets/config/s_pong.rs create mode 100644 azalea-protocol/src/packets/config/s_resource_pack.rs create mode 100644 azalea-protocol/src/packets/config/s_select_known_packs.rs delete mode 100644 azalea-protocol/src/packets/configuration/clientbound_cookie_request_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/clientbound_custom_payload_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/clientbound_disconnect_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/clientbound_finish_configuration_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/clientbound_keep_alive_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/clientbound_ping_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/clientbound_registry_data_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/clientbound_reset_chat_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/clientbound_resource_pack_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/clientbound_resource_pack_pop_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/clientbound_resource_pack_push_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/clientbound_select_known_packs_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/clientbound_store_cookie_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/clientbound_transfer_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/clientbound_update_enabled_features_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/clientbound_update_tags_packet.rs delete mode 100755 azalea-protocol/src/packets/configuration/mod.rs delete mode 100644 azalea-protocol/src/packets/configuration/serverbound_client_information_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/serverbound_cookie_response_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/serverbound_custom_payload_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/serverbound_finish_configuration_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/serverbound_keep_alive_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/serverbound_pong_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/serverbound_resource_pack_packet.rs delete mode 100644 azalea-protocol/src/packets/configuration/serverbound_select_known_packs_packet.rs create mode 100755 azalea-protocol/src/packets/game/c_add_entity.rs create mode 100755 azalea-protocol/src/packets/game/c_add_experience_orb.rs create mode 100755 azalea-protocol/src/packets/game/c_add_player.rs create mode 100755 azalea-protocol/src/packets/game/c_animate.rs create mode 100755 azalea-protocol/src/packets/game/c_award_stats.rs create mode 100755 azalea-protocol/src/packets/game/c_block_changed_ack.rs create mode 100755 azalea-protocol/src/packets/game/c_block_destruction.rs create mode 100755 azalea-protocol/src/packets/game/c_block_entity_data.rs create mode 100755 azalea-protocol/src/packets/game/c_block_event.rs create mode 100755 azalea-protocol/src/packets/game/c_block_update.rs create mode 100755 azalea-protocol/src/packets/game/c_boss_event.rs create mode 100644 azalea-protocol/src/packets/game/c_bundle_delimiter.rs create mode 100755 azalea-protocol/src/packets/game/c_change_difficulty.rs create mode 100755 azalea-protocol/src/packets/game/c_chat_preview.rs create mode 100644 azalea-protocol/src/packets/game/c_chunk_batch_finished.rs create mode 100644 azalea-protocol/src/packets/game/c_chunk_batch_start.rs create mode 100644 azalea-protocol/src/packets/game/c_chunks_biomes.rs create mode 100644 azalea-protocol/src/packets/game/c_clear_titles.rs create mode 100755 azalea-protocol/src/packets/game/c_command_suggestions.rs create mode 100755 azalea-protocol/src/packets/game/c_commands.rs create mode 100644 azalea-protocol/src/packets/game/c_container_close.rs create mode 100755 azalea-protocol/src/packets/game/c_container_set_content.rs create mode 100755 azalea-protocol/src/packets/game/c_container_set_data.rs create mode 100755 azalea-protocol/src/packets/game/c_container_set_slot.rs create mode 100755 azalea-protocol/src/packets/game/c_cookie_request.rs create mode 100755 azalea-protocol/src/packets/game/c_cooldown.rs create mode 100755 azalea-protocol/src/packets/game/c_custom_chat_completions.rs create mode 100755 azalea-protocol/src/packets/game/c_custom_payload.rs create mode 100644 azalea-protocol/src/packets/game/c_custom_report_details.rs create mode 100644 azalea-protocol/src/packets/game/c_custom_sound.rs create mode 100644 azalea-protocol/src/packets/game/c_damage_event.rs create mode 100755 azalea-protocol/src/packets/game/c_debug_sample.rs create mode 100755 azalea-protocol/src/packets/game/c_delete_chat.rs create mode 100755 azalea-protocol/src/packets/game/c_disconnect.rs create mode 100644 azalea-protocol/src/packets/game/c_disguised_chat.rs create mode 100755 azalea-protocol/src/packets/game/c_entity_event.rs create mode 100755 azalea-protocol/src/packets/game/c_entity_position_sync.rs create mode 100755 azalea-protocol/src/packets/game/c_explode.rs create mode 100755 azalea-protocol/src/packets/game/c_forget_level_chunk.rs create mode 100755 azalea-protocol/src/packets/game/c_game_event.rs create mode 100755 azalea-protocol/src/packets/game/c_horse_screen_open.rs create mode 100644 azalea-protocol/src/packets/game/c_hurt_animation.rs create mode 100755 azalea-protocol/src/packets/game/c_initialize_border.rs create mode 100755 azalea-protocol/src/packets/game/c_keep_alive.rs create mode 100755 azalea-protocol/src/packets/game/c_level_chunk_with_light.rs create mode 100755 azalea-protocol/src/packets/game/c_level_event.rs create mode 100755 azalea-protocol/src/packets/game/c_level_particles.rs create mode 100755 azalea-protocol/src/packets/game/c_light_update.rs create mode 100755 azalea-protocol/src/packets/game/c_login.rs create mode 100755 azalea-protocol/src/packets/game/c_map_item_data.rs create mode 100755 azalea-protocol/src/packets/game/c_merchant_offers.rs create mode 100755 azalea-protocol/src/packets/game/c_move_entity_pos.rs create mode 100755 azalea-protocol/src/packets/game/c_move_entity_pos_rot.rs create mode 100755 azalea-protocol/src/packets/game/c_move_entity_rot.rs create mode 100644 azalea-protocol/src/packets/game/c_move_minecart_along_track.rs create mode 100755 azalea-protocol/src/packets/game/c_move_vehicle.rs create mode 100755 azalea-protocol/src/packets/game/c_open_book.rs create mode 100755 azalea-protocol/src/packets/game/c_open_screen.rs create mode 100755 azalea-protocol/src/packets/game/c_open_sign_editor.rs create mode 100755 azalea-protocol/src/packets/game/c_ping.rs create mode 100755 azalea-protocol/src/packets/game/c_place_ghost_recipe.rs create mode 100755 azalea-protocol/src/packets/game/c_player_abilities.rs create mode 100644 azalea-protocol/src/packets/game/c_player_chat.rs create mode 100755 azalea-protocol/src/packets/game/c_player_chat_header.rs create mode 100755 azalea-protocol/src/packets/game/c_player_combat_end.rs create mode 100755 azalea-protocol/src/packets/game/c_player_combat_enter.rs create mode 100755 azalea-protocol/src/packets/game/c_player_combat_kill.rs create mode 100644 azalea-protocol/src/packets/game/c_player_info_remove.rs create mode 100644 azalea-protocol/src/packets/game/c_player_info_update.rs create mode 100755 azalea-protocol/src/packets/game/c_player_look_at.rs create mode 100755 azalea-protocol/src/packets/game/c_player_position.rs create mode 100755 azalea-protocol/src/packets/game/c_player_rotation.rs create mode 100755 azalea-protocol/src/packets/game/c_pong_response.rs create mode 100644 azalea-protocol/src/packets/game/c_projectile_power.rs create mode 100755 azalea-protocol/src/packets/game/c_recipe_book_add.rs create mode 100755 azalea-protocol/src/packets/game/c_recipe_book_remove.rs create mode 100755 azalea-protocol/src/packets/game/c_recipe_book_settings.rs create mode 100755 azalea-protocol/src/packets/game/c_remove_entities.rs create mode 100755 azalea-protocol/src/packets/game/c_remove_mob_effect.rs create mode 100644 azalea-protocol/src/packets/game/c_reset_score.rs create mode 100644 azalea-protocol/src/packets/game/c_resource_pack_pop.rs create mode 100644 azalea-protocol/src/packets/game/c_resource_pack_push.rs create mode 100755 azalea-protocol/src/packets/game/c_respawn.rs create mode 100755 azalea-protocol/src/packets/game/c_rotate_head.rs create mode 100755 azalea-protocol/src/packets/game/c_section_blocks_update.rs create mode 100755 azalea-protocol/src/packets/game/c_select_advancements_tab.rs create mode 100755 azalea-protocol/src/packets/game/c_server_data.rs create mode 100644 azalea-protocol/src/packets/game/c_server_links.rs create mode 100755 azalea-protocol/src/packets/game/c_set_action_bar_text.rs create mode 100755 azalea-protocol/src/packets/game/c_set_border_center.rs create mode 100755 azalea-protocol/src/packets/game/c_set_border_lerp_size.rs create mode 100755 azalea-protocol/src/packets/game/c_set_border_size.rs create mode 100755 azalea-protocol/src/packets/game/c_set_border_warning_delay.rs create mode 100755 azalea-protocol/src/packets/game/c_set_border_warning_distance.rs create mode 100755 azalea-protocol/src/packets/game/c_set_camera.rs create mode 100755 azalea-protocol/src/packets/game/c_set_chunk_cache_center.rs create mode 100755 azalea-protocol/src/packets/game/c_set_chunk_cache_radius.rs create mode 100644 azalea-protocol/src/packets/game/c_set_cursor_item.rs create mode 100755 azalea-protocol/src/packets/game/c_set_default_spawn_position.rs create mode 100755 azalea-protocol/src/packets/game/c_set_display_chat_preview.rs create mode 100755 azalea-protocol/src/packets/game/c_set_display_objective.rs create mode 100755 azalea-protocol/src/packets/game/c_set_entity_data.rs create mode 100755 azalea-protocol/src/packets/game/c_set_entity_link.rs create mode 100755 azalea-protocol/src/packets/game/c_set_entity_motion.rs create mode 100755 azalea-protocol/src/packets/game/c_set_equipment.rs create mode 100755 azalea-protocol/src/packets/game/c_set_experience.rs create mode 100755 azalea-protocol/src/packets/game/c_set_health.rs create mode 100644 azalea-protocol/src/packets/game/c_set_held_slot.rs create mode 100755 azalea-protocol/src/packets/game/c_set_objective.rs create mode 100755 azalea-protocol/src/packets/game/c_set_passengers.rs create mode 100644 azalea-protocol/src/packets/game/c_set_player_inventory.rs create mode 100755 azalea-protocol/src/packets/game/c_set_player_team.rs create mode 100755 azalea-protocol/src/packets/game/c_set_score.rs create mode 100755 azalea-protocol/src/packets/game/c_set_simulation_distance.rs create mode 100755 azalea-protocol/src/packets/game/c_set_subtitle_text.rs create mode 100755 azalea-protocol/src/packets/game/c_set_time.rs create mode 100755 azalea-protocol/src/packets/game/c_set_title_text.rs create mode 100755 azalea-protocol/src/packets/game/c_set_titles_animation.rs create mode 100755 azalea-protocol/src/packets/game/c_sound.rs create mode 100755 azalea-protocol/src/packets/game/c_sound_entity.rs create mode 100644 azalea-protocol/src/packets/game/c_start_configuration.rs create mode 100755 azalea-protocol/src/packets/game/c_stop_sound.rs create mode 100644 azalea-protocol/src/packets/game/c_store_cookie.rs create mode 100755 azalea-protocol/src/packets/game/c_system_chat.rs create mode 100755 azalea-protocol/src/packets/game/c_tab_list.rs create mode 100755 azalea-protocol/src/packets/game/c_tag_query.rs create mode 100755 azalea-protocol/src/packets/game/c_take_item_entity.rs create mode 100755 azalea-protocol/src/packets/game/c_teleport_entity.rs create mode 100644 azalea-protocol/src/packets/game/c_ticking_state.rs create mode 100644 azalea-protocol/src/packets/game/c_ticking_step.rs create mode 100644 azalea-protocol/src/packets/game/c_transfer.rs create mode 100755 azalea-protocol/src/packets/game/c_update_advancements.rs create mode 100755 azalea-protocol/src/packets/game/c_update_attributes.rs create mode 100644 azalea-protocol/src/packets/game/c_update_enabled_features.rs create mode 100755 azalea-protocol/src/packets/game/c_update_mob_effect.rs create mode 100755 azalea-protocol/src/packets/game/c_update_recipes.rs create mode 100755 azalea-protocol/src/packets/game/c_update_tags.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_add_experience_orb_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_add_player_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_animate_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_award_stats_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_block_changed_ack_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_block_destruction_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_block_entity_data_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_block_event_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_block_update_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_boss_event_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_bundle_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_change_difficulty_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_chat_preview_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_chunk_batch_finished_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_chunk_batch_start_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_chunks_biomes_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_clear_titles_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_command_suggestions_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_commands_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_container_close_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_container_set_data_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_container_set_slot_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_cookie_request_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_cooldown_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_custom_chat_completions_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_custom_report_details_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_custom_sound_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_damage_event_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_debug_sample_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_delete_chat_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_disguised_chat_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_entity_event_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_entity_position_sync_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_explode_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_forget_level_chunk_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_game_event_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_horse_screen_open_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_hurt_animation_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_keep_alive_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_level_event_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_light_update_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_login_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_map_item_data_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_merchant_offers_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_move_entity_pos_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_move_entity_pos_rot_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_move_entity_rot_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_move_minecart_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_move_vehicle_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_open_book_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_open_sign_editor_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_ping_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_place_ghost_recipe_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_player_chat_header_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_player_combat_end_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_player_combat_enter_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_player_combat_kill_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_player_info_remove_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_player_info_update_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_player_look_at_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_player_position_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_player_rotation_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_pong_response_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_projectile_power_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_recipe_book_add_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_recipe_book_remove_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_recipe_book_settings_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_remove_entities_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_remove_mob_effect_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_reset_score_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_resource_pack_pop_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_resource_pack_push_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_respawn_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_section_blocks_update_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_select_advancements_tab_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_server_data_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_server_links_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_action_bar_text_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_border_center_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_border_lerp_size_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_border_size_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_border_warning_delay_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_border_warning_distance_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_camera_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_chunk_cache_center_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_chunk_cache_radius_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_set_cursor_item_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_default_spawn_position_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_display_chat_preview_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_display_objective_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_entity_link_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_entity_motion_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_experience_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_health_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_set_held_slot_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_objective_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_passengers_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_set_player_inventory_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_player_team_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_score_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_simulation_distance_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_subtitle_text_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_time_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_title_text_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_set_titles_animation_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_sound_entity_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_sound_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_start_configuration_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_stop_sound_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_store_cookie_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_system_chat_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_tab_list_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_tag_query_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_take_item_entity_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_teleport_entity_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_ticking_state_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_ticking_step_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_transfer_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs delete mode 100644 azalea-protocol/src/packets/game/clientbound_update_enabled_features_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs delete mode 100755 azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs create mode 100755 azalea-protocol/src/packets/game/s_accept_teleportation.rs create mode 100644 azalea-protocol/src/packets/game/s_block_entity_tag_query.rs create mode 100644 azalea-protocol/src/packets/game/s_bundle_item_selected.rs create mode 100755 azalea-protocol/src/packets/game/s_change_difficulty.rs create mode 100755 azalea-protocol/src/packets/game/s_chat.rs create mode 100755 azalea-protocol/src/packets/game/s_chat_ack.rs create mode 100755 azalea-protocol/src/packets/game/s_chat_command.rs create mode 100755 azalea-protocol/src/packets/game/s_chat_command_signed.rs create mode 100755 azalea-protocol/src/packets/game/s_chat_preview.rs create mode 100644 azalea-protocol/src/packets/game/s_chat_session_update.rs create mode 100644 azalea-protocol/src/packets/game/s_chunk_batch_received.rs create mode 100755 azalea-protocol/src/packets/game/s_client_command.rs create mode 100755 azalea-protocol/src/packets/game/s_client_information.rs create mode 100644 azalea-protocol/src/packets/game/s_client_tick_end.rs create mode 100755 azalea-protocol/src/packets/game/s_command_suggestion.rs create mode 100644 azalea-protocol/src/packets/game/s_configuration_acknowledged.rs create mode 100755 azalea-protocol/src/packets/game/s_container_button_click.rs create mode 100755 azalea-protocol/src/packets/game/s_container_click.rs create mode 100755 azalea-protocol/src/packets/game/s_container_close.rs create mode 100644 azalea-protocol/src/packets/game/s_container_slot_state_changed.rs create mode 100644 azalea-protocol/src/packets/game/s_cookie_response.rs create mode 100755 azalea-protocol/src/packets/game/s_custom_payload.rs create mode 100644 azalea-protocol/src/packets/game/s_debug_sample_subscription.rs create mode 100755 azalea-protocol/src/packets/game/s_edit_book.rs create mode 100644 azalea-protocol/src/packets/game/s_entity_tag_query.rs create mode 100755 azalea-protocol/src/packets/game/s_interact.rs create mode 100755 azalea-protocol/src/packets/game/s_jigsaw_generate.rs create mode 100755 azalea-protocol/src/packets/game/s_keep_alive.rs create mode 100755 azalea-protocol/src/packets/game/s_lock_difficulty.rs create mode 100755 azalea-protocol/src/packets/game/s_move_player_pos.rs create mode 100755 azalea-protocol/src/packets/game/s_move_player_pos_rot.rs create mode 100755 azalea-protocol/src/packets/game/s_move_player_rot.rs create mode 100755 azalea-protocol/src/packets/game/s_move_player_status_only.rs create mode 100755 azalea-protocol/src/packets/game/s_move_vehicle.rs create mode 100755 azalea-protocol/src/packets/game/s_paddle_boat.rs create mode 100755 azalea-protocol/src/packets/game/s_pick_item.rs create mode 100644 azalea-protocol/src/packets/game/s_pick_item_from_entity.rs create mode 100755 azalea-protocol/src/packets/game/s_ping_request.rs create mode 100755 azalea-protocol/src/packets/game/s_place_recipe.rs create mode 100755 azalea-protocol/src/packets/game/s_player_abilities.rs create mode 100755 azalea-protocol/src/packets/game/s_player_action.rs create mode 100755 azalea-protocol/src/packets/game/s_player_command.rs create mode 100755 azalea-protocol/src/packets/game/s_player_input.rs create mode 100644 azalea-protocol/src/packets/game/s_player_loaded.rs create mode 100755 azalea-protocol/src/packets/game/s_pong.rs create mode 100755 azalea-protocol/src/packets/game/s_recipe_book_change_settings.rs create mode 100755 azalea-protocol/src/packets/game/s_recipe_book_seen_recipe.rs create mode 100755 azalea-protocol/src/packets/game/s_rename_item.rs create mode 100755 azalea-protocol/src/packets/game/s_resource_pack.rs create mode 100755 azalea-protocol/src/packets/game/s_seen_advancements.rs create mode 100755 azalea-protocol/src/packets/game/s_select_trade.rs create mode 100755 azalea-protocol/src/packets/game/s_set_beacon.rs create mode 100755 azalea-protocol/src/packets/game/s_set_carried_item.rs create mode 100755 azalea-protocol/src/packets/game/s_set_command_block.rs create mode 100755 azalea-protocol/src/packets/game/s_set_command_minecart.rs create mode 100755 azalea-protocol/src/packets/game/s_set_creative_mode_slot.rs create mode 100755 azalea-protocol/src/packets/game/s_set_jigsaw_block.rs create mode 100755 azalea-protocol/src/packets/game/s_set_structure_block.rs create mode 100755 azalea-protocol/src/packets/game/s_sign_update.rs create mode 100755 azalea-protocol/src/packets/game/s_swing.rs create mode 100755 azalea-protocol/src/packets/game/s_teleport_to_entity.rs create mode 100755 azalea-protocol/src/packets/game/s_use_item.rs create mode 100755 azalea-protocol/src/packets/game/s_use_item_on.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_accept_teleportation_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_block_entity_tag_query.rs delete mode 100644 azalea-protocol/src/packets/game/serverbound_block_entity_tag_query_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_change_difficulty_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_chat_ack_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_chat_command_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_chat_command_signed_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_chat_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_chat_preview_packet.rs delete mode 100644 azalea-protocol/src/packets/game/serverbound_chat_session_update_packet.rs delete mode 100644 azalea-protocol/src/packets/game/serverbound_chunk_batch_received_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_client_command_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_client_information_packet.rs delete mode 100644 azalea-protocol/src/packets/game/serverbound_client_tick_end_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_command_suggestion_packet.rs delete mode 100644 azalea-protocol/src/packets/game/serverbound_configuration_acknowledged_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_container_button_click_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_container_click_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_container_close_packet.rs delete mode 100644 azalea-protocol/src/packets/game/serverbound_container_slot_state_changed_packet.rs delete mode 100644 azalea-protocol/src/packets/game/serverbound_cookie_response_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_debug_sample_subscription.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_edit_book_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_entity_tag_query.rs delete mode 100644 azalea-protocol/src/packets/game/serverbound_entity_tag_query_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_interact_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_jigsaw_generate_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_keep_alive_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_lock_difficulty_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_move_player_pos_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_move_player_pos_rot_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_move_player_rot_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_move_player_status_only_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_move_vehicle_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_paddle_boat_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_pick_item_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_ping_request_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_place_recipe_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_player_action_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_player_command_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_player_input_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_pong_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_recipe_book_change_settings_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_recipe_book_seen_recipe_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_rename_item_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_resource_pack_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_seen_advancements_packet.rs delete mode 100644 azalea-protocol/src/packets/game/serverbound_select_bundle_item_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_select_trade_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_set_beacon_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_set_carried_item_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_set_command_block_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_set_command_minecart_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_set_creative_mode_slot_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_set_jigsaw_block_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_set_structure_block_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_sign_update_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_swing_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_teleport_to_entity_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_use_item_on_packet.rs delete mode 100755 azalea-protocol/src/packets/game/serverbound_use_item_packet.rs create mode 100755 azalea-protocol/src/packets/handshake/mod.rs create mode 100755 azalea-protocol/src/packets/handshake/s_intention.rs delete mode 100755 azalea-protocol/src/packets/handshaking/client_intention_packet.rs delete mode 100755 azalea-protocol/src/packets/handshaking/mod.rs create mode 100755 azalea-protocol/src/packets/login/c_cookie_request.rs create mode 100755 azalea-protocol/src/packets/login/c_custom_query.rs create mode 100755 azalea-protocol/src/packets/login/c_hello.rs create mode 100755 azalea-protocol/src/packets/login/c_login_compression.rs create mode 100755 azalea-protocol/src/packets/login/c_login_disconnect.rs create mode 100755 azalea-protocol/src/packets/login/c_login_finished.rs delete mode 100755 azalea-protocol/src/packets/login/clientbound_cookie_request_packet.rs delete mode 100755 azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs delete mode 100755 azalea-protocol/src/packets/login/clientbound_hello_packet.rs delete mode 100755 azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs delete mode 100755 azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs delete mode 100755 azalea-protocol/src/packets/login/clientbound_login_finished_packet.rs create mode 100755 azalea-protocol/src/packets/login/s_cookie_response.rs create mode 100755 azalea-protocol/src/packets/login/s_custom_query.rs create mode 100644 azalea-protocol/src/packets/login/s_custom_query_answer.rs create mode 100755 azalea-protocol/src/packets/login/s_hello.rs create mode 100755 azalea-protocol/src/packets/login/s_key.rs create mode 100644 azalea-protocol/src/packets/login/s_login_acknowledged.rs delete mode 100755 azalea-protocol/src/packets/login/serverbound_cookie_response_packet.rs delete mode 100644 azalea-protocol/src/packets/login/serverbound_custom_query_answer_packet.rs delete mode 100755 azalea-protocol/src/packets/login/serverbound_custom_query_packet.rs delete mode 100755 azalea-protocol/src/packets/login/serverbound_hello_packet.rs delete mode 100755 azalea-protocol/src/packets/login/serverbound_key_packet.rs delete mode 100644 azalea-protocol/src/packets/login/serverbound_login_acknowledged_packet.rs create mode 100755 azalea-protocol/src/packets/status/c_pong_response.rs create mode 100755 azalea-protocol/src/packets/status/c_status_response.rs delete mode 100755 azalea-protocol/src/packets/status/clientbound_pong_response_packet.rs delete mode 100755 azalea-protocol/src/packets/status/clientbound_status_response_packet.rs create mode 100755 azalea-protocol/src/packets/status/s_ping_request.rs create mode 100755 azalea-protocol/src/packets/status/s_status_request.rs delete mode 100755 azalea-protocol/src/packets/status/serverbound_ping_request_packet.rs delete mode 100755 azalea-protocol/src/packets/status/serverbound_status_request_packet.rs (limited to 'azalea-protocol/src') diff --git a/azalea-protocol/src/common/client_information.rs b/azalea-protocol/src/common/client_information.rs new file mode 100644 index 00000000..6f5e05e2 --- /dev/null +++ b/azalea-protocol/src/common/client_information.rs @@ -0,0 +1,187 @@ +use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite}; +use azalea_core::bitset::FixedBitSet; +use bevy_ecs::component::Component; + +/// A component that contains some of the "settings" for this client that are +/// sent to the server, such as render distance. This is only present on local +/// players. +#[derive(Clone, Debug, AzBuf, PartialEq, Eq, Component)] +pub struct ClientInformation { + /// The locale of the client. + pub language: String, + /// The view distance of the client in chunks, same as the render distance + /// in-game. + pub view_distance: u8, + /// The types of chat messages the client wants to receive. Note that many + /// servers ignore this. + pub chat_visibility: ChatVisibility, + /// Whether the messages sent from the server should have colors. Note that + /// many servers ignore this and always send colored messages. + pub chat_colors: bool, + pub model_customization: ModelCustomization, + pub main_hand: HumanoidArm, + pub text_filtering_enabled: bool, + /// Whether the client should show up as "Anonymous Player" in the server + /// list. + pub allows_listing: bool, + pub particle_status: ParticleStatus, +} + +impl Default for ClientInformation { + fn default() -> Self { + Self { + language: "en_us".to_string(), + view_distance: 8, + chat_visibility: ChatVisibility::default(), + chat_colors: true, + model_customization: ModelCustomization::default(), + main_hand: HumanoidArm::Right, + text_filtering_enabled: false, + allows_listing: false, + particle_status: ParticleStatus::default(), + } + } +} + +#[derive(AzBuf, Clone, Copy, Debug, PartialEq, Eq, Default)] +pub enum ChatVisibility { + /// All chat messages should be sent to the client. + #[default] + Full = 0, + /// Chat messages from other players should be not sent to the client, only + /// messages from the server like "Player joined the game" should be sent. + System = 1, + /// No chat messages should be sent to the client. + Hidden = 2, +} + +#[derive(AzBuf, Clone, Copy, Debug, PartialEq, Eq, Default)] +pub enum HumanoidArm { + Left = 0, + #[default] + Right = 1, +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct ModelCustomization { + pub cape: bool, + pub jacket: bool, + pub left_sleeve: bool, + pub right_sleeve: bool, + pub left_pants: bool, + pub right_pants: bool, + pub hat: bool, +} + +#[derive(AzBuf, Clone, Copy, Debug, PartialEq, Eq, Default)] +pub enum ParticleStatus { + #[default] + All, + Decreased, + Minimal, +} + +impl Default for ModelCustomization { + fn default() -> Self { + Self { + cape: true, + jacket: true, + left_sleeve: true, + right_sleeve: true, + left_pants: true, + right_pants: true, + hat: true, + } + } +} + +impl AzaleaRead for ModelCustomization { + fn azalea_read(buf: &mut std::io::Cursor<&[u8]>) -> Result { + let set = FixedBitSet::<7>::azalea_read(buf)?; + Ok(Self { + cape: set.index(0), + jacket: set.index(1), + left_sleeve: set.index(2), + right_sleeve: set.index(3), + left_pants: set.index(4), + right_pants: set.index(5), + hat: set.index(6), + }) + } +} + +impl AzaleaWrite for ModelCustomization { + fn azalea_write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { + let mut set = FixedBitSet::<7>::new(); + if self.cape { + set.set(0); + } + if self.jacket { + set.set(1); + } + if self.left_sleeve { + set.set(2); + } + if self.right_sleeve { + set.set(3); + } + if self.left_pants { + set.set(4); + } + if self.right_pants { + set.set(5); + } + if self.hat { + set.set(6); + } + set.azalea_write(buf) + } +} + +#[cfg(test)] +mod tests { + use std::io::Cursor; + + use azalea_buf::{AzaleaRead, AzaleaWrite}; + + use super::*; + + #[test] + fn test_client_information() { + { + let data = ClientInformation::default(); + let mut buf = Vec::new(); + data.azalea_write(&mut buf).unwrap(); + let mut data_cursor: Cursor<&[u8]> = Cursor::new(&buf); + + let read_data = ClientInformation::azalea_read(&mut data_cursor).unwrap(); + assert_eq!(read_data, data); + } + + let data = ClientInformation { + language: "en_gb".to_string(), + view_distance: 24, + chat_visibility: ChatVisibility::Hidden, + chat_colors: false, + model_customization: ModelCustomization { + cape: false, + jacket: false, + left_sleeve: true, + right_sleeve: false, + left_pants: true, + right_pants: false, + hat: true, + }, + main_hand: HumanoidArm::Left, + text_filtering_enabled: true, + allows_listing: true, + particle_status: ParticleStatus::Decreased, + }; + let mut buf = Vec::new(); + data.azalea_write(&mut buf).unwrap(); + let mut data_cursor: Cursor<&[u8]> = Cursor::new(&buf); + + let read_data = ClientInformation::azalea_read(&mut data_cursor).unwrap(); + assert_eq!(read_data, data); + } +} diff --git a/azalea-protocol/src/common/mod.rs b/azalea-protocol/src/common/mod.rs new file mode 100644 index 00000000..da535b48 --- /dev/null +++ b/azalea-protocol/src/common/mod.rs @@ -0,0 +1,4 @@ +//! Some serializable data types that are used by several packets. + +pub mod client_information; +pub mod server_links; diff --git a/azalea-protocol/src/common/server_links.rs b/azalea-protocol/src/common/server_links.rs new file mode 100644 index 00000000..4aed98f3 --- /dev/null +++ b/azalea-protocol/src/common/server_links.rs @@ -0,0 +1,28 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; + +#[derive(Clone, Debug, AzBuf)] +pub struct ServerLinkEntry { + pub kind: ServerLinkKind, + pub link: String, +} + +#[derive(Clone, Debug, AzBuf)] +pub enum ServerLinkKind { + Known(KnownLinkKind), + Component(FormattedText), +} + +#[derive(Clone, Copy, Debug, AzBuf)] +pub enum KnownLinkKind { + BugReport, + CommunityGuidelines, + Support, + Status, + Feedback, + Community, + Website, + Forums, + News, + Announcements, +} diff --git a/azalea-protocol/src/connect.rs b/azalea-protocol/src/connect.rs index 0a449bfd..f64d9eb8 100755 --- a/azalea-protocol/src/connect.rs +++ b/azalea-protocol/src/connect.rs @@ -16,12 +16,10 @@ use tokio::net::TcpStream; use tracing::{error, info}; use uuid::Uuid; -use crate::packets::configuration::{ - ClientboundConfigurationPacket, ServerboundConfigurationPacket, -}; +use crate::packets::config::{ClientboundConfigPacket, ServerboundConfigPacket}; use crate::packets::game::{ClientboundGamePacket, ServerboundGamePacket}; -use crate::packets::handshaking::{ClientboundHandshakePacket, ServerboundHandshakePacket}; -use crate::packets::login::clientbound_hello_packet::ClientboundHelloPacket; +use crate::packets::handshake::{ClientboundHandshakePacket, ServerboundHandshakePacket}; +use crate::packets::login::c_hello::ClientboundHello; use crate::packets::login::{ClientboundLoginPacket, ServerboundLoginPacket}; use crate::packets::status::{ClientboundStatusPacket, ServerboundStatusPacket}; use crate::packets::ProtocolPacket; @@ -66,10 +64,10 @@ pub struct WriteConnection { /// ClientIntention, PROTOCOL_VERSION, /// login::{ /// ClientboundLoginPacket, -/// serverbound_hello_packet::ServerboundHelloPacket, -/// serverbound_key_packet::ServerboundKeyPacket +/// ServerboundHello, +/// ServerboundKey /// }, -/// handshaking::client_intention_packet::ClientIntentionPacket +/// handshake::ServerboundIntention /// } /// }; /// @@ -79,28 +77,20 @@ pub struct WriteConnection { /// let mut conn = Connection::new(&resolved_address).await?; /// /// // handshake -/// conn.write( -/// ClientIntentionPacket { -/// protocol_version: PROTOCOL_VERSION, -/// hostname: resolved_address.ip().to_string(), -/// port: resolved_address.port(), -/// intention: ClientIntention::Login, -/// } -/// .get(), -/// ) -/// .await?; +/// conn.write(ServerboundIntention { +/// protocol_version: PROTOCOL_VERSION, +/// hostname: resolved_address.ip().to_string(), +/// port: resolved_address.port(), +/// intention: ClientIntention::Login, +/// }).await?; /// /// let mut conn = conn.login(); /// /// // login -/// conn.write( -/// ServerboundHelloPacket { -/// name: "bot".to_string(), -/// profile_id: uuid::Uuid::nil(), -/// } -/// .get(), -/// ) -/// .await?; +/// conn.write(ServerboundHello { +/// name: "bot".to_string(), +/// profile_id: uuid::Uuid::nil(), +/// }).await?; /// /// let (conn, game_profile) = loop { /// let packet = conn.read().await?; @@ -108,14 +98,10 @@ pub struct WriteConnection { /// ClientboundLoginPacket::Hello(p) => { /// let e = azalea_crypto::encrypt(&p.public_key, &p.challenge).unwrap(); /// -/// conn.write( -/// ServerboundKeyPacket { -/// key_bytes: e.encrypted_public_key, -/// encrypted_challenge: e.encrypted_challenge, -/// } -/// .get(), -/// ) -/// .await?; +/// conn.write(ServerboundKey { +/// key_bytes: e.encrypted_public_key, +/// encrypted_challenge: e.encrypted_challenge, +/// }).await?; /// conn.set_encryption_key(e.secret_key); /// } /// ClientboundLoginPacket::LoginCompression(p) => { @@ -243,7 +229,8 @@ where } /// Write a packet to the other side of the connection. - pub async fn write(&mut self, packet: W) -> std::io::Result<()> { + pub async fn write(&mut self, packet: impl crate::packets::Packet) -> std::io::Result<()> { + let packet = packet.into_variant(); self.writer.write(packet).await } @@ -368,9 +355,7 @@ impl Connection { /// Change our state from login to configuration. This is the state where /// the server sends us the registries and resource pack and stuff. #[must_use] - pub fn configuration( - self, - ) -> Connection { + pub fn configuration(self) -> Connection { Connection::from(self) } @@ -385,7 +370,7 @@ impl Connection { /// use azalea_protocol::connect::Connection; /// use azalea_protocol::packets::login::{ /// ClientboundLoginPacket, - /// serverbound_key_packet::ServerboundKeyPacket + /// ServerboundKey /// }; /// use uuid::Uuid; /// # use azalea_protocol::ServerAddress; @@ -414,12 +399,10 @@ impl Connection { /// e.secret_key, /// &p /// ).await?; - /// conn.write( - /// ServerboundKeyPacket { - /// key_bytes: e.encrypted_public_key, - /// encrypted_challenge: e.encrypted_challenge, - /// }.get() - /// ).await?; + /// conn.write(ServerboundKey { + /// key_bytes: e.encrypted_public_key, + /// encrypted_challenge: e.encrypted_challenge, + /// }).await?; /// conn.set_encryption_key(e.secret_key); /// } /// _ => {} @@ -432,7 +415,7 @@ impl Connection { access_token: &str, uuid: &Uuid, private_key: [u8; 16], - packet: &ClientboundHelloPacket, + packet: &ClientboundHello, ) -> Result<(), ClientSessionServerError> { azalea_auth::sessionserver::join( access_token, @@ -506,14 +489,12 @@ impl Connection { /// Change our state back to configuration. #[must_use] - pub fn configuration( - self, - ) -> Connection { + pub fn configuration(self) -> Connection { Connection::from(self) } } -impl Connection { +impl Connection { /// Change our state from configuration to game. This is the state that's /// used when the client is actually in the world. #[must_use] @@ -522,7 +503,7 @@ impl Connection } } -impl Connection { +impl Connection { /// Change our state from configuration to game. This is the state that's /// used when the client is actually in the world. #[must_use] @@ -534,9 +515,7 @@ impl Connection impl Connection { /// Change our state back to configuration. #[must_use] - pub fn configuration( - self, - ) -> Connection { + pub fn configuration(self) -> Connection { Connection::from(self) } } diff --git a/azalea-protocol/src/lib.rs b/azalea-protocol/src/lib.rs index 1bbb80d4..fb271433 100644 --- a/azalea-protocol/src/lib.rs +++ b/azalea-protocol/src/lib.rs @@ -14,6 +14,7 @@ use std::{fmt::Display, net::SocketAddr, str::FromStr}; +pub mod common; #[cfg(feature = "connecting")] pub mod connect; #[cfg(feature = "packets")] @@ -108,8 +109,9 @@ mod tests { use crate::{ packets::{ - game::serverbound_chat_packet::{LastSeenMessagesUpdate, ServerboundChatPacket}, - login::{serverbound_hello_packet::ServerboundHelloPacket, ServerboundLoginPacket}, + game::s_chat::{LastSeenMessagesUpdate, ServerboundChat}, + login::{s_hello::ServerboundHello, ServerboundLoginPacket}, + Packet, }, read::{compression_decoder, read_packet}, write::{compression_encoder, serialize_packet, write_packet}, @@ -117,13 +119,12 @@ mod tests { #[tokio::test] async fn test_hello_packet() { - let packet = ServerboundHelloPacket { + let packet = ServerboundHello { name: "test".to_string(), profile_id: Uuid::nil(), - } - .get(); + }; let mut stream = Vec::new(); - write_packet(&packet, &mut stream, None, &mut None) + write_packet(&packet.into_variant(), &mut stream, None, &mut None) .await .unwrap(); @@ -141,11 +142,11 @@ mod tests { #[tokio::test] async fn test_double_hello_packet() { - let packet = ServerboundHelloPacket { + let packet = ServerboundHello { name: "test".to_string(), profile_id: Uuid::nil(), } - .get(); + .into_variant(); let mut stream = Vec::new(); write_packet(&packet, &mut stream, None, &mut None) .await @@ -170,14 +171,14 @@ mod tests { let compression_threshold = 256; let buf = serialize_packet( - &ServerboundChatPacket { + &ServerboundChat { message: "a".repeat(256), timestamp: 0, salt: 0, signature: None, last_seen_messages: LastSeenMessagesUpdate::default(), } - .get(), + .into_variant(), ) .unwrap(); diff --git a/azalea-protocol/src/packets/common.rs b/azalea-protocol/src/packets/common.rs index 173e15fc..fc78cd7a 100644 --- a/azalea-protocol/src/packets/common.rs +++ b/azalea-protocol/src/packets/common.rs @@ -1,11 +1,11 @@ -use azalea_buf::McBuf; +use azalea_buf::AzBuf; use azalea_core::{ game_type::{GameMode, OptionalGameType}, position::GlobalPos, resource_location::ResourceLocation, }; -#[derive(Clone, Debug, McBuf)] +#[derive(Clone, Debug, AzBuf)] pub struct CommonPlayerSpawnInfo { pub dimension_type: azalea_registry::DimensionType, pub dimension: ResourceLocation, diff --git a/azalea-protocol/src/packets/config/c_cookie_request.rs b/azalea-protocol/src/packets/config/c_cookie_request.rs new file mode 100644 index 00000000..4c57718d --- /dev/null +++ b/azalea-protocol/src/packets/config/c_cookie_request.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundCookieRequest { + pub key: ResourceLocation, +} diff --git a/azalea-protocol/src/packets/config/c_custom_payload.rs b/azalea-protocol/src/packets/config/c_custom_payload.rs new file mode 100644 index 00000000..3432ac3a --- /dev/null +++ b/azalea-protocol/src/packets/config/c_custom_payload.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_buf::UnsizedByteArray; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundCustomPayload { + pub identifier: ResourceLocation, + pub data: UnsizedByteArray, +} diff --git a/azalea-protocol/src/packets/config/c_custom_report_details.rs b/azalea-protocol/src/packets/config/c_custom_report_details.rs new file mode 100644 index 00000000..5fa375d0 --- /dev/null +++ b/azalea-protocol/src/packets/config/c_custom_report_details.rs @@ -0,0 +1,9 @@ +use std::collections::HashMap; + +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundCustomReportDetails { + pub details: HashMap, +} diff --git a/azalea-protocol/src/packets/config/c_disconnect.rs b/azalea-protocol/src/packets/config/c_disconnect.rs new file mode 100644 index 00000000..b59b318d --- /dev/null +++ b/azalea-protocol/src/packets/config/c_disconnect.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundDisconnect { + pub reason: FormattedText, +} diff --git a/azalea-protocol/src/packets/config/c_finish_configuration.rs b/azalea-protocol/src/packets/config/c_finish_configuration.rs new file mode 100644 index 00000000..e3f3e5a5 --- /dev/null +++ b/azalea-protocol/src/packets/config/c_finish_configuration.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundFinishConfiguration {} diff --git a/azalea-protocol/src/packets/config/c_keep_alive.rs b/azalea-protocol/src/packets/config/c_keep_alive.rs new file mode 100644 index 00000000..f0310c34 --- /dev/null +++ b/azalea-protocol/src/packets/config/c_keep_alive.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundKeepAlive { + pub id: u64, +} diff --git a/azalea-protocol/src/packets/config/c_ping.rs b/azalea-protocol/src/packets/config/c_ping.rs new file mode 100644 index 00000000..35b5c39c --- /dev/null +++ b/azalea-protocol/src/packets/config/c_ping.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundPing { + pub id: u32, +} diff --git a/azalea-protocol/src/packets/config/c_registry_data.rs b/azalea-protocol/src/packets/config/c_registry_data.rs new file mode 100644 index 00000000..185de4c3 --- /dev/null +++ b/azalea-protocol/src/packets/config/c_registry_data.rs @@ -0,0 +1,12 @@ +use std::collections::HashMap; + +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundConfigPacket; +use simdnbt::owned::NbtCompound; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundRegistryData { + pub registry_id: ResourceLocation, + pub entries: HashMap>, +} diff --git a/azalea-protocol/src/packets/config/c_reset_chat.rs b/azalea-protocol/src/packets/config/c_reset_chat.rs new file mode 100644 index 00000000..273cb0fd --- /dev/null +++ b/azalea-protocol/src/packets/config/c_reset_chat.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundResetChat; diff --git a/azalea-protocol/src/packets/config/c_resource_pack.rs b/azalea-protocol/src/packets/config/c_resource_pack.rs new file mode 100644 index 00000000..63a59b5b --- /dev/null +++ b/azalea-protocol/src/packets/config/c_resource_pack.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundResourcePack { + pub url: String, + pub hash: String, + pub required: bool, + pub prompt: Option, +} diff --git a/azalea-protocol/src/packets/config/c_resource_pack_pop.rs b/azalea-protocol/src/packets/config/c_resource_pack_pop.rs new file mode 100644 index 00000000..f949a726 --- /dev/null +++ b/azalea-protocol/src/packets/config/c_resource_pack_pop.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundConfigPacket; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundResourcePackPop { + pub id: Option, +} diff --git a/azalea-protocol/src/packets/config/c_resource_pack_push.rs b/azalea-protocol/src/packets/config/c_resource_pack_push.rs new file mode 100644 index 00000000..6be5c709 --- /dev/null +++ b/azalea-protocol/src/packets/config/c_resource_pack_push.rs @@ -0,0 +1,13 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundConfigPacket; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundResourcePackPush { + pub id: Uuid, + pub url: String, + pub hash: String, + pub required: bool, + pub prompt: Option, +} diff --git a/azalea-protocol/src/packets/config/c_select_known_packs.rs b/azalea-protocol/src/packets/config/c_select_known_packs.rs new file mode 100644 index 00000000..6a4f76db --- /dev/null +++ b/azalea-protocol/src/packets/config/c_select_known_packs.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundConfigPacket; + +use super::s_select_known_packs::KnownPack; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundSelectKnownPacks { + pub known_packs: Vec, +} diff --git a/azalea-protocol/src/packets/config/c_server_links.rs b/azalea-protocol/src/packets/config/c_server_links.rs new file mode 100644 index 00000000..3420e592 --- /dev/null +++ b/azalea-protocol/src/packets/config/c_server_links.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundConfigPacket; + +use crate::common::server_links::ServerLinkEntry; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundServerLinks { + pub links: Vec, +} diff --git a/azalea-protocol/src/packets/config/c_store_cookie.rs b/azalea-protocol/src/packets/config/c_store_cookie.rs new file mode 100644 index 00000000..c52211ea --- /dev/null +++ b/azalea-protocol/src/packets/config/c_store_cookie.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundStoreCookie { + pub key: ResourceLocation, + pub payload: Vec, +} diff --git a/azalea-protocol/src/packets/config/c_transfer.rs b/azalea-protocol/src/packets/config/c_transfer.rs new file mode 100644 index 00000000..332421d8 --- /dev/null +++ b/azalea-protocol/src/packets/config/c_transfer.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundTransfer { + pub host: String, + #[var] + pub port: u32, +} diff --git a/azalea-protocol/src/packets/config/c_update_enabled_features.rs b/azalea-protocol/src/packets/config/c_update_enabled_features.rs new file mode 100644 index 00000000..4529c757 --- /dev/null +++ b/azalea-protocol/src/packets/config/c_update_enabled_features.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundUpdateEnabledFeatures { + pub features: Vec, +} diff --git a/azalea-protocol/src/packets/config/c_update_tags.rs b/azalea-protocol/src/packets/config/c_update_tags.rs new file mode 100644 index 00000000..678a5ccf --- /dev/null +++ b/azalea-protocol/src/packets/config/c_update_tags.rs @@ -0,0 +1,74 @@ +use std::io::Cursor; +use std::ops::Deref; +use std::{collections::HashMap, io::Write}; + +use azalea_buf::{AzBuf, AzaleaReadVar, AzaleaWriteVar, BufReadError}; +use azalea_buf::{AzaleaRead, AzaleaWrite}; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] +pub struct ClientboundUpdateTags { + pub tags: TagMap, +} + +#[derive(Clone, Debug)] +pub struct Tags { + pub name: ResourceLocation, + pub elements: Vec, +} + +#[derive(Clone, Debug)] +pub struct TagMap(pub HashMap>); + +impl AzaleaRead for TagMap { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let length = u32::azalea_read_var(buf)? as usize; + let mut data = HashMap::with_capacity(length); + for _ in 0..length { + let tag_type = ResourceLocation::azalea_read(buf)?; + let tags_count = i32::azalea_read_var(buf)? as usize; + let mut tags_vec = Vec::with_capacity(tags_count); + for _ in 0..tags_count { + let tags = Tags::azalea_read(buf)?; + tags_vec.push(tags); + } + data.insert(tag_type, tags_vec); + } + Ok(TagMap(data)) + } +} + +impl AzaleaWrite for TagMap { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + (self.len() as u32).azalea_write_var(buf)?; + for (k, v) in &self.0 { + k.azalea_write(buf)?; + v.azalea_write(buf)?; + } + Ok(()) + } +} +impl AzaleaRead for Tags { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let name = ResourceLocation::azalea_read(buf)?; + let elements = Vec::::azalea_read_var(buf)?; + Ok(Tags { name, elements }) + } +} + +impl AzaleaWrite for Tags { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + self.name.azalea_write(buf)?; + self.elements.azalea_write_var(buf)?; + Ok(()) + } +} + +impl Deref for TagMap { + type Target = HashMap>; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} diff --git a/azalea-protocol/src/packets/config/mod.rs b/azalea-protocol/src/packets/config/mod.rs new file mode 100755 index 00000000..4eda0f03 --- /dev/null +++ b/azalea-protocol/src/packets/config/mod.rs @@ -0,0 +1,36 @@ +// NOTE: This file is generated automatically by codegen/packet.py. +// Don't edit it directly! + +use azalea_protocol_macros::declare_state_packets; + +declare_state_packets!(ConfigPacket, + Clientbound => [ + 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, + ], + Serverbound => [ + client_information, + cookie_response, + custom_payload, + finish_configuration, + keep_alive, + pong, + resource_pack, + select_known_packs, + ] +); diff --git a/azalea-protocol/src/packets/config/s_client_information.rs b/azalea-protocol/src/packets/config/s_client_information.rs new file mode 100644 index 00000000..d58ce502 --- /dev/null +++ b/azalea-protocol/src/packets/config/s_client_information.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundConfigPacket; + +use crate::common::client_information::ClientInformation; + +#[derive(Clone, Debug, AzBuf, ServerboundConfigPacket, PartialEq, Eq)] +pub struct ServerboundClientInformation { + pub information: ClientInformation, +} diff --git a/azalea-protocol/src/packets/config/s_cookie_response.rs b/azalea-protocol/src/packets/config/s_cookie_response.rs new file mode 100644 index 00000000..e932352f --- /dev/null +++ b/azalea-protocol/src/packets/config/s_cookie_response.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 ServerboundCookieResponse { + pub key: ResourceLocation, + pub payload: Option>, +} diff --git a/azalea-protocol/src/packets/config/s_custom_payload.rs b/azalea-protocol/src/packets/config/s_custom_payload.rs new file mode 100644 index 00000000..f480985d --- /dev/null +++ b/azalea-protocol/src/packets/config/s_custom_payload.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_buf::UnsizedByteArray; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ServerboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ServerboundConfigPacket)] +pub struct ServerboundCustomPayload { + pub identifier: ResourceLocation, + pub data: UnsizedByteArray, +} diff --git a/azalea-protocol/src/packets/config/s_finish_configuration.rs b/azalea-protocol/src/packets/config/s_finish_configuration.rs new file mode 100644 index 00000000..a4d94fb1 --- /dev/null +++ b/azalea-protocol/src/packets/config/s_finish_configuration.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ServerboundConfigPacket)] +pub struct ServerboundFinishConfiguration {} diff --git a/azalea-protocol/src/packets/config/s_keep_alive.rs b/azalea-protocol/src/packets/config/s_keep_alive.rs new file mode 100644 index 00000000..1986a4eb --- /dev/null +++ b/azalea-protocol/src/packets/config/s_keep_alive.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ServerboundConfigPacket)] +pub struct ServerboundKeepAlive { + pub id: u64, +} diff --git a/azalea-protocol/src/packets/config/s_pong.rs b/azalea-protocol/src/packets/config/s_pong.rs new file mode 100644 index 00000000..50c012dd --- /dev/null +++ b/azalea-protocol/src/packets/config/s_pong.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ServerboundConfigPacket)] +pub struct ServerboundPong { + pub id: u32, +} diff --git a/azalea-protocol/src/packets/config/s_resource_pack.rs b/azalea-protocol/src/packets/config/s_resource_pack.rs new file mode 100644 index 00000000..0822c723 --- /dev/null +++ b/azalea-protocol/src/packets/config/s_resource_pack.rs @@ -0,0 +1,20 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundConfigPacket; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ServerboundConfigPacket)] +pub struct ServerboundResourcePack { + pub id: Uuid, + pub action: Action, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum Action { + SuccessfullyLoaded = 0, + Declined = 1, + FailedDownload = 2, + Accepted = 3, + InvalidUrl = 4, + FailedReload = 5, + Discarded = 6, +} diff --git a/azalea-protocol/src/packets/config/s_select_known_packs.rs b/azalea-protocol/src/packets/config/s_select_known_packs.rs new file mode 100644 index 00000000..320b5ca5 --- /dev/null +++ b/azalea-protocol/src/packets/config/s_select_known_packs.rs @@ -0,0 +1,14 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundConfigPacket; + +#[derive(Clone, Debug, AzBuf, ServerboundConfigPacket)] +pub struct ServerboundSelectKnownPacks { + pub known_packs: Vec, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct KnownPack { + pub namespace: String, + pub id: String, + pub version: String, +} diff --git a/azalea-protocol/src/packets/configuration/clientbound_cookie_request_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_cookie_request_packet.rs deleted file mode 100644 index 38566564..00000000 --- a/azalea-protocol/src/packets/configuration/clientbound_cookie_request_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] -pub struct ClientboundCookieRequestPacket { - pub key: ResourceLocation, -} diff --git a/azalea-protocol/src/packets/configuration/clientbound_custom_payload_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_custom_payload_packet.rs deleted file mode 100644 index 701a317c..00000000 --- a/azalea-protocol/src/packets/configuration/clientbound_custom_payload_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_buf::UnsizedByteArray; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] -pub struct ClientboundCustomPayloadPacket { - pub identifier: ResourceLocation, - pub data: UnsizedByteArray, -} diff --git a/azalea-protocol/src/packets/configuration/clientbound_disconnect_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_disconnect_packet.rs deleted file mode 100644 index cd0ed42a..00000000 --- a/azalea-protocol/src/packets/configuration/clientbound_disconnect_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] -pub struct ClientboundDisconnectPacket { - pub reason: FormattedText, -} diff --git a/azalea-protocol/src/packets/configuration/clientbound_finish_configuration_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_finish_configuration_packet.rs deleted file mode 100644 index 81251108..00000000 --- a/azalea-protocol/src/packets/configuration/clientbound_finish_configuration_packet.rs +++ /dev/null @@ -1,5 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] -pub struct ClientboundFinishConfigurationPacket {} diff --git a/azalea-protocol/src/packets/configuration/clientbound_keep_alive_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_keep_alive_packet.rs deleted file mode 100644 index 83c25610..00000000 --- a/azalea-protocol/src/packets/configuration/clientbound_keep_alive_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] -pub struct ClientboundKeepAlivePacket { - pub id: u64, -} diff --git a/azalea-protocol/src/packets/configuration/clientbound_ping_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_ping_packet.rs deleted file mode 100644 index 968dcaed..00000000 --- a/azalea-protocol/src/packets/configuration/clientbound_ping_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] -pub struct ClientboundPingPacket { - pub id: u32, -} diff --git a/azalea-protocol/src/packets/configuration/clientbound_registry_data_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_registry_data_packet.rs deleted file mode 100644 index 8bada6ca..00000000 --- a/azalea-protocol/src/packets/configuration/clientbound_registry_data_packet.rs +++ /dev/null @@ -1,12 +0,0 @@ -use std::collections::HashMap; - -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundConfigurationPacket; -use simdnbt::owned::NbtCompound; - -#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] -pub struct ClientboundRegistryDataPacket { - pub registry_id: ResourceLocation, - pub entries: HashMap>, -} diff --git a/azalea-protocol/src/packets/configuration/clientbound_reset_chat_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_reset_chat_packet.rs deleted file mode 100644 index 75afa8c1..00000000 --- a/azalea-protocol/src/packets/configuration/clientbound_reset_chat_packet.rs +++ /dev/null @@ -1,5 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] -pub struct ClientboundResetChatPacket; diff --git a/azalea-protocol/src/packets/configuration/clientbound_resource_pack_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_resource_pack_packet.rs deleted file mode 100644 index b05210b5..00000000 --- a/azalea-protocol/src/packets/configuration/clientbound_resource_pack_packet.rs +++ /dev/null @@ -1,11 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] -pub struct ClientboundResourcePackPacket { - pub url: String, - pub hash: String, - pub required: bool, - pub prompt: Option, -} diff --git a/azalea-protocol/src/packets/configuration/clientbound_resource_pack_pop_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_resource_pack_pop_packet.rs deleted file mode 100644 index 6533b589..00000000 --- a/azalea-protocol/src/packets/configuration/clientbound_resource_pack_pop_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundConfigurationPacket; -use uuid::Uuid; - -#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] -pub struct ClientboundResourcePackPopPacket { - pub id: Option, -} diff --git a/azalea-protocol/src/packets/configuration/clientbound_resource_pack_push_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_resource_pack_push_packet.rs deleted file mode 100644 index 798f5f98..00000000 --- a/azalea-protocol/src/packets/configuration/clientbound_resource_pack_push_packet.rs +++ /dev/null @@ -1,13 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundConfigurationPacket; -use uuid::Uuid; - -#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] -pub struct ClientboundResourcePackPushPacket { - pub id: Uuid, - pub url: String, - pub hash: String, - pub required: bool, - pub prompt: Option, -} diff --git a/azalea-protocol/src/packets/configuration/clientbound_select_known_packs_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_select_known_packs_packet.rs deleted file mode 100644 index 0f22b054..00000000 --- a/azalea-protocol/src/packets/configuration/clientbound_select_known_packs_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundConfigurationPacket; - -use super::serverbound_select_known_packs_packet::KnownPack; - -#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] -pub struct ClientboundSelectKnownPacksPacket { - pub known_packs: Vec, -} diff --git a/azalea-protocol/src/packets/configuration/clientbound_store_cookie_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_store_cookie_packet.rs deleted file mode 100644 index fda16689..00000000 --- a/azalea-protocol/src/packets/configuration/clientbound_store_cookie_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] -pub struct ClientboundStoreCookiePacket { - pub key: ResourceLocation, - pub payload: Vec, -} diff --git a/azalea-protocol/src/packets/configuration/clientbound_transfer_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_transfer_packet.rs deleted file mode 100644 index 88f0054a..00000000 --- a/azalea-protocol/src/packets/configuration/clientbound_transfer_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] -pub struct ClientboundTransferPacket { - pub host: String, - #[var] - pub port: u32, -} diff --git a/azalea-protocol/src/packets/configuration/clientbound_update_enabled_features_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_update_enabled_features_packet.rs deleted file mode 100644 index ec37c8f3..00000000 --- a/azalea-protocol/src/packets/configuration/clientbound_update_enabled_features_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] -pub struct ClientboundUpdateEnabledFeaturesPacket { - pub features: Vec, -} diff --git a/azalea-protocol/src/packets/configuration/clientbound_update_tags_packet.rs b/azalea-protocol/src/packets/configuration/clientbound_update_tags_packet.rs deleted file mode 100644 index 10f66e23..00000000 --- a/azalea-protocol/src/packets/configuration/clientbound_update_tags_packet.rs +++ /dev/null @@ -1,74 +0,0 @@ -use std::io::Cursor; -use std::ops::Deref; -use std::{collections::HashMap, io::Write}; - -use azalea_buf::{BufReadError, McBuf, McBufVarReadable, McBufVarWritable}; -use azalea_buf::{McBufReadable, McBufWritable}; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ClientboundConfigurationPacket)] -pub struct ClientboundUpdateTagsPacket { - pub tags: TagMap, -} - -#[derive(Clone, Debug)] -pub struct Tags { - pub name: ResourceLocation, - pub elements: Vec, -} - -#[derive(Clone, Debug)] -pub struct TagMap(pub HashMap>); - -impl McBufReadable for TagMap { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let length = u32::var_read_from(buf)? as usize; - let mut data = HashMap::with_capacity(length); - for _ in 0..length { - let tag_type = ResourceLocation::read_from(buf)?; - let tags_count = i32::var_read_from(buf)? as usize; - let mut tags_vec = Vec::with_capacity(tags_count); - for _ in 0..tags_count { - let tags = Tags::read_from(buf)?; - tags_vec.push(tags); - } - data.insert(tag_type, tags_vec); - } - Ok(TagMap(data)) - } -} - -impl McBufWritable for TagMap { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - (self.len() as u32).var_write_into(buf)?; - for (k, v) in &self.0 { - k.write_into(buf)?; - v.write_into(buf)?; - } - Ok(()) - } -} -impl McBufReadable for Tags { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let name = ResourceLocation::read_from(buf)?; - let elements = Vec::::var_read_from(buf)?; - Ok(Tags { name, elements }) - } -} - -impl McBufWritable for Tags { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - self.name.write_into(buf)?; - self.elements.var_write_into(buf)?; - Ok(()) - } -} - -impl Deref for TagMap { - type Target = HashMap>; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} diff --git a/azalea-protocol/src/packets/configuration/mod.rs b/azalea-protocol/src/packets/configuration/mod.rs deleted file mode 100755 index 757c496c..00000000 --- a/azalea-protocol/src/packets/configuration/mod.rs +++ /dev/null @@ -1,56 +0,0 @@ -pub mod clientbound_cookie_request_packet; -pub mod clientbound_custom_payload_packet; -pub mod clientbound_disconnect_packet; -pub mod clientbound_finish_configuration_packet; -pub mod clientbound_keep_alive_packet; -pub mod clientbound_ping_packet; -pub mod clientbound_registry_data_packet; -pub mod clientbound_reset_chat_packet; -pub mod clientbound_resource_pack_pop_packet; -pub mod clientbound_resource_pack_push_packet; -pub mod clientbound_select_known_packs_packet; -pub mod clientbound_store_cookie_packet; -pub mod clientbound_transfer_packet; -pub mod clientbound_update_enabled_features_packet; -pub mod clientbound_update_tags_packet; -pub mod serverbound_client_information_packet; -pub mod serverbound_cookie_response_packet; -pub mod serverbound_custom_payload_packet; -pub mod serverbound_finish_configuration_packet; -pub mod serverbound_keep_alive_packet; -pub mod serverbound_pong_packet; -pub mod serverbound_resource_pack_packet; -pub mod serverbound_select_known_packs_packet; - -use azalea_protocol_macros::declare_state_packets; - -declare_state_packets!( - ConfigurationPacket, - Serverbound => { - 0x00: serverbound_client_information_packet::ServerboundClientInformationPacket, - 0x01: serverbound_cookie_response_packet::ServerboundCookieResponsePacket, - 0x02: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket, - 0x03: serverbound_finish_configuration_packet::ServerboundFinishConfigurationPacket, - 0x04: serverbound_keep_alive_packet::ServerboundKeepAlivePacket, - 0x05: serverbound_pong_packet::ServerboundPongPacket, - 0x06: serverbound_resource_pack_packet::ServerboundResourcePackPacket, - 0x07: serverbound_select_known_packs_packet::ServerboundSelectKnownPacksPacket, - }, - Clientbound => { - 0x00: clientbound_cookie_request_packet::ClientboundCookieRequestPacket, - 0x01: clientbound_custom_payload_packet::ClientboundCustomPayloadPacket, - 0x02: clientbound_disconnect_packet::ClientboundDisconnectPacket, - 0x03: clientbound_finish_configuration_packet::ClientboundFinishConfigurationPacket, - 0x04: clientbound_keep_alive_packet::ClientboundKeepAlivePacket, - 0x05: clientbound_ping_packet::ClientboundPingPacket, - 0x06: clientbound_reset_chat_packet::ClientboundResetChatPacket, - 0x07: clientbound_registry_data_packet::ClientboundRegistryDataPacket, - 0x08: clientbound_resource_pack_pop_packet::ClientboundResourcePackPopPacket, - 0x09: clientbound_resource_pack_push_packet::ClientboundResourcePackPushPacket, - 0x0a: clientbound_store_cookie_packet::ClientboundStoreCookiePacket, - 0x0b: clientbound_transfer_packet::ClientboundTransferPacket, - 0x0c: clientbound_update_enabled_features_packet::ClientboundUpdateEnabledFeaturesPacket, - 0x0d: clientbound_update_tags_packet::ClientboundUpdateTagsPacket, - 0x0e: clientbound_select_known_packs_packet::ClientboundSelectKnownPacksPacket, - } -); diff --git a/azalea-protocol/src/packets/configuration/serverbound_client_information_packet.rs b/azalea-protocol/src/packets/configuration/serverbound_client_information_packet.rs deleted file mode 100644 index b5fd6a35..00000000 --- a/azalea-protocol/src/packets/configuration/serverbound_client_information_packet.rs +++ /dev/null @@ -1,193 +0,0 @@ -use azalea_buf::{McBuf, McBufReadable, McBufWritable}; -use azalea_core::bitset::FixedBitSet; -use azalea_protocol_macros::ServerboundConfigurationPacket; -use bevy_ecs::component::Component; - -#[derive(Clone, Debug, McBuf, ServerboundConfigurationPacket, PartialEq, Eq)] -pub struct ServerboundClientInformationPacket { - pub information: ClientInformation, -} - -/// A component that contains some of the "settings" for this client that are -/// sent to the server, such as render distance. This is only present on local -/// players. -#[derive(Clone, Debug, McBuf, PartialEq, Eq, Component)] -pub struct ClientInformation { - /// The locale of the client. - pub language: String, - /// The view distance of the client in chunks, same as the render distance - /// in-game. - pub view_distance: u8, - /// The types of chat messages the client wants to receive. Note that many - /// servers ignore this. - pub chat_visibility: ChatVisibility, - /// Whether the messages sent from the server should have colors. Note that - /// many servers ignore this and always send colored messages. - pub chat_colors: bool, - pub model_customization: ModelCustomization, - pub main_hand: HumanoidArm, - pub text_filtering_enabled: bool, - /// Whether the client should show up as "Anonymous Player" in the server - /// list. - pub allows_listing: bool, - pub particle_status: ParticleStatus, -} - -impl Default for ClientInformation { - fn default() -> Self { - Self { - language: "en_us".to_string(), - view_distance: 8, - chat_visibility: ChatVisibility::default(), - chat_colors: true, - model_customization: ModelCustomization::default(), - main_hand: HumanoidArm::Right, - text_filtering_enabled: false, - allows_listing: false, - particle_status: ParticleStatus::default(), - } - } -} - -#[derive(McBuf, Clone, Copy, Debug, PartialEq, Eq, Default)] -pub enum ChatVisibility { - /// All chat messages should be sent to the client. - #[default] - Full = 0, - /// Chat messages from other players should be not sent to the client, only - /// messages from the server like "Player joined the game" should be sent. - System = 1, - /// No chat messages should be sent to the client. - Hidden = 2, -} - -#[derive(McBuf, Clone, Copy, Debug, PartialEq, Eq, Default)] -pub enum HumanoidArm { - Left = 0, - #[default] - Right = 1, -} - -#[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub struct ModelCustomization { - pub cape: bool, - pub jacket: bool, - pub left_sleeve: bool, - pub right_sleeve: bool, - pub left_pants: bool, - pub right_pants: bool, - pub hat: bool, -} - -#[derive(McBuf, Clone, Copy, Debug, PartialEq, Eq, Default)] -pub enum ParticleStatus { - #[default] - All, - Decreased, - Minimal, -} - -impl Default for ModelCustomization { - fn default() -> Self { - Self { - cape: true, - jacket: true, - left_sleeve: true, - right_sleeve: true, - left_pants: true, - right_pants: true, - hat: true, - } - } -} - -impl McBufReadable for ModelCustomization { - fn read_from(buf: &mut std::io::Cursor<&[u8]>) -> Result { - let set = FixedBitSet::<7>::read_from(buf)?; - Ok(Self { - cape: set.index(0), - jacket: set.index(1), - left_sleeve: set.index(2), - right_sleeve: set.index(3), - left_pants: set.index(4), - right_pants: set.index(5), - hat: set.index(6), - }) - } -} - -impl McBufWritable for ModelCustomization { - fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { - let mut set = FixedBitSet::<7>::new(); - if self.cape { - set.set(0); - } - if self.jacket { - set.set(1); - } - if self.left_sleeve { - set.set(2); - } - if self.right_sleeve { - set.set(3); - } - if self.left_pants { - set.set(4); - } - if self.right_pants { - set.set(5); - } - if self.hat { - set.set(6); - } - set.write_into(buf) - } -} - -#[cfg(test)] -mod tests { - use std::io::Cursor; - - use super::*; - - #[test] - fn test_client_information_packet() { - { - let data = ClientInformation::default(); - let mut buf = Vec::new(); - data.write_into(&mut buf).unwrap(); - let mut data_cursor: Cursor<&[u8]> = Cursor::new(&buf); - - let read_data = ClientInformation::read_from(&mut data_cursor).unwrap(); - assert_eq!(read_data, data); - } - - { - let data = ClientInformation { - language: "en_gb".to_string(), - view_distance: 24, - chat_visibility: ChatVisibility::Hidden, - chat_colors: false, - model_customization: ModelCustomization { - cape: false, - jacket: false, - left_sleeve: true, - right_sleeve: false, - left_pants: true, - right_pants: false, - hat: true, - }, - main_hand: HumanoidArm::Left, - text_filtering_enabled: true, - allows_listing: true, - particle_status: ParticleStatus::Decreased, - }; - let mut buf = Vec::new(); - data.write_into(&mut buf).unwrap(); - let mut data_cursor: Cursor<&[u8]> = Cursor::new(&buf); - - let read_data = ClientInformation::read_from(&mut data_cursor).unwrap(); - assert_eq!(read_data, data); - } - } -} diff --git a/azalea-protocol/src/packets/configuration/serverbound_cookie_response_packet.rs b/azalea-protocol/src/packets/configuration/serverbound_cookie_response_packet.rs deleted file mode 100644 index 6c62c1c8..00000000 --- a/azalea-protocol/src/packets/configuration/serverbound_cookie_response_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ServerboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ServerboundConfigurationPacket)] -pub struct ServerboundCookieResponsePacket { - pub key: ResourceLocation, - pub payload: Option>, -} diff --git a/azalea-protocol/src/packets/configuration/serverbound_custom_payload_packet.rs b/azalea-protocol/src/packets/configuration/serverbound_custom_payload_packet.rs deleted file mode 100644 index 48c977b1..00000000 --- a/azalea-protocol/src/packets/configuration/serverbound_custom_payload_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_buf::UnsizedByteArray; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ServerboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ServerboundConfigurationPacket)] -pub struct ServerboundCustomPayloadPacket { - pub identifier: ResourceLocation, - pub data: UnsizedByteArray, -} diff --git a/azalea-protocol/src/packets/configuration/serverbound_finish_configuration_packet.rs b/azalea-protocol/src/packets/configuration/serverbound_finish_configuration_packet.rs deleted file mode 100644 index 53e04182..00000000 --- a/azalea-protocol/src/packets/configuration/serverbound_finish_configuration_packet.rs +++ /dev/null @@ -1,5 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ServerboundConfigurationPacket)] -pub struct ServerboundFinishConfigurationPacket {} diff --git a/azalea-protocol/src/packets/configuration/serverbound_keep_alive_packet.rs b/azalea-protocol/src/packets/configuration/serverbound_keep_alive_packet.rs deleted file mode 100644 index 4604df46..00000000 --- a/azalea-protocol/src/packets/configuration/serverbound_keep_alive_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ServerboundConfigurationPacket)] -pub struct ServerboundKeepAlivePacket { - pub id: u64, -} diff --git a/azalea-protocol/src/packets/configuration/serverbound_pong_packet.rs b/azalea-protocol/src/packets/configuration/serverbound_pong_packet.rs deleted file mode 100644 index 153e3fea..00000000 --- a/azalea-protocol/src/packets/configuration/serverbound_pong_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ServerboundConfigurationPacket)] -pub struct ServerboundPongPacket { - pub id: u32, -} diff --git a/azalea-protocol/src/packets/configuration/serverbound_resource_pack_packet.rs b/azalea-protocol/src/packets/configuration/serverbound_resource_pack_packet.rs deleted file mode 100644 index 6f35525e..00000000 --- a/azalea-protocol/src/packets/configuration/serverbound_resource_pack_packet.rs +++ /dev/null @@ -1,20 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundConfigurationPacket; -use uuid::Uuid; - -#[derive(Clone, Debug, McBuf, ServerboundConfigurationPacket)] -pub struct ServerboundResourcePackPacket { - pub id: Uuid, - pub action: Action, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum Action { - SuccessfullyLoaded = 0, - Declined = 1, - FailedDownload = 2, - Accepted = 3, - InvalidUrl = 4, - FailedReload = 5, - Discarded = 6, -} diff --git a/azalea-protocol/src/packets/configuration/serverbound_select_known_packs_packet.rs b/azalea-protocol/src/packets/configuration/serverbound_select_known_packs_packet.rs deleted file mode 100644 index fe379a17..00000000 --- a/azalea-protocol/src/packets/configuration/serverbound_select_known_packs_packet.rs +++ /dev/null @@ -1,14 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundConfigurationPacket; - -#[derive(Clone, Debug, McBuf, ServerboundConfigurationPacket)] -pub struct ServerboundSelectKnownPacksPacket { - pub known_packs: Vec, -} - -#[derive(Clone, Debug, McBuf)] -pub struct KnownPack { - pub namespace: String, - pub id: String, - pub version: String, -} diff --git a/azalea-protocol/src/packets/game/c_add_entity.rs b/azalea-protocol/src/packets/game/c_add_entity.rs new file mode 100755 index 00000000..cf0adeb7 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_add_entity.rs @@ -0,0 +1,37 @@ +use azalea_buf::AzBuf; +use azalea_core::{position::Vec3, resource_location::ResourceLocation}; +use azalea_entity::{metadata::apply_default_metadata, EntityBundle}; +use azalea_protocol_macros::ClientboundGamePacket; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundAddEntity { + /// The id of the entity. + #[var] + pub id: u32, + pub uuid: Uuid, + pub entity_type: azalea_registry::EntityKind, + pub position: Vec3, + pub x_rot: i8, + pub y_rot: i8, + pub y_head_rot: i8, + #[var] + pub data: u32, + pub x_vel: i16, + pub y_vel: i16, + pub z_vel: i16, +} + +impl ClientboundAddEntity { + /// Make the entity into a bundle that can be inserted into the ECS. You + /// must apply the metadata after inserting the bundle with + /// [`Self::apply_metadata`]. + pub fn as_entity_bundle(&self, world_name: ResourceLocation) -> EntityBundle { + EntityBundle::new(self.uuid, self.position, self.entity_type, world_name) + } + + /// Apply the default metadata for the given entity. + pub fn apply_metadata(&self, entity: &mut bevy_ecs::system::EntityCommands) { + apply_default_metadata(entity, self.entity_type); + } +} diff --git a/azalea-protocol/src/packets/game/c_add_experience_orb.rs b/azalea-protocol/src/packets/game/c_add_experience_orb.rs new file mode 100755 index 00000000..b3d12858 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_add_experience_orb.rs @@ -0,0 +1,12 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundAddExperienceOrb { + #[var] + pub id: u32, + pub x: f64, + pub y: f64, + pub z: f64, + pub value: u16, +} diff --git a/azalea-protocol/src/packets/game/c_add_player.rs b/azalea-protocol/src/packets/game/c_add_player.rs new file mode 100755 index 00000000..7b36567d --- /dev/null +++ b/azalea-protocol/src/packets/game/c_add_player.rs @@ -0,0 +1,27 @@ +use azalea_buf::AzBuf; +use azalea_core::{ResourceLocation, Vec3}; +use azalea_entity::{metadata::PlayerMetadataBundle, EntityBundle, PlayerBundle}; +use azalea_protocol_macros::ClientboundGamePacket; +use azalea_registry::EntityKind; +use uuid::Uuid; + +/// This packet is sent by the server when a player comes into visible range, +/// not when a player joins. +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundAddPlayer { + #[var] + pub id: u32, + pub uuid: Uuid, + pub position: Vec3, + pub x_rot: i8, + pub y_rot: i8, +} + +impl ClientboundAddPlayer { + pub fn as_player_bundle(&self, world_name: ResourceLocation) -> PlayerBundle { + PlayerBundle { + entity: EntityBundle::new(self.uuid, self.position, EntityKind::Player, world_name), + metadata: PlayerMetadataBundle::default(), + } + } +} diff --git a/azalea-protocol/src/packets/game/c_animate.rs b/azalea-protocol/src/packets/game/c_animate.rs new file mode 100755 index 00000000..bda0b152 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_animate.rs @@ -0,0 +1,21 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundAnimate { + #[var] + pub id: u32, + pub action: AnimationAction, +} + +// minecraft actually uses a u8 for this, but a varint still works and makes it +// so i don't have to add a special handler +#[derive(Clone, Debug, Copy, AzBuf)] +pub enum AnimationAction { + SwingMainHand = 0, + Hurt = 1, + WakeUp = 2, + SwingOffHand = 3, + CriticalHit = 4, + MagicCriticalHit = 5, +} diff --git a/azalea-protocol/src/packets/game/c_award_stats.rs b/azalea-protocol/src/packets/game/c_award_stats.rs new file mode 100755 index 00000000..20f8b1e0 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_award_stats.rs @@ -0,0 +1,23 @@ +use std::collections::HashMap; + +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundAwardStats { + #[var] + pub stats: HashMap, +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, AzBuf)] +pub enum Stat { + Mined(azalea_registry::Block), + Crafted(azalea_registry::Item), + Used(azalea_registry::Item), + Broken(azalea_registry::Item), + PickedUp(azalea_registry::Item), + Dropped(azalea_registry::Item), + Killed(azalea_registry::EntityKind), + KilledBy(azalea_registry::EntityKind), + Custom(azalea_registry::CustomStat), +} diff --git a/azalea-protocol/src/packets/game/c_block_changed_ack.rs b/azalea-protocol/src/packets/game/c_block_changed_ack.rs new file mode 100755 index 00000000..ebb303c0 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_block_changed_ack.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundBlockChangedAck { + #[var] + pub sequence: i32, +} diff --git a/azalea-protocol/src/packets/game/c_block_destruction.rs b/azalea-protocol/src/packets/game/c_block_destruction.rs new file mode 100755 index 00000000..50d8085b --- /dev/null +++ b/azalea-protocol/src/packets/game/c_block_destruction.rs @@ -0,0 +1,13 @@ +use azalea_buf::AzBuf; +use azalea_core::position::BlockPos; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundBlockDestruction { + /// The ID of the entity breaking the block. + #[var] + pub id: u32, + pub pos: BlockPos, + /// 0–9 to set it, any other value to remove it. + pub progress: u8, +} diff --git a/azalea-protocol/src/packets/game/c_block_entity_data.rs b/azalea-protocol/src/packets/game/c_block_entity_data.rs new file mode 100755 index 00000000..82ba60de --- /dev/null +++ b/azalea-protocol/src/packets/game/c_block_entity_data.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_core::position::BlockPos; +use azalea_protocol_macros::ClientboundGamePacket; +use simdnbt::owned::Nbt; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundBlockEntityData { + pub pos: BlockPos, + pub block_entity_type: azalea_registry::BlockEntityKind, + pub tag: Nbt, +} diff --git a/azalea-protocol/src/packets/game/c_block_event.rs b/azalea-protocol/src/packets/game/c_block_event.rs new file mode 100755 index 00000000..3a71b186 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_block_event.rs @@ -0,0 +1,12 @@ +use azalea_buf::AzBuf; +use azalea_core::position::BlockPos; +use azalea_protocol_macros::ClientboundGamePacket; +use azalea_registry::Block; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundBlockEvent { + pub pos: BlockPos, + pub action_id: u8, + pub action_parameter: u8, + pub block: Block, +} diff --git a/azalea-protocol/src/packets/game/c_block_update.rs b/azalea-protocol/src/packets/game/c_block_update.rs new file mode 100755 index 00000000..ae9bd998 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_block_update.rs @@ -0,0 +1,10 @@ +use azalea_block::BlockState; +use azalea_buf::AzBuf; +use azalea_core::position::BlockPos; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundBlockUpdate { + pub pos: BlockPos, + pub block_state: BlockState, +} diff --git a/azalea-protocol/src/packets/game/c_boss_event.rs b/azalea-protocol/src/packets/game/c_boss_event.rs new file mode 100755 index 00000000..e54ab59f --- /dev/null +++ b/azalea-protocol/src/packets/game/c_boss_event.rs @@ -0,0 +1,143 @@ +use std::io::Cursor; +use std::io::Write; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; +use azalea_chat::FormattedText; +use azalea_core::bitset::FixedBitSet; +use azalea_protocol_macros::ClientboundGamePacket; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundBossEvent { + pub id: Uuid, + pub operation: Operation, +} + +#[derive(Clone, Debug)] +pub enum Operation { + Add(AddOperation), + Remove, + UpdateProgress(f32), + UpdateName(FormattedText), + UpdateStyle(Style), + UpdateProperties(Properties), +} + +impl AzaleaRead for Operation { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let operation_id = u32::azalea_read_var(buf)?; + Ok(match operation_id { + 0 => Operation::Add(AddOperation::azalea_read(buf)?), + 1 => Operation::Remove, + 2 => Operation::UpdateProgress(f32::azalea_read(buf)?), + 3 => Operation::UpdateName(FormattedText::azalea_read(buf)?), + 4 => Operation::UpdateStyle(Style::azalea_read(buf)?), + 5 => Operation::UpdateProperties(Properties::azalea_read(buf)?), + _ => { + return Err(BufReadError::UnexpectedEnumVariant { + id: operation_id as i32, + }) + } + }) + } +} + +impl AzaleaWrite for Operation { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + match self { + Operation::Add(add) => { + 0u32.azalea_write_var(buf)?; + add.azalea_write(buf)?; + } + Operation::Remove => { + 1u32.azalea_write_var(buf)?; + } + Operation::UpdateProgress(progress) => { + 2u32.azalea_write_var(buf)?; + progress.azalea_write(buf)?; + } + Operation::UpdateName(name) => { + 3u32.azalea_write_var(buf)?; + name.azalea_write(buf)?; + } + Operation::UpdateStyle(style) => { + 4u32.azalea_write_var(buf)?; + style.azalea_write(buf)?; + } + Operation::UpdateProperties(properties) => { + 5u32.azalea_write_var(buf)?; + properties.azalea_write(buf)?; + } + } + Ok(()) + } +} + +#[derive(Clone, Debug, AzBuf)] +pub struct AddOperation { + pub name: FormattedText, + pub progress: f32, + pub style: Style, + pub properties: Properties, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct Style { + pub color: BossBarColor, + pub overlay: BossBarOverlay, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum BossBarColor { + Pink = 0, + Blue = 1, + Red = 2, + Green = 3, + Yellow = 4, + Purple = 5, + White = 6, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum BossBarOverlay { + Progress = 0, + Notched6 = 1, + Notched10 = 2, + Notched12 = 3, + Notched20 = 4, +} + +#[derive(Clone, Debug)] +pub struct Properties { + pub darken_screen: bool, + pub play_music: bool, + pub create_world_fog: bool, +} + +impl AzaleaRead for Properties { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let set = FixedBitSet::<3>::azalea_read(buf)?; + Ok(Self { + darken_screen: set.index(0), + play_music: set.index(1), + create_world_fog: set.index(2), + }) + } +} + +impl AzaleaWrite for Properties { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let mut set = FixedBitSet::<3>::new(); + if self.darken_screen { + set.set(0); + } + if self.play_music { + set.set(1); + } + if self.create_world_fog { + set.set(2); + } + set.azalea_write(buf)?; + Ok(()) + } +} diff --git a/azalea-protocol/src/packets/game/c_bundle_delimiter.rs b/azalea-protocol/src/packets/game/c_bundle_delimiter.rs new file mode 100644 index 00000000..cda33d1b --- /dev/null +++ b/azalea-protocol/src/packets/game/c_bundle_delimiter.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundBundleDelimiter; diff --git a/azalea-protocol/src/packets/game/c_change_difficulty.rs b/azalea-protocol/src/packets/game/c_change_difficulty.rs new file mode 100755 index 00000000..cdcc4792 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_change_difficulty.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_core::difficulty::Difficulty; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundChangeDifficulty { + pub difficulty: Difficulty, + pub locked: bool, +} diff --git a/azalea-protocol/src/packets/game/c_chat_preview.rs b/azalea-protocol/src/packets/game/c_chat_preview.rs new file mode 100755 index 00000000..e0ddd2ec --- /dev/null +++ b/azalea-protocol/src/packets/game/c_chat_preview.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundChatPreview { + pub query_id: i32, + pub preview: Option, +} diff --git a/azalea-protocol/src/packets/game/c_chunk_batch_finished.rs b/azalea-protocol/src/packets/game/c_chunk_batch_finished.rs new file mode 100644 index 00000000..c419888b --- /dev/null +++ b/azalea-protocol/src/packets/game/c_chunk_batch_finished.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundChunkBatchFinished { + #[var] + pub batch_size: u32, +} diff --git a/azalea-protocol/src/packets/game/c_chunk_batch_start.rs b/azalea-protocol/src/packets/game/c_chunk_batch_start.rs new file mode 100644 index 00000000..8b0555dc --- /dev/null +++ b/azalea-protocol/src/packets/game/c_chunk_batch_start.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundChunkBatchStart {} diff --git a/azalea-protocol/src/packets/game/c_chunks_biomes.rs b/azalea-protocol/src/packets/game/c_chunks_biomes.rs new file mode 100644 index 00000000..a8e65af4 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_chunks_biomes.rs @@ -0,0 +1,14 @@ +use azalea_buf::AzBuf; +use azalea_core::position::ChunkPos; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundChunksBiomes { + pub chunk_biome_data: Vec, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct ChunkBiomeData { + pub pos: ChunkPos, + pub buffer: Vec, +} diff --git a/azalea-protocol/src/packets/game/c_clear_titles.rs b/azalea-protocol/src/packets/game/c_clear_titles.rs new file mode 100644 index 00000000..58b67bad --- /dev/null +++ b/azalea-protocol/src/packets/game/c_clear_titles.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundClearTitles { + pub reset_times: bool, +} diff --git a/azalea-protocol/src/packets/game/c_command_suggestions.rs b/azalea-protocol/src/packets/game/c_command_suggestions.rs new file mode 100755 index 00000000..37679a72 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_command_suggestions.rs @@ -0,0 +1,37 @@ +use azalea_brigadier::suggestion::Suggestions; +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundCommandSuggestions { + #[var] + pub id: u32, + pub suggestions: Suggestions, +} + +#[cfg(test)] +mod tests { + use std::io::Cursor; + + use azalea_brigadier::{context::StringRange, suggestion::Suggestion}; + use azalea_buf::{AzaleaRead, AzaleaWrite}; + + use super::*; + + #[test] + fn test_suggestions() { + let suggestions = Suggestions::new( + StringRange::new(0, 5), + vec![Suggestion::new_with_tooltip( + StringRange::new(1, 4), + "foo", + "bar".to_string(), + )], + ); + let mut buf = Vec::new(); + suggestions.azalea_write(&mut buf).unwrap(); + let mut cursor = Cursor::new(&buf[..]); + let suggestions = Suggestions::azalea_read(&mut cursor).unwrap(); + assert_eq!(suggestions, suggestions); + } +} diff --git a/azalea-protocol/src/packets/game/c_commands.rs b/azalea-protocol/src/packets/game/c_commands.rs new file mode 100755 index 00000000..1a231559 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_commands.rs @@ -0,0 +1,378 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; +use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation}; +use azalea_protocol_macros::ClientboundGamePacket; +use tracing::warn; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundCommands { + pub entries: Vec, + #[var] + pub root_index: u32, +} + +#[derive(Debug, Clone, PartialEq)] +pub struct BrigadierNodeStub { + pub is_executable: bool, + pub children: Vec, + pub redirect_node: Option, + pub node_type: NodeType, +} + +#[derive(Debug, Clone, Eq)] +pub struct BrigadierNumber { + pub min: Option, + pub max: Option, +} +impl BrigadierNumber { + pub fn new(min: Option, max: Option) -> BrigadierNumber { + BrigadierNumber { min, max } + } +} +impl PartialEq for BrigadierNumber { + fn eq(&self, other: &Self) -> bool { + match (&self.min, &self.max, &other.min, &other.max) { + (Some(f_min), None, Some(s_min), None) => f_min == s_min, + (None, Some(f_max), None, Some(s_max)) => f_max == s_max, + (Some(f_min), Some(f_max), Some(s_min), Some(s_max)) => { + f_min == s_min && f_max == s_max + } + (None, None, None, None) => true, + _ => false, + } + } +} + +impl AzaleaRead for BrigadierNumber { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let flags = FixedBitSet::<2>::azalea_read(buf)?; + let min = if flags.index(0) { + Some(T::azalea_read(buf)?) + } else { + None + }; + let max = if flags.index(1) { + Some(T::azalea_read(buf)?) + } else { + None + }; + Ok(BrigadierNumber { min, max }) + } +} +impl AzaleaWrite for BrigadierNumber { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let mut flags = FixedBitSet::<2>::new(); + if self.min.is_some() { + flags.set(0); + } + if self.max.is_some() { + flags.set(1); + } + flags.azalea_write(buf)?; + if let Some(min) = &self.min { + min.azalea_write(buf)?; + } + if let Some(max) = &self.max { + max.azalea_write(buf)?; + } + Ok(()) + } +} + +#[derive(Debug, Clone, Copy, AzBuf, PartialEq, Eq)] +pub enum BrigadierString { + /// Reads a single word + SingleWord = 0, + // If it starts with a ", keeps reading until another " (allowing escaping with \). Otherwise + // behaves the same as SINGLE_WORD + QuotablePhrase = 1, + // Reads the rest of the content after the cursor. Quotes will not be removed. + GreedyPhrase = 2, +} + +#[derive(Debug, Clone, AzBuf, PartialEq)] +pub enum BrigadierParser { + Bool, + Float(BrigadierNumber), + Double(BrigadierNumber), + Integer(BrigadierNumber), + Long(BrigadierNumber), + String(BrigadierString), + Entity(EntityParser), + GameProfile, + BlockPos, + ColumnPos, + Vec3, + Vec2, + BlockState, + BlockPredicate, + ItemStack, + ItemPredicate, + Color, + FormattedText, + Style, + Message, + NbtCompoundTag, + NbtTag, + NbtPath, + Objective, + ObjectiveCriteria, + Operation, + Particle, + Angle, + Rotation, + ScoreboardSlot, + ScoreHolder { allows_multiple: bool }, + Swizzle, + Team, + ItemSlot, + ItemSlots, + ResourceLocation, + Function, + EntityAnchor, + IntRange, + FloatRange, + Dimension, + GameMode, + Time { min: i32 }, + ResourceOrTag { registry_key: ResourceLocation }, + ResourceOrTagKey { registry_key: ResourceLocation }, + Resource { registry_key: ResourceLocation }, + ResourceKey { registry_key: ResourceLocation }, + TemplateMirror, + TemplateRotation, + Heightmap, + LootTable, + LootPredicate, + LootModifier, + Uuid, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct EntityParser { + pub single: bool, + pub players_only: bool, +} +impl AzaleaRead for EntityParser { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let flags = FixedBitSet::<2>::azalea_read(buf)?; + Ok(EntityParser { + single: flags.index(0), + players_only: flags.index(1), + }) + } +} +impl AzaleaWrite for EntityParser { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let mut flags = FixedBitSet::<2>::new(); + if self.single { + flags.set(0); + } + if self.players_only { + flags.set(1); + } + flags.azalea_write(buf)?; + Ok(()) + } +} + +// TODO: BrigadierNodeStub should have more stuff +impl AzaleaRead for BrigadierNodeStub { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let flags = FixedBitSet::<8>::azalea_read(buf)?; + if flags.index(5) || flags.index(6) || flags.index(7) { + warn!("Warning: The flags from a Brigadier node are over 31. This is probably a bug.",); + } + + let node_type = u8::from(flags.index(0)) + (u8::from(flags.index(1)) * 2); + let is_executable = flags.index(2); + let has_redirect = flags.index(3); + let has_suggestions_type = flags.index(4); + + let children = Vec::::azalea_read_var(buf)?; + let redirect_node = if has_redirect { + Some(u32::azalea_read_var(buf)?) + } else { + None + }; + + // argument node + if node_type == 2 { + let name = String::azalea_read(buf)?; + let parser = BrigadierParser::azalea_read(buf)?; + let suggestions_type = if has_suggestions_type { + Some(ResourceLocation::azalea_read(buf)?) + } else { + None + }; + let node = BrigadierNodeStub { + is_executable, + children, + redirect_node, + node_type: NodeType::Argument { + name, + parser, + suggestions_type, + }, + }; + return Ok(node); + } + // literal node + else if node_type == 1 { + let name = String::azalea_read(buf)?; + return Ok(BrigadierNodeStub { + is_executable, + children, + redirect_node, + node_type: NodeType::Literal { name }, + }); + } + Ok(BrigadierNodeStub { + is_executable, + children, + redirect_node, + node_type: NodeType::Root, + }) + } +} + +impl AzaleaWrite for BrigadierNodeStub { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let mut flags = FixedBitSet::<4>::new(); + if self.is_executable { + flags.set(2); + } + if self.redirect_node.is_some() { + flags.set(3); + } + + match &self.node_type { + NodeType::Root => { + flags.azalea_write(buf)?; + + self.children.azalea_write_var(buf)?; + + if let Some(redirect) = self.redirect_node { + redirect.azalea_write_var(buf)?; + } + } + NodeType::Literal { name } => { + flags.set(0); + flags.azalea_write(buf)?; + + self.children.azalea_write_var(buf)?; + + if let Some(redirect) = self.redirect_node { + redirect.azalea_write_var(buf)?; + } + + name.azalea_write(buf)?; + } + NodeType::Argument { + name, + parser, + suggestions_type, + } => { + flags.set(1); + if suggestions_type.is_some() { + flags.set(4); + } + flags.azalea_write(buf)?; + + self.children.azalea_write_var(buf)?; + + if let Some(redirect) = self.redirect_node { + redirect.azalea_write_var(buf)?; + } + + name.azalea_write(buf)?; + parser.azalea_write(buf)?; + + if let Some(suggestion) = suggestions_type { + suggestion.azalea_write(buf)?; + } + } + } + Ok(()) + } +} + +#[derive(Debug, Clone, PartialEq)] +pub enum NodeType { + Root, + Literal { + name: String, + }, + Argument { + name: String, + parser: BrigadierParser, + suggestions_type: Option, + }, +} + +impl BrigadierNodeStub { + #[must_use] + pub fn name(&self) -> Option<&str> { + match &self.node_type { + NodeType::Root => None, + NodeType::Literal { name } | NodeType::Argument { name, .. } => Some(name), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_brigadier_node_stub_root() { + let data = BrigadierNodeStub { + is_executable: false, + children: vec![1, 2], + redirect_node: None, + node_type: NodeType::Root, + }; + let mut buf = Vec::new(); + data.azalea_write(&mut buf).unwrap(); + let mut data_cursor: Cursor<&[u8]> = Cursor::new(&buf); + let read_data = BrigadierNodeStub::azalea_read(&mut data_cursor).unwrap(); + assert_eq!(data, read_data); + } + + #[test] + fn test_brigadier_node_stub_literal() { + let data = BrigadierNodeStub { + is_executable: true, + children: vec![], + redirect_node: None, + node_type: NodeType::Literal { + name: "String".to_string(), + }, + }; + let mut buf = Vec::new(); + data.azalea_write(&mut buf).unwrap(); + let mut data_cursor: Cursor<&[u8]> = Cursor::new(&buf); + let read_data = BrigadierNodeStub::azalea_read(&mut data_cursor).unwrap(); + assert_eq!(data, read_data); + } + + #[test] + fn test_brigadier_node_stub_argument() { + let data = BrigadierNodeStub { + is_executable: false, + children: vec![6, 9], + redirect_node: Some(5), + node_type: NodeType::Argument { + name: "position".to_string(), + parser: BrigadierParser::Vec3, + suggestions_type: Some(ResourceLocation::new("minecraft:test_suggestion")), + }, + }; + let mut buf = Vec::new(); + data.azalea_write(&mut buf).unwrap(); + let mut data_cursor: Cursor<&[u8]> = Cursor::new(&buf); + let read_data = BrigadierNodeStub::azalea_read(&mut data_cursor).unwrap(); + assert_eq!(data, read_data); + } +} diff --git a/azalea-protocol/src/packets/game/c_container_close.rs b/azalea-protocol/src/packets/game/c_container_close.rs new file mode 100644 index 00000000..dda6153b --- /dev/null +++ b/azalea-protocol/src/packets/game/c_container_close.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundContainerClose { + pub container_id: u8, +} diff --git a/azalea-protocol/src/packets/game/c_container_set_content.rs b/azalea-protocol/src/packets/game/c_container_set_content.rs new file mode 100755 index 00000000..852ce60f --- /dev/null +++ b/azalea-protocol/src/packets/game/c_container_set_content.rs @@ -0,0 +1,12 @@ +use azalea_buf::AzBuf; +use azalea_inventory::ItemStack; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundContainerSetContent { + pub container_id: i8, + #[var] + pub state_id: u32, + pub items: Vec, + pub carried_item: ItemStack, +} diff --git a/azalea-protocol/src/packets/game/c_container_set_data.rs b/azalea-protocol/src/packets/game/c_container_set_data.rs new file mode 100755 index 00000000..3815f5c5 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_container_set_data.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundContainerSetData { + pub container_id: i8, + pub id: u16, + pub value: u16, +} diff --git a/azalea-protocol/src/packets/game/c_container_set_slot.rs b/azalea-protocol/src/packets/game/c_container_set_slot.rs new file mode 100755 index 00000000..5e3476d9 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_container_set_slot.rs @@ -0,0 +1,12 @@ +use azalea_buf::AzBuf; +use azalea_inventory::ItemStack; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundContainerSetSlot { + pub container_id: i8, + #[var] + pub state_id: u32, + pub slot: u16, + pub item_stack: ItemStack, +} diff --git a/azalea-protocol/src/packets/game/c_cookie_request.rs b/azalea-protocol/src/packets/game/c_cookie_request.rs new file mode 100755 index 00000000..330b7334 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_cookie_request.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundCookieRequest { + pub key: ResourceLocation, +} diff --git a/azalea-protocol/src/packets/game/c_cooldown.rs b/azalea-protocol/src/packets/game/c_cooldown.rs new file mode 100755 index 00000000..016101b7 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_cooldown.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundCooldown { + pub item: azalea_registry::Item, + #[var] + pub duration: u32, +} diff --git a/azalea-protocol/src/packets/game/c_custom_chat_completions.rs b/azalea-protocol/src/packets/game/c_custom_chat_completions.rs new file mode 100755 index 00000000..87c27b7a --- /dev/null +++ b/azalea-protocol/src/packets/game/c_custom_chat_completions.rs @@ -0,0 +1,15 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundCustomChatCompletions { + pub action: Action, + pub entries: Vec, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum Action { + Add = 0, + Remove = 1, + Set = 2, +} diff --git a/azalea-protocol/src/packets/game/c_custom_payload.rs b/azalea-protocol/src/packets/game/c_custom_payload.rs new file mode 100755 index 00000000..0610d63e --- /dev/null +++ b/azalea-protocol/src/packets/game/c_custom_payload.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_buf::UnsizedByteArray; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundCustomPayload { + pub identifier: ResourceLocation, + pub data: UnsizedByteArray, +} diff --git a/azalea-protocol/src/packets/game/c_custom_report_details.rs b/azalea-protocol/src/packets/game/c_custom_report_details.rs new file mode 100644 index 00000000..85eccfb7 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_custom_report_details.rs @@ -0,0 +1,14 @@ +use std::collections::HashMap; + +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundCustomReportDetails { + // azalea doesn't implement max lengths yet + + // max length = 32 + // key string is limited to 128 bytes + // value string is limited to 4096 bytes + pub details: HashMap, +} diff --git a/azalea-protocol/src/packets/game/c_custom_sound.rs b/azalea-protocol/src/packets/game/c_custom_sound.rs new file mode 100644 index 00000000..7daadb3a --- /dev/null +++ b/azalea-protocol/src/packets/game/c_custom_sound.rs @@ -0,0 +1,28 @@ +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundCustomSound { + pub name: ResourceLocation, + pub source: SoundSource, + pub x: i32, + pub y: i32, + pub z: i32, + pub volume: f32, + pub pitch: f32, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum SoundSource { + Master = 0, + Music = 1, + Records = 2, + Weather = 3, + Blocks = 4, + Hostile = 5, + Neutral = 6, + Players = 7, + Ambient = 8, + Voice = 9, +} diff --git a/azalea-protocol/src/packets/game/c_damage_event.rs b/azalea-protocol/src/packets/game/c_damage_event.rs new file mode 100644 index 00000000..a736f39a --- /dev/null +++ b/azalea-protocol/src/packets/game/c_damage_event.rs @@ -0,0 +1,35 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWriteVar, AzaleaWrite}; +use azalea_core::position::Vec3; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundDamageEvent { + #[var] + pub entity_id: u32, + #[var] + pub source_type_id: u32, + pub source_cause_id: OptionalEntityId, + pub source_direct_id: OptionalEntityId, + pub source_position: Option, +} + +#[derive(Clone, Debug)] +pub struct OptionalEntityId(pub Option); +impl AzaleaRead for OptionalEntityId { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + match u32::azalea_read_var(buf)? { + 0 => Ok(OptionalEntityId(None)), + id => Ok(OptionalEntityId(Some(id - 1))), + } + } +} +impl AzaleaWrite for OptionalEntityId { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + match self.0 { + Some(id) => (id + 1).azalea_write_var(buf), + None => 0u32.azalea_write_var(buf), + } + } +} diff --git a/azalea-protocol/src/packets/game/c_debug_sample.rs b/azalea-protocol/src/packets/game/c_debug_sample.rs new file mode 100755 index 00000000..50550062 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_debug_sample.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +use super::s_debug_sample_subscription::RemoteDebugSampleType; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundDebugSample { + pub sample: Vec, + pub debug_sample_type: RemoteDebugSampleType, +} diff --git a/azalea-protocol/src/packets/game/c_delete_chat.rs b/azalea-protocol/src/packets/game/c_delete_chat.rs new file mode 100755 index 00000000..d44a4553 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_delete_chat.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +use super::c_player_chat::PackedMessageSignature; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundDeleteChat { + pub signature: PackedMessageSignature, +} diff --git a/azalea-protocol/src/packets/game/c_disconnect.rs b/azalea-protocol/src/packets/game/c_disconnect.rs new file mode 100755 index 00000000..ba197f1d --- /dev/null +++ b/azalea-protocol/src/packets/game/c_disconnect.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundDisconnect { + pub reason: FormattedText, +} diff --git a/azalea-protocol/src/packets/game/c_disguised_chat.rs b/azalea-protocol/src/packets/game/c_disguised_chat.rs new file mode 100644 index 00000000..90dc5d64 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_disguised_chat.rs @@ -0,0 +1,42 @@ +use azalea_buf::AzBuf; +use azalea_chat::{ + translatable_component::{StringOrComponent, TranslatableComponent}, + FormattedText, +}; +use azalea_protocol_macros::ClientboundGamePacket; + +use super::c_player_chat::ChatTypeBound; + +// A disguised chat packet is basically the same as a normal +// [`ClientboundPlayerChat`], except that it doesn't have any of the chat +// signing things. Vanilla servers use this when messages are sent from the +// console. +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket, PartialEq)] +pub struct ClientboundDisguisedChat { + pub message: FormattedText, + pub chat_type: ChatTypeBound, +} + +impl ClientboundDisguisedChat { + /// Get the full message, including the sender part. + #[must_use] + pub fn message(&self) -> FormattedText { + let sender = self.chat_type.name.clone(); + let content = self.message.clone(); + let target = self.chat_type.target_name.clone(); + + let translation_key = self.chat_type.chat_type.chat_translation_key(); + + let mut args = vec![ + StringOrComponent::FormattedText(sender), + StringOrComponent::FormattedText(content), + ]; + if let Some(target) = target { + args.push(StringOrComponent::FormattedText(target)); + } + + let component = TranslatableComponent::new(translation_key.to_string(), args); + + FormattedText::Translatable(component) + } +} diff --git a/azalea-protocol/src/packets/game/c_entity_event.rs b/azalea-protocol/src/packets/game/c_entity_event.rs new file mode 100755 index 00000000..13efbabd --- /dev/null +++ b/azalea-protocol/src/packets/game/c_entity_event.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundEntityEvent { + pub entity_id: u32, + pub event_id: u8, +} diff --git a/azalea-protocol/src/packets/game/c_entity_position_sync.rs b/azalea-protocol/src/packets/game/c_entity_position_sync.rs new file mode 100755 index 00000000..c5cde322 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_entity_position_sync.rs @@ -0,0 +1,19 @@ +use azalea_buf::AzBuf; +use azalea_core::position::Vec3; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundEntityPositionSync { + #[var] + pub id: u32, + pub values: PositionMoveRotation, + pub on_ground: bool, +} + +#[derive(AzBuf, Clone, Debug)] +pub struct PositionMoveRotation { + pub position: Vec3, + pub delta_movement: Vec3, + pub y_rot: f32, + pub x_rot: f32, +} diff --git a/azalea-protocol/src/packets/game/c_explode.rs b/azalea-protocol/src/packets/game/c_explode.rs new file mode 100755 index 00000000..aef3887d --- /dev/null +++ b/azalea-protocol/src/packets/game/c_explode.rs @@ -0,0 +1,164 @@ +use std::{ + io::{Cursor, Write}, + str::FromStr, +}; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; +use azalea_core::{position::BlockPos, resource_location::ResourceLocation}; +use azalea_protocol_macros::ClientboundGamePacket; +use azalea_registry::{ParticleKind, SoundEvent}; + +#[derive(Clone, Debug, PartialEq, ClientboundGamePacket)] +pub struct ClientboundExplode { + pub x: f64, + pub y: f64, + pub z: f64, + pub power: f32, + pub to_blow: Vec, + pub knockback_x: f32, + pub knockback_y: f32, + pub knockback_z: f32, + pub block_interaction: BlockInteraction, + pub small_explosion_particles: ParticleKind, + pub large_explosion_particles: ParticleKind, + pub explosion_sound: SoundEvent, +} + +#[derive(Clone, Copy, Debug, PartialEq, AzBuf)] +pub enum BlockInteraction { + Keep, + Destroy, + DestroyWithDecay, + TriggerBlock, +} + +impl AzaleaRead for ClientboundExplode { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let x = f64::azalea_read(buf)?; + let y = f64::azalea_read(buf)?; + let z = f64::azalea_read(buf)?; + let power = f32::azalea_read(buf)?; + + let x_floor = x.floor() as i32; + let y_floor = y.floor() as i32; + let z_floor = z.floor() as i32; + + let to_blow_len = u32::azalea_read_var(buf)?; + let mut to_blow = Vec::with_capacity(to_blow_len as usize); + for _ in 0..to_blow_len { + // the bytes are offsets from the main x y z + let x = x_floor + i32::from(i8::azalea_read(buf)?); + let y = y_floor + i32::from(i8::azalea_read(buf)?); + let z = z_floor + i32::from(i8::azalea_read(buf)?); + to_blow.push(BlockPos { x, y, z }); + } + + let knockback_x = f32::azalea_read(buf)?; + let knockback_y = f32::azalea_read(buf)?; + let knockback_z = f32::azalea_read(buf)?; + + let block_interaction = BlockInteraction::azalea_read(buf)?; + let small_explosion_particles = ParticleKind::azalea_read(buf)?; + let large_explosion_particles = ParticleKind::azalea_read(buf)?; + + let sound_event_resource_location = ResourceLocation::azalea_read(buf)?.to_string(); + let explosion_sound = + SoundEvent::from_str(&sound_event_resource_location).map_err(|_| { + BufReadError::UnexpectedStringEnumVariant { + id: sound_event_resource_location, + } + })?; + + Ok(Self { + x, + y, + z, + power, + to_blow, + knockback_x, + knockback_y, + knockback_z, + block_interaction, + small_explosion_particles, + large_explosion_particles, + explosion_sound, + }) + } +} + +impl AzaleaWrite for ClientboundExplode { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + self.x.azalea_write(buf)?; + self.y.azalea_write(buf)?; + self.z.azalea_write(buf)?; + self.power.azalea_write(buf)?; + + let to_blow_len = self.to_blow.len() as u32; + to_blow_len.azalea_write_var(buf)?; + + let x_floor = self.x.floor() as i32; + let y_floor = self.y.floor() as i32; + let z_floor = self.z.floor() as i32; + + for pos in &self.to_blow { + let x = (pos.x - x_floor) as i8; + let y = (pos.y - y_floor) as i8; + let z = (pos.z - z_floor) as i8; + x.azalea_write(buf)?; + y.azalea_write(buf)?; + z.azalea_write(buf)?; + } + + self.knockback_x.azalea_write(buf)?; + self.knockback_y.azalea_write(buf)?; + self.knockback_z.azalea_write(buf)?; + + self.block_interaction.azalea_write(buf)?; + self.small_explosion_particles.azalea_write(buf)?; + self.large_explosion_particles.azalea_write(buf)?; + + let sound_event_resource_location = + ResourceLocation::new(&self.explosion_sound.to_string()); + sound_event_resource_location.azalea_write(buf)?; + + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_read_write() { + let packet = ClientboundExplode { + x: 123_456.0, + y: 789_012.0, + z: 345_678.0, + power: 1_000.0, + to_blow: vec![ + BlockPos { + x: 123_456 + 1, + y: 789_012 + 2, + z: 345_678 - 127, + }, + BlockPos { + x: 123_456 + 4, + y: 789_012 - 5, + z: 345_678 + 6, + }, + ], + knockback_x: 1_000.0, + knockback_y: 2_000.0, + knockback_z: 3_000.0, + block_interaction: BlockInteraction::Destroy, + small_explosion_particles: ParticleKind::Explosion, + large_explosion_particles: ParticleKind::ExplosionEmitter, + explosion_sound: SoundEvent::EntityGenericExplode, + }; + let mut buf = Vec::new(); + packet.azalea_write(&mut buf).unwrap(); + let packet2 = ClientboundExplode::azalea_read(&mut Cursor::new(&buf)).unwrap(); + assert_eq!(packet, packet2); + } +} diff --git a/azalea-protocol/src/packets/game/c_forget_level_chunk.rs b/azalea-protocol/src/packets/game/c_forget_level_chunk.rs new file mode 100755 index 00000000..bd901634 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_forget_level_chunk.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_core::position::ChunkPos; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundForgetLevelChunk { + pub pos: ChunkPos, +} diff --git a/azalea-protocol/src/packets/game/c_game_event.rs b/azalea-protocol/src/packets/game/c_game_event.rs new file mode 100755 index 00000000..940aa2f1 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_game_event.rs @@ -0,0 +1,26 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundGameEvent { + pub event: EventType, + pub param: f32, +} + +#[derive(Clone, Debug, Copy, AzBuf)] +pub enum EventType { + NoRespawnBlockAvailable = 0, + StartRaining = 1, + StopRaining = 2, + ChangeGameMode = 3, + WinGame = 4, + DemoEvent = 5, + ArrowHitPlayer = 6, + RainLevelChange = 7, + ThunderLevelChange = 8, + PufferFishSting = 9, + GuardianElderEffect = 10, + ImmediateRespawn = 11, + LimitedCrafting = 12, + WaitForLevelChunks = 13, +} diff --git a/azalea-protocol/src/packets/game/c_horse_screen_open.rs b/azalea-protocol/src/packets/game/c_horse_screen_open.rs new file mode 100755 index 00000000..13a67253 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_horse_screen_open.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundHorseScreenOpen { + pub container_id: u8, + #[var] + pub size: u32, + pub entity_id: u32, +} diff --git a/azalea-protocol/src/packets/game/c_hurt_animation.rs b/azalea-protocol/src/packets/game/c_hurt_animation.rs new file mode 100644 index 00000000..49a32989 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_hurt_animation.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundHurtAnimation { + #[var] + pub id: u32, + pub yaw: f32, +} diff --git a/azalea-protocol/src/packets/game/c_initialize_border.rs b/azalea-protocol/src/packets/game/c_initialize_border.rs new file mode 100755 index 00000000..ca338b7f --- /dev/null +++ b/azalea-protocol/src/packets/game/c_initialize_border.rs @@ -0,0 +1,18 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, ClientboundGamePacket, AzBuf)] +pub struct ClientboundInitializeBorder { + pub new_center_x: f64, + pub new_center_z: f64, + pub old_size: f64, + pub new_size: f64, + #[var] + pub lerp_time: u64, + #[var] + pub new_absolute_max_size: u32, + #[var] + pub warning_blocks: u32, + #[var] + pub warning_time: u32, +} diff --git a/azalea-protocol/src/packets/game/c_keep_alive.rs b/azalea-protocol/src/packets/game/c_keep_alive.rs new file mode 100755 index 00000000..ff93560b --- /dev/null +++ b/azalea-protocol/src/packets/game/c_keep_alive.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundKeepAlive { + pub id: u64, +} diff --git a/azalea-protocol/src/packets/game/c_level_chunk_with_light.rs b/azalea-protocol/src/packets/game/c_level_chunk_with_light.rs new file mode 100755 index 00000000..a4a6da45 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_level_chunk_with_light.rs @@ -0,0 +1,65 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; +use simdnbt::owned::Nbt; + +use super::c_light_update::ClientboundLightUpdatePacketData; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundLevelChunkWithLight { + pub x: i32, + pub z: i32, + pub chunk_data: ClientboundLevelChunkPacketData, + pub light_data: ClientboundLightUpdatePacketData, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct ClientboundLevelChunkPacketData { + pub heightmaps: Nbt, + // we can't parse the data in azalea-protocol because it depends on context from other packets + pub data: Vec, + pub block_entities: Vec, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct BlockEntity { + pub packed_xz: u8, + pub y: u16, + pub kind: azalea_registry::BlockEntityKind, + pub data: Nbt, +} + +#[cfg(test)] +mod tests { + use std::{io::Cursor, ops::Deref}; + + use azalea_buf::AzaleaRead; + use azalea_world::Chunk; + use simdnbt::owned::BaseNbt; + + use super::*; + + #[test] + fn test_c_level_chunk_with_light_packet() { + #[rustfmt::skip] + let bytes = [ + 255, 255, 255, 253, 0, 0, 0, 1, 10, 12, 0, 15, 77, 79, 84, 73, 79, 78, 95, 66, 76, 79, 67, 75, 73, 78, 71, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 240, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 195, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 33, 67, 101, 135, 169, 203, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 33, 67, 101, 135, 169, 203, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ]; + + let packet = ClientboundLevelChunkWithLight::azalea_read(&mut Cursor::new(&bytes)).unwrap(); + + let heightmaps_nbt = &packet.chunk_data.heightmaps; + // necessary to make the unwrap_or work + let empty_nbt = BaseNbt::default(); + let heightmaps = heightmaps_nbt.unwrap_or(&empty_nbt).deref(); + + let chunk = Chunk::read_with_dimension_height( + &mut Cursor::new(&packet.chunk_data.data), + 256, + 0, + heightmaps, + ) + .unwrap(); + + assert_eq!(chunk.sections.len(), 16); + } +} diff --git a/azalea-protocol/src/packets/game/c_level_event.rs b/azalea-protocol/src/packets/game/c_level_event.rs new file mode 100755 index 00000000..f41a1f42 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_level_event.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_core::position::BlockPos; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundLevelEvent { + pub event_type: u32, + pub pos: BlockPos, + pub data: u32, + pub global_event: bool, +} diff --git a/azalea-protocol/src/packets/game/c_level_particles.rs b/azalea-protocol/src/packets/game/c_level_particles.rs new file mode 100755 index 00000000..d700673c --- /dev/null +++ b/azalea-protocol/src/packets/game/c_level_particles.rs @@ -0,0 +1,39 @@ +use azalea_buf::AzBuf; +use azalea_entity::particle::Particle; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundLevelParticles { + pub override_limiter: bool, + pub x: f64, + pub y: f64, + pub z: f64, + pub x_dist: f32, + pub y_dist: f32, + pub z_dist: f32, + pub max_speed: f32, + 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() { + let slice = &[ + 0, 64, 139, 10, 0, 0, 0, 0, 0, 192, 26, 0, 0, 0, 0, 0, 0, 64, 144, 58, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 13, 63, 128, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 63, 128, 0, 0, + ][..]; + let mut bytes = Cursor::new(slice); + + let _packet = ClientboundLevelParticles::azalea_read(&mut bytes).unwrap(); + assert_eq!(bytes.position(), slice.len() as u64); + } +} diff --git a/azalea-protocol/src/packets/game/c_light_update.rs b/azalea-protocol/src/packets/game/c_light_update.rs new file mode 100755 index 00000000..72523291 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_light_update.rs @@ -0,0 +1,22 @@ +use azalea_buf::AzBuf; +use azalea_core::bitset::BitSet; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundLightUpdate { + #[var] + pub x: i32, + #[var] + pub z: i32, + pub light_data: ClientboundLightUpdatePacketData, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct ClientboundLightUpdatePacketData { + pub sky_y_mask: BitSet, + pub block_y_mask: BitSet, + pub empty_sky_y_mask: BitSet, + pub empty_block_y_mask: BitSet, + pub sky_updates: Vec>, + pub block_updates: Vec>, +} diff --git a/azalea-protocol/src/packets/game/c_login.rs b/azalea-protocol/src/packets/game/c_login.rs new file mode 100755 index 00000000..c0616c55 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_login.rs @@ -0,0 +1,27 @@ +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundGamePacket; + +use crate::packets::common::CommonPlayerSpawnInfo; + +/// The first packet sent by the server to the client after login. +/// +/// This packet contains information about the state of the player, the +/// world, and the registry. +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundLogin { + pub player_id: u32, + pub hardcore: bool, + pub levels: Vec, + #[var] + pub max_players: i32, + #[var] + pub chunk_radius: u32, + #[var] + pub simulation_distance: u32, + pub reduced_debug_info: bool, + pub show_death_screen: bool, + pub do_limited_crafting: bool, + pub common: CommonPlayerSpawnInfo, + pub enforces_secure_chat: bool, +} diff --git a/azalea-protocol/src/packets/game/c_map_item_data.rs b/azalea-protocol/src/packets/game/c_map_item_data.rs new file mode 100755 index 00000000..9a41ed85 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_map_item_data.rs @@ -0,0 +1,88 @@ +use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite}; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, ClientboundGamePacket, AzBuf)] +pub struct ClientboundMapItemData { + #[var] + pub map_id: u32, + pub scale: u8, + pub locked: bool, + pub decorations: Option>, + pub color_patch: OptionalMapPatch, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct MapDecoration { + pub decoration_type: DecorationType, + pub x: i8, + pub y: i8, + /// Minecraft does & 15 on this value, azalea-protocol doesn't. I don't + /// think it matters. + pub rot: i8, + pub name: Option, +} + +#[derive(Debug, Clone)] +pub struct OptionalMapPatch(pub Option); + +impl AzaleaRead for OptionalMapPatch { + fn azalea_read(buf: &mut std::io::Cursor<&[u8]>) -> Result { + let pos = buf.position(); + Ok(Self(if u8::azalea_read(buf)? == 0 { + None + } else { + buf.set_position(pos); + Some(MapPatch::azalea_read(buf)?) + })) + } +} + +impl AzaleaWrite for OptionalMapPatch { + fn azalea_write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { + match &self.0 { + None => 0u8.azalea_write(buf), + Some(m) => m.azalea_write(buf), + } + } +} + +#[derive(Debug, Clone, AzBuf)] +pub struct MapPatch { + pub width: u8, + pub height: u8, + pub start_x: u8, + pub start_y: u8, + pub map_colors: Vec, +} + +#[derive(Clone, Copy, Debug, AzBuf)] +pub enum DecorationType { + Player, + Frame, + RedMarker, + BlueMarker, + TargetX, + TargetPoint, + PlayerOffMap, + PlayerOffLimits, + Mansion, + Monument, + BannerWhite, + BannerOrange, + BannerMagenta, + BannerLightBlue, + BannerYellow, + BannerLime, + BannerPink, + BannerGray, + BannerLightGray, + BannerCyan, + BannerPurple, + BannerBlue, + BannerBrown, + BannerGreen, + BannerRed, + BannerBlack, + RedX, +} diff --git a/azalea-protocol/src/packets/game/c_merchant_offers.rs b/azalea-protocol/src/packets/game/c_merchant_offers.rs new file mode 100755 index 00000000..e1822579 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_merchant_offers.rs @@ -0,0 +1,30 @@ +use azalea_buf::AzBuf; +use azalea_inventory::ItemStack; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundMerchantOffers { + #[var] + pub container_id: u32, + pub offers: Vec, + #[var] + pub villager_level: u32, + #[var] + pub villager_xp: u32, + pub show_progress: bool, + pub can_restock: bool, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct MerchantOffer { + pub base_cost_a: ItemStack, + pub result: ItemStack, + pub cost_b: ItemStack, + pub out_of_stock: bool, + pub uses: u32, + pub max_uses: u32, + pub xp: u32, + pub special_price_diff: i32, + pub price_multiplier: f32, + pub demand: u32, +} diff --git a/azalea-protocol/src/packets/game/c_move_entity_pos.rs b/azalea-protocol/src/packets/game/c_move_entity_pos.rs new file mode 100755 index 00000000..b153bb3c --- /dev/null +++ b/azalea-protocol/src/packets/game/c_move_entity_pos.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_core::delta::PositionDelta8; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundMoveEntityPos { + #[var] + pub entity_id: u32, + pub delta: PositionDelta8, + pub on_ground: bool, +} diff --git a/azalea-protocol/src/packets/game/c_move_entity_pos_rot.rs b/azalea-protocol/src/packets/game/c_move_entity_pos_rot.rs new file mode 100755 index 00000000..7b22e290 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_move_entity_pos_rot.rs @@ -0,0 +1,14 @@ +use azalea_buf::AzBuf; +use azalea_core::delta::PositionDelta8; +use azalea_protocol_macros::ClientboundGamePacket; + +/// This packet is sent by the server when an entity moves less then 8 blocks. +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundMoveEntityPosRot { + #[var] + pub entity_id: u32, + pub delta: PositionDelta8, + pub y_rot: i8, + pub x_rot: i8, + pub on_ground: bool, +} diff --git a/azalea-protocol/src/packets/game/c_move_entity_rot.rs b/azalea-protocol/src/packets/game/c_move_entity_rot.rs new file mode 100755 index 00000000..a8362748 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_move_entity_rot.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundMoveEntityRot { + #[var] + pub entity_id: u32, + pub y_rot: i8, + pub x_rot: i8, + pub on_ground: bool, +} diff --git a/azalea-protocol/src/packets/game/c_move_minecart_along_track.rs b/azalea-protocol/src/packets/game/c_move_minecart_along_track.rs new file mode 100644 index 00000000..0a205ddd --- /dev/null +++ b/azalea-protocol/src/packets/game/c_move_minecart_along_track.rs @@ -0,0 +1,19 @@ +use azalea_buf::AzBuf; +use azalea_core::position::Vec3; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundMoveMinecartAlongTrack { + #[var] + pub entity_id: u32, + pub lerp_steps: Vec, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct MinecartStep { + pub position: Vec3, + pub movement: Vec3, + pub y_rot: u8, + pub x_rot: u8, + pub weight: f32, +} diff --git a/azalea-protocol/src/packets/game/c_move_vehicle.rs b/azalea-protocol/src/packets/game/c_move_vehicle.rs new file mode 100755 index 00000000..96e3e5c2 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_move_vehicle.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundMoveVehicle { + pub x: f64, + pub y: f64, + pub z: f64, + pub y_rot: f32, + pub x_rot: f32, +} diff --git a/azalea-protocol/src/packets/game/c_open_book.rs b/azalea-protocol/src/packets/game/c_open_book.rs new file mode 100755 index 00000000..2c4f6b15 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_open_book.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +use super::s_interact::InteractionHand; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundOpenBook { + pub hand: InteractionHand, +} diff --git a/azalea-protocol/src/packets/game/c_open_screen.rs b/azalea-protocol/src/packets/game/c_open_screen.rs new file mode 100755 index 00000000..4ba71725 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_open_screen.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundOpenScreen { + #[var] + pub container_id: u32, + pub menu_type: azalea_registry::MenuKind, + pub title: FormattedText, +} diff --git a/azalea-protocol/src/packets/game/c_open_sign_editor.rs b/azalea-protocol/src/packets/game/c_open_sign_editor.rs new file mode 100755 index 00000000..52f5922c --- /dev/null +++ b/azalea-protocol/src/packets/game/c_open_sign_editor.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_core::position::BlockPos; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundOpenSignEditor { + pub pos: BlockPos, + pub is_front_text: bool, +} diff --git a/azalea-protocol/src/packets/game/c_ping.rs b/azalea-protocol/src/packets/game/c_ping.rs new file mode 100755 index 00000000..956aca8d --- /dev/null +++ b/azalea-protocol/src/packets/game/c_ping.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPing { + pub id: u32, +} diff --git a/azalea-protocol/src/packets/game/c_place_ghost_recipe.rs b/azalea-protocol/src/packets/game/c_place_ghost_recipe.rs new file mode 100755 index 00000000..41c32403 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_place_ghost_recipe.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlaceGhostRecipe { + pub container_id: u8, + pub recipe: ResourceLocation, +} diff --git a/azalea-protocol/src/packets/game/c_player_abilities.rs b/azalea-protocol/src/packets/game/c_player_abilities.rs new file mode 100755 index 00000000..c32a99fe --- /dev/null +++ b/azalea-protocol/src/packets/game/c_player_abilities.rs @@ -0,0 +1,53 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{AzBuf, BufReadError}; +use azalea_buf::{AzaleaRead, AzaleaWrite}; +use azalea_core::bitset::FixedBitSet; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerAbilities { + pub flags: PlayerAbilitiesFlags, + pub flying_speed: f32, + /// Used for the fov + pub walking_speed: f32, +} + +#[derive(Clone, Debug)] +pub struct PlayerAbilitiesFlags { + pub invulnerable: bool, + pub flying: bool, + pub can_fly: bool, + pub instant_break: bool, +} + +impl AzaleaRead for PlayerAbilitiesFlags { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let set = FixedBitSet::<4>::azalea_read(buf)?; + Ok(PlayerAbilitiesFlags { + invulnerable: set.index(0), + flying: set.index(1), + can_fly: set.index(2), + instant_break: set.index(3), + }) + } +} + +impl AzaleaWrite for PlayerAbilitiesFlags { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let mut set = FixedBitSet::<4>::new(); + if self.invulnerable { + set.set(0); + } + if self.flying { + set.set(1); + } + if self.can_fly { + set.set(2); + } + if self.instant_break { + set.set(3); + } + set.azalea_write(buf) + } +} diff --git a/azalea-protocol/src/packets/game/c_player_chat.rs b/azalea-protocol/src/packets/game/c_player_chat.rs new file mode 100644 index 00000000..0e9960f2 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_player_chat.rs @@ -0,0 +1,160 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; +use azalea_chat::{ + translatable_component::{StringOrComponent, TranslatableComponent}, + FormattedText, +}; +use azalea_core::bitset::BitSet; +use azalea_crypto::MessageSignature; +use azalea_protocol_macros::ClientboundGamePacket; +use azalea_registry::{ChatType, OptionalRegistry}; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket, PartialEq)] +pub struct ClientboundPlayerChat { + pub sender: Uuid, + #[var] + pub index: u32, + pub signature: Option, + pub body: PackedSignedMessageBody, + pub unsigned_content: Option, + pub filter_mask: FilterMask, + pub chat_type: ChatTypeBound, +} + +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub struct PackedSignedMessageBody { + // the error is here, for some reason it skipped a byte earlier and here + // it's reading `0` when it should be `11` + pub content: String, + pub timestamp: u64, + pub salt: u64, + pub last_seen: PackedLastSeenMessages, +} + +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub struct PackedLastSeenMessages { + pub entries: Vec, +} + +/// Messages can be deleted by either their signature or message id. +#[derive(Clone, Debug, PartialEq)] +pub enum PackedMessageSignature { + Signature(Box), + Id(u32), +} + +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub enum FilterMask { + PassThrough, + FullyFiltered, + PartiallyFiltered(BitSet), +} + +#[derive(Clone, Debug, PartialEq)] +pub struct ChatTypeBound { + pub chat_type: ChatType, + pub name: FormattedText, + pub target_name: Option, +} +impl AzaleaRead for ChatTypeBound { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let Some(chat_type) = OptionalRegistry::::azalea_read(buf)?.0 else { + return Err(BufReadError::Custom("ChatType cannot be None".to_owned())); + }; + let name = FormattedText::azalea_read(buf)?; + let target_name = Option::::azalea_read(buf)?; + + Ok(ChatTypeBound { + chat_type, + name, + target_name, + }) + } +} +impl AzaleaWrite for ChatTypeBound { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + OptionalRegistry(Some(self.chat_type)).azalea_write(buf)?; + self.name.azalea_write(buf)?; + self.target_name.azalea_write(buf)?; + Ok(()) + } +} + +// must be in Client +#[derive(Clone, Debug, PartialEq)] +pub struct MessageSignatureCache { + pub entries: Vec>, +} + +// impl MessageSignatureCache { +// pub fn unpacker(&self) -> impl Fn(u32) -> Option { + +// } +// } + +// impl PackedSignedMessageBody { +// pub fn unpack(&self, unpacker: impl Fn(u32) -> Option) +// {} } + +impl ClientboundPlayerChat { + /// Returns the content of the message. If you want to get the FormattedText + /// for the whole message including the sender part, use + /// [`ClientboundPlayerChat::message`]. + #[must_use] + pub fn content(&self) -> FormattedText { + self.unsigned_content + .clone() + .unwrap_or_else(|| FormattedText::from(self.body.content.clone())) + } + + /// Get the full message, including the sender part. + #[must_use] + pub fn message(&self) -> FormattedText { + let sender = self.chat_type.name.clone(); + let content = self.content(); + let target = self.chat_type.target_name.clone(); + + let translation_key = self.chat_type.chat_type.chat_translation_key(); + + let mut args = vec![ + StringOrComponent::FormattedText(sender), + StringOrComponent::FormattedText(content), + ]; + if let Some(target) = target { + args.push(StringOrComponent::FormattedText(target)); + } + + let component = TranslatableComponent::new(translation_key.to_string(), args); + + FormattedText::Translatable(component) + } +} + +impl AzaleaRead for PackedMessageSignature { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let id = u32::azalea_read_var(buf)?; + if id == 0 { + let full_signature = MessageSignature::azalea_read(buf)?; + + Ok(PackedMessageSignature::Signature(Box::new(full_signature))) + } else { + Ok(PackedMessageSignature::Id(id - 1)) + } + } +} +impl AzaleaWrite for PackedMessageSignature { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + match self { + PackedMessageSignature::Signature(full_signature) => { + 0u32.azalea_write_var(buf)?; + full_signature.azalea_write(buf)?; + } + PackedMessageSignature::Id(id) => { + (id + 1).azalea_write_var(buf)?; + } + } + Ok(()) + } +} diff --git a/azalea-protocol/src/packets/game/c_player_chat_header.rs b/azalea-protocol/src/packets/game/c_player_chat_header.rs new file mode 100755 index 00000000..d7e84cc5 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_player_chat_header.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_crypto::{MessageSignature, SignedMessageHeader}; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerChatHeader { + pub header: SignedMessageHeader, + pub header_signature: MessageSignature, + pub body_digest: Vec, +} diff --git a/azalea-protocol/src/packets/game/c_player_combat_end.rs b/azalea-protocol/src/packets/game/c_player_combat_end.rs new file mode 100755 index 00000000..b8029f1b --- /dev/null +++ b/azalea-protocol/src/packets/game/c_player_combat_end.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +/// Unused by the client in vanilla. +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerCombatEnd { + #[var] + pub duration: u32, +} diff --git a/azalea-protocol/src/packets/game/c_player_combat_enter.rs b/azalea-protocol/src/packets/game/c_player_combat_enter.rs new file mode 100755 index 00000000..8c344b49 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_player_combat_enter.rs @@ -0,0 +1,6 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +/// Unused in vanilla. +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerCombatEnter {} diff --git a/azalea-protocol/src/packets/game/c_player_combat_kill.rs b/azalea-protocol/src/packets/game/c_player_combat_kill.rs new file mode 100755 index 00000000..fb7285b5 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_player_combat_kill.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundGamePacket; + +/// Used to send a respawn screen. +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerCombatKill { + #[var] + pub player_id: u32, + pub message: FormattedText, +} diff --git a/azalea-protocol/src/packets/game/c_player_info_remove.rs b/azalea-protocol/src/packets/game/c_player_info_remove.rs new file mode 100644 index 00000000..fcaef9d4 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_player_info_remove.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerInfoRemove { + pub profile_ids: Vec, +} diff --git a/azalea-protocol/src/packets/game/c_player_info_update.rs b/azalea-protocol/src/packets/game/c_player_info_update.rs new file mode 100644 index 00000000..73c463d5 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_player_info_update.rs @@ -0,0 +1,326 @@ +use std::{ + collections::HashMap, + io::{Cursor, Write}, +}; + +use azalea_auth::game_profile::{GameProfile, ProfilePropertyValue}; +use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; +use azalea_chat::FormattedText; +use azalea_core::{bitset::FixedBitSet, game_type::GameMode}; +use azalea_protocol_macros::ClientboundGamePacket; +use uuid::Uuid; + +use super::s_chat_session_update::RemoteChatSessionData; + +#[derive(Clone, Debug, ClientboundGamePacket)] +pub struct ClientboundPlayerInfoUpdate { + pub actions: ActionEnumSet, + pub entries: Vec, +} + +#[derive(Clone, Debug, Default)] +pub struct PlayerInfoEntry { + pub profile: GameProfile, + pub listed: bool, + pub latency: i32, + pub game_mode: GameMode, + pub display_name: Option, + pub list_order: i32, + pub update_hat: bool, + pub chat_session: Option, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct AddPlayerAction { + pub name: String, + pub properties: HashMap, +} +#[derive(Clone, Debug, AzBuf)] +pub struct InitializeChatAction { + pub chat_session: Option, +} +#[derive(Clone, Debug, AzBuf)] +pub struct UpdateGameModeAction { + pub game_mode: GameMode, +} +#[derive(Clone, Debug, AzBuf)] +pub struct UpdateListedAction { + pub listed: bool, +} +#[derive(Clone, Debug, AzBuf)] +pub struct UpdateLatencyAction { + #[var] + pub latency: i32, +} +#[derive(Clone, Debug, AzBuf)] +pub struct UpdateDisplayNameAction { + pub display_name: Option, +} +#[derive(Clone, Debug, AzBuf)] +pub struct UpdateHatAction { + pub update_hat: bool, +} +#[derive(Clone, Debug, AzBuf)] +pub struct UpdateListOrderAction { + #[var] + pub list_order: i32, +} + +impl AzaleaRead for ClientboundPlayerInfoUpdate { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let actions = ActionEnumSet::azalea_read(buf)?; + let mut entries = Vec::new(); + + let entry_count = u32::azalea_read_var(buf)?; + for _ in 0..entry_count { + let profile_id = Uuid::azalea_read(buf)?; + let mut entry = PlayerInfoEntry::default(); + entry.profile.uuid = profile_id; + + if actions.add_player { + let action = AddPlayerAction::azalea_read(buf)?; + entry.profile.name = action.name; + entry.profile.properties = action.properties; + } + if actions.initialize_chat { + let action = InitializeChatAction::azalea_read(buf)?; + entry.chat_session = action.chat_session; + } + if actions.update_game_mode { + let action = UpdateGameModeAction::azalea_read(buf)?; + entry.game_mode = action.game_mode; + } + if actions.update_listed { + let action = UpdateListedAction::azalea_read(buf)?; + entry.listed = action.listed; + } + if actions.update_latency { + let action = UpdateLatencyAction::azalea_read(buf)?; + entry.latency = action.latency; + } + if actions.update_display_name { + let action = UpdateDisplayNameAction::azalea_read(buf)?; + entry.display_name = action.display_name; + } + if actions.update_hat { + let action = UpdateHatAction::azalea_read(buf)?; + entry.update_hat = action.update_hat; + } + if actions.update_list_order { + let action = UpdateListOrderAction::azalea_read(buf)?; + entry.list_order = action.list_order; + } + + entries.push(entry); + } + + Ok(ClientboundPlayerInfoUpdate { actions, entries }) + } +} + +impl AzaleaWrite for ClientboundPlayerInfoUpdate { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + self.actions.azalea_write(buf)?; + + (self.entries.len() as u32).azalea_write_var(buf)?; + for entry in &self.entries { + entry.profile.uuid.azalea_write(buf)?; + + if self.actions.add_player { + AddPlayerAction { + name: entry.profile.name.clone(), + properties: entry.profile.properties.clone(), + } + .azalea_write(buf)?; + } + if self.actions.initialize_chat { + InitializeChatAction { + chat_session: entry.chat_session.clone(), + } + .azalea_write(buf)?; + } + if self.actions.update_game_mode { + UpdateGameModeAction { + game_mode: entry.game_mode, + } + .azalea_write(buf)?; + } + if self.actions.update_listed { + UpdateListedAction { + listed: entry.listed, + } + .azalea_write(buf)?; + } + if self.actions.update_latency { + UpdateLatencyAction { + latency: entry.latency, + } + .azalea_write(buf)?; + } + if self.actions.update_display_name { + UpdateDisplayNameAction { + display_name: entry.display_name.clone(), + } + .azalea_write(buf)?; + } + } + + Ok(()) + } +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct ActionEnumSet { + pub add_player: bool, + pub initialize_chat: bool, + pub update_game_mode: bool, + pub update_listed: bool, + pub update_latency: bool, + pub update_display_name: bool, + pub update_hat: bool, + pub update_list_order: bool, +} + +impl AzaleaRead for ActionEnumSet { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let set = FixedBitSet::<7>::azalea_read(buf)?; + Ok(ActionEnumSet { + add_player: set.index(0), + initialize_chat: set.index(1), + update_game_mode: set.index(2), + update_listed: set.index(3), + update_latency: set.index(4), + update_display_name: set.index(5), + update_hat: set.index(6), + update_list_order: set.index(7), + }) + } +} + +impl AzaleaWrite for ActionEnumSet { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let mut set = FixedBitSet::<7>::new(); + if self.add_player { + set.set(0); + } + if self.initialize_chat { + set.set(1); + } + if self.update_game_mode { + set.set(2); + } + if self.update_listed { + set.set(3); + } + if self.update_latency { + set.set(4); + } + if self.update_display_name { + set.set(5); + } + if self.update_hat { + set.set(6); + } + if self.update_list_order { + set.set(7); + } + set.azalea_write(buf)?; + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_action_enum_set() { + let data = ActionEnumSet { + add_player: true, + initialize_chat: false, + update_game_mode: true, + update_listed: false, + update_latency: true, + update_display_name: false, + update_hat: false, + update_list_order: true, + }; + let mut buf = Vec::new(); + data.azalea_write(&mut buf).unwrap(); + let mut data_cursor: Cursor<&[u8]> = Cursor::new(&buf); + let read_data = ActionEnumSet::azalea_read(&mut data_cursor).unwrap(); + assert_eq!(read_data, data); + } + + #[test] + fn read_player_info_update_packet() { + // from wynncraft + let mut bytes = Cursor::new( + &[ + 63, 1, 196, 217, 99, 243, 221, 101, 79, 183, 167, 88, 48, 71, 25, 49, 5, 142, 5, + 74, 66, 76, 80, 78, 1, 8, 116, 101, 120, 116, 117, 114, 101, 115, 152, 3, 101, 119, + 111, 103, 73, 67, 74, 48, 97, 87, 49, 108, 99, 51, 82, 104, 98, 88, 65, 105, 73, + 68, 111, 103, 77, 84, 99, 119, 77, 106, 99, 49, 78, 106, 89, 48, 77, 68, 81, 120, + 78, 105, 119, 75, 73, 67, 65, 105, 99, 72, 74, 118, 90, 109, 108, 115, 90, 85, 108, + 107, 73, 105, 65, 54, 73, 67, 74, 106, 78, 71, 81, 53, 78, 106, 78, 109, 77, 50, + 82, 107, 78, 106, 85, 48, 90, 109, 73, 51, 89, 84, 99, 49, 79, 68, 77, 119, 78, 68, + 99, 120, 79, 84, 77, 120, 77, 68, 85, 52, 90, 83, 73, 115, 67, 105, 65, 103, 73, + 110, 66, 121, 98, 50, 90, 112, 98, 71, 86, 79, 89, 87, 49, 108, 73, 105, 65, 54, + 73, 67, 74, 75, 81, 107, 120, 81, 84, 105, 73, 115, 67, 105, 65, 103, 73, 110, 78, + 112, 90, 50, 53, 104, 100, 72, 86, 121, 90, 86, 74, 108, 99, 88, 86, 112, 99, 109, + 86, 107, 73, 105, 65, 54, 73, 72, 82, 121, 100, 87, 85, 115, 67, 105, 65, 103, 73, + 110, 82, 108, 101, 72, 82, 49, 99, 109, 86, 122, 73, 105, 65, 54, 73, 72, 115, 75, + 73, 67, 65, 103, 73, 67, 74, 84, 83, 48, 108, 79, 73, 105, 65, 54, 73, 72, 115, 75, + 73, 67, 65, 103, 73, 67, 65, 103, 73, 110, 86, 121, 98, 67, 73, 103, 79, 105, 65, + 105, 97, 72, 82, 48, 99, 68, 111, 118, 76, 51, 82, 108, 101, 72, 82, 49, 99, 109, + 86, 122, 76, 109, 49, 112, 98, 109, 86, 106, 99, 109, 70, 109, 100, 67, 53, 117, + 90, 88, 81, 118, 100, 71, 86, 52, 100, 72, 86, 121, 90, 83, 56, 48, 79, 68, 107, + 120, 89, 84, 107, 50, 89, 84, 74, 107, 77, 84, 103, 120, 78, 84, 69, 49, 79, 68, + 107, 52, 78, 68, 89, 119, 77, 68, 82, 106, 77, 106, 100, 104, 78, 50, 86, 106, 77, + 106, 85, 53, 77, 87, 77, 120, 79, 68, 66, 108, 77, 84, 70, 109, 77, 122, 104, 107, + 89, 122, 69, 52, 77, 84, 74, 109, 77, 106, 100, 104, 77, 71, 82, 108, 78, 50, 69, + 120, 77, 87, 85, 120, 73, 103, 111, 103, 73, 67, 65, 103, 102, 81, 111, 103, 73, + 72, 48, 75, 102, 81, 61, 61, 1, 172, 5, 117, 69, 67, 88, 54, 83, 104, 55, 67, 100, + 87, 49, 77, 99, 78, 88, 122, 72, 73, 105, 90, 86, 43, 103, 111, 121, 47, 120, 53, + 102, 51, 65, 113, 119, 50, 115, 102, 114, 104, 106, 67, 118, 67, 102, 97, 54, 67, + 112, 55, 88, 116, 109, 103, 118, 113, 73, 114, 122, 100, 85, 72, 90, 102, 79, 100, + 100, 112, 109, 87, 70, 110, 70, 119, 97, 85, 109, 97, 76, 106, 86, 102, 121, 88, + 119, 115, 76, 48, 78, 108, 118, 98, 56, 78, 104, 121, 115, 113, 87, 47, 104, 75, + 120, 101, 86, 117, 90, 68, 71, 43, 102, 54, 98, 99, 98, 81, 113, 76, 79, 54, 83, + 66, 88, 111, 81, 74, 85, 104, 74, 66, 90, 102, 88, 78, 53, 51, 100, 102, 80, 98, + 75, 89, 81, 54, 68, 77, 57, 87, 102, 113, 81, 76, 100, 55, 121, 117, 119, 90, 81, + 68, 55, 120, 48, 54, 118, 102, 105, 72, 121, 48, 110, 87, 50, 99, 68, 111, 72, 101, + 71, 102, 72, 67, 53, 104, 52, 112, 84, 109, 65, 101, 100, 101, 109, 116, 48, 67, + 72, 113, 86, 54, 76, 67, 77, 89, 118, 101, 110, 84, 88, 68, 83, 81, 107, 82, 43, + 50, 53, 74, 76, 120, 101, 98, 74, 105, 98, 108, 54, 88, 106, 73, 118, 88, 120, 105, + 87, 68, 121, 85, 49, 65, 43, 121, 48, 79, 104, 53, 89, 115, 116, 121, 86, 116, 106, + 107, 76, 113, 67, 56, 85, 57, 118, 86, 110, 87, 65, 102, 111, 43, 52, 104, 78, 43, + 79, 51, 122, 108, 72, 117, 84, 50, 87, 76, 86, 121, 98, 43, 88, 72, 100, 67, 111, + 111, 88, 75, 82, 75, 83, 86, 71, 101, 122, 103, 75, 78, 47, 53, 65, 53, 67, 119, + 78, 112, 82, 87, 98, 81, 55, 109, 90, 47, 108, 51, 57, 84, 114, 100, 84, 99, 54, + 121, 79, 88, 73, 48, 56, 83, 101, 73, 54, 68, 118, 118, 50, 55, 78, 66, 112, 107, + 47, 97, 72, 119, 65, 49, 116, 105, 78, 108, 55, 122, 49, 103, 97, 79, 107, 113, + 107, 116, 54, 120, 85, 116, 70, 84, 85, 122, 72, 71, 97, 107, 69, 118, 105, 76, 72, + 120, 67, 99, 106, 98, 121, 88, 111, 76, 71, 101, 101, 50, 57, 81, 84, 73, 102, 99, + 97, 69, 56, 104, 108, 110, 73, 97, 74, 111, 115, 72, 117, 57, 116, 100, 54, 52, + 119, 74, 88, 74, 115, 69, 78, 114, 121, 69, 56, 70, 53, 52, 52, 116, 114, 84, 54, + 105, 112, 122, 73, 119, 43, 118, 120, 112, 76, 121, 88, 65, 87, 116, 103, 83, 113, + 76, 108, 107, 121, 78, 50, 77, 115, 57, 74, 89, 110, 100, 79, 111, 90, 57, 77, 53, + 84, 49, 87, 112, 75, 70, 97, 52, 55, 114, 112, 80, 106, 75, 114, 79, 107, 114, 110, + 100, 50, 97, 83, 51, 90, 86, 77, 120, 118, 79, 49, 111, 78, 47, 100, 84, 55, 116, + 77, 119, 82, 52, 109, 97, 55, 85, 73, 68, 50, 48, 84, 113, 105, 83, 75, 56, 108, + 76, 85, 100, 53, 48, 86, 119, 108, 112, 67, 116, 98, 76, 99, 71, 86, 82, 98, 78, + 84, 97, 108, 90, 83, 66, 56, 88, 65, 72, 72, 78, 100, 116, 88, 86, 50, 49, 111, 68, + 77, 116, 77, 122, 79, 104, 82, 109, 43, 57, 88, 81, 90, 79, 50, 55, 66, 69, 71, 65, + 47, 119, 117, 104, 113, 71, 108, 106, 82, 111, 76, 72, 111, 102, 98, 71, 48, 52, + 82, 55, 84, 43, 80, 99, 112, 77, 116, 65, 69, 105, 49, 100, 57, 99, 66, 90, 115, + 119, 84, 105, 107, 113, 114, 89, 49, 86, 49, 48, 106, 104, 77, 76, 118, 99, 99, 78, + 50, 109, 70, 43, 89, 86, 81, 101, 48, 90, 55, 43, 78, 100, 119, 119, 104, 121, 47, + 108, 79, 72, 81, 54, 71, 108, 122, 74, 110, 87, 122, 103, 50, 107, 61, 0, 255, 255, + 255, 255, 15, 1, 255, 255, 255, 255, 15, 1, 10, 8, 0, 4, 116, 101, 120, 116, 0, 0, + 0, + ][..], + ); + let _packet = ClientboundPlayerInfoUpdate::azalea_read(&mut bytes).unwrap(); + } +} diff --git a/azalea-protocol/src/packets/game/c_player_look_at.rs b/azalea-protocol/src/packets/game/c_player_look_at.rs new file mode 100755 index 00000000..4d886814 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_player_look_at.rs @@ -0,0 +1,24 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerLookAt { + pub from_anchor: Anchor, + pub x: f64, + pub y: f64, + pub z: f64, + pub entity: Option, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum Anchor { + Feet = 0, + Eyes = 1, +} + +#[derive(AzBuf, Clone, Debug)] +pub struct AtEntity { + #[var] + pub entity: u32, + pub to_anchor: Anchor, +} diff --git a/azalea-protocol/src/packets/game/c_player_position.rs b/azalea-protocol/src/packets/game/c_player_position.rs new file mode 100755 index 00000000..aa030fc5 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_player_position.rs @@ -0,0 +1,61 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError}; +use azalea_core::{bitset::FixedBitSet, position::Vec3}; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerPosition { + #[var] + pub id: u32, + pub pos: Vec3, + pub delta_movement: Vec3, + pub y_rot: f32, + pub x_rot: f32, + pub relative_arguments: RelativeMovements, +} + +#[derive(Debug, Clone)] +pub struct RelativeMovements { + pub x: bool, + pub y: bool, + pub z: bool, + pub y_rot: bool, + pub x_rot: bool, +} + +impl AzaleaRead for RelativeMovements { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + // yes minecraft seriously wastes that many bits, smh + let set = FixedBitSet::<32>::azalea_read(buf)?; + Ok(RelativeMovements { + x: set.index(0), + y: set.index(1), + z: set.index(2), + y_rot: set.index(3), + x_rot: set.index(4), + }) + } +} + +impl AzaleaWrite for RelativeMovements { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let mut set = FixedBitSet::<5>::new(); + if self.x { + set.set(0); + } + if self.y { + set.set(1); + } + if self.z { + set.set(2); + } + if self.y_rot { + set.set(3); + } + if self.x_rot { + set.set(4); + } + set.azalea_write(buf) + } +} diff --git a/azalea-protocol/src/packets/game/c_player_rotation.rs b/azalea-protocol/src/packets/game/c_player_rotation.rs new file mode 100755 index 00000000..33214cf9 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_player_rotation.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPlayerRotation { + pub y_rot: f32, + pub x_rot: f32, +} diff --git a/azalea-protocol/src/packets/game/c_pong_response.rs b/azalea-protocol/src/packets/game/c_pong_response.rs new file mode 100755 index 00000000..835666db --- /dev/null +++ b/azalea-protocol/src/packets/game/c_pong_response.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundPongResponse { + pub time: u64, +} diff --git a/azalea-protocol/src/packets/game/c_projectile_power.rs b/azalea-protocol/src/packets/game/c_projectile_power.rs new file mode 100644 index 00000000..8b453ae2 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_projectile_power.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundProjectilePower { + pub id: u32, + pub acceleration_power: f64, +} diff --git a/azalea-protocol/src/packets/game/c_recipe_book_add.rs b/azalea-protocol/src/packets/game/c_recipe_book_add.rs new file mode 100755 index 00000000..e6b91130 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_recipe_book_add.rs @@ -0,0 +1,79 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +use super::c_update_recipes::{Ingredient, SlotDisplayData}; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundRecipeBookAdd { + pub entries: Vec, + pub replace: bool, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct Entry { + pub contents: RecipeDisplayEntry, + pub flags: u8, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct RecipeDisplayEntry { + #[var] + pub id: u32, + pub display: RecipeDisplayData, + // ByteBufCodecs.OPTIONAL_VAR_INT + #[var] + pub group: u32, + pub category: azalea_registry::RecipeBookCategory, + pub crafting_requirements: Option>, +} + +/// [`azalea_registry::RecipeDisplay`] +#[derive(Clone, Debug, AzBuf)] +pub enum RecipeDisplayData { + Shapeless(ShapelessCraftingRecipeDisplay), + Shaped(ShapedCraftingRecipeDisplay), + Furnace(FurnaceRecipeDisplay), + Stonecutter(StonecutterRecipeDisplay), + Smithing(SmithingRecipeDisplay), +} + +#[derive(Clone, Debug, AzBuf)] +pub struct ShapelessCraftingRecipeDisplay { + pub ingredients: Vec, + pub result: SlotDisplayData, + pub crafting_station: SlotDisplayData, +} +#[derive(Clone, Debug, AzBuf)] +pub struct ShapedCraftingRecipeDisplay { + #[var] + pub width: u32, + #[var] + pub height: u32, + pub ingredients: Vec, + pub result: SlotDisplayData, + pub crafting_station: SlotDisplayData, +} +#[derive(Clone, Debug, AzBuf)] +pub struct FurnaceRecipeDisplay { + pub ingredient: SlotDisplayData, + pub fuel: SlotDisplayData, + pub result: SlotDisplayData, + pub crafting_station: SlotDisplayData, + #[var] + pub duration: u32, + pub experience: f32, +} +#[derive(Clone, Debug, AzBuf)] +pub struct StonecutterRecipeDisplay { + pub input: SlotDisplayData, + pub result: SlotDisplayData, + pub crafting_station: SlotDisplayData, +} +#[derive(Clone, Debug, AzBuf)] +pub struct SmithingRecipeDisplay { + pub template: SlotDisplayData, + pub base: SlotDisplayData, + pub addition: SlotDisplayData, + pub result: SlotDisplayData, + pub crafting_station: SlotDisplayData, +} diff --git a/azalea-protocol/src/packets/game/c_recipe_book_remove.rs b/azalea-protocol/src/packets/game/c_recipe_book_remove.rs new file mode 100755 index 00000000..aa5a09fe --- /dev/null +++ b/azalea-protocol/src/packets/game/c_recipe_book_remove.rs @@ -0,0 +1,12 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +use super::{c_entity_position_sync::PositionMoveRotation, c_player_position::RelativeMovements}; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundRecipeBookRemove { + #[var] + pub id: u32, + pub change: PositionMoveRotation, + pub relatives: RelativeMovements, +} diff --git a/azalea-protocol/src/packets/game/c_recipe_book_settings.rs b/azalea-protocol/src/packets/game/c_recipe_book_settings.rs new file mode 100755 index 00000000..f88a9733 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_recipe_book_settings.rs @@ -0,0 +1,22 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundRecipeBookSettings { + pub book_settings: RecipeBookSettings, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct RecipeBookSettings { + pub gui_open: bool, + pub filtering_craftable: bool, + + pub furnace_gui_open: bool, + pub furnace_filtering_craftable: bool, + + pub blast_furnace_gui_open: bool, + pub blast_furnace_filtering_craftable: bool, + + pub smoker_gui_open: bool, + pub smoker_filtering_craftable: bool, +} diff --git a/azalea-protocol/src/packets/game/c_remove_entities.rs b/azalea-protocol/src/packets/game/c_remove_entities.rs new file mode 100755 index 00000000..f3eb7139 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_remove_entities.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundRemoveEntities { + #[var] + pub entity_ids: Vec, +} diff --git a/azalea-protocol/src/packets/game/c_remove_mob_effect.rs b/azalea-protocol/src/packets/game/c_remove_mob_effect.rs new file mode 100755 index 00000000..21500db3 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_remove_mob_effect.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundRemoveMobEffect { + #[var] + pub entity_id: u32, + pub effect: azalea_registry::MobEffect, +} diff --git a/azalea-protocol/src/packets/game/c_reset_score.rs b/azalea-protocol/src/packets/game/c_reset_score.rs new file mode 100644 index 00000000..8a40dd0d --- /dev/null +++ b/azalea-protocol/src/packets/game/c_reset_score.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundResetScore { + pub owner: String, + pub objective_name: Option, +} diff --git a/azalea-protocol/src/packets/game/c_resource_pack_pop.rs b/azalea-protocol/src/packets/game/c_resource_pack_pop.rs new file mode 100644 index 00000000..14150ea1 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_resource_pack_pop.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundResourcePackPop { + pub id: Option, +} diff --git a/azalea-protocol/src/packets/game/c_resource_pack_push.rs b/azalea-protocol/src/packets/game/c_resource_pack_push.rs new file mode 100644 index 00000000..6e355029 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_resource_pack_push.rs @@ -0,0 +1,13 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundGamePacket; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundResourcePackPush { + pub id: Uuid, + pub url: String, + pub hash: String, + pub required: bool, + pub prompt: Option, +} diff --git a/azalea-protocol/src/packets/game/c_respawn.rs b/azalea-protocol/src/packets/game/c_respawn.rs new file mode 100755 index 00000000..79bbfd1d --- /dev/null +++ b/azalea-protocol/src/packets/game/c_respawn.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +use crate::packets::common::CommonPlayerSpawnInfo; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundRespawn { + pub common: CommonPlayerSpawnInfo, + pub data_to_keep: u8, +} diff --git a/azalea-protocol/src/packets/game/c_rotate_head.rs b/azalea-protocol/src/packets/game/c_rotate_head.rs new file mode 100755 index 00000000..26e55948 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_rotate_head.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundRotateHead { + #[var] + pub entity_id: u32, + pub y_head_rot: i8, +} diff --git a/azalea-protocol/src/packets/game/c_section_blocks_update.rs b/azalea-protocol/src/packets/game/c_section_blocks_update.rs new file mode 100755 index 00000000..4554c015 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_section_blocks_update.rs @@ -0,0 +1,43 @@ +use std::io::{Cursor, Write}; + +use azalea_block::BlockState; +use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; +use azalea_core::position::{ChunkSectionBlockPos, ChunkSectionPos}; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSectionBlocksUpdate { + pub section_pos: ChunkSectionPos, + pub states: Vec, +} + +#[derive(Clone, Debug)] +pub struct BlockStateWithPosition { + pub pos: ChunkSectionBlockPos, + pub state: BlockState, +} + +impl AzaleaRead for BlockStateWithPosition { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let data = u64::azalea_read_var(buf)?; + let position_part = data & 4095; + let state = (data >> 12) as u32; + let state = BlockState::try_from(state) + .map_err(|_| BufReadError::UnexpectedEnumVariant { id: state as i32 })?; + let pos = ChunkSectionBlockPos { + x: (position_part >> 8 & 15) as u8, + y: (position_part & 15) as u8, + z: (position_part >> 4 & 15) as u8, + }; + Ok(BlockStateWithPosition { pos, state }) + } +} + +impl AzaleaWrite for BlockStateWithPosition { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let data = (self.state.id as u64) << 12 + | (u64::from(self.pos.x) << 8 | u64::from(self.pos.z) << 4 | u64::from(self.pos.y)); + u64::azalea_write_var(&data, buf)?; + Ok(()) + } +} diff --git a/azalea-protocol/src/packets/game/c_select_advancements_tab.rs b/azalea-protocol/src/packets/game/c_select_advancements_tab.rs new file mode 100755 index 00000000..eb4cc62a --- /dev/null +++ b/azalea-protocol/src/packets/game/c_select_advancements_tab.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSelectAdvancementsTab { + pub tab: Option, +} diff --git a/azalea-protocol/src/packets/game/c_server_data.rs b/azalea-protocol/src/packets/game/c_server_data.rs new file mode 100755 index 00000000..22116685 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_server_data.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundServerData { + pub motd: FormattedText, + pub icon_bytes: Option>, +} diff --git a/azalea-protocol/src/packets/game/c_server_links.rs b/azalea-protocol/src/packets/game/c_server_links.rs new file mode 100644 index 00000000..80c444f0 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_server_links.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +use crate::common::server_links::ServerLinkEntry; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundServerLinks { + pub links: Vec, +} diff --git a/azalea-protocol/src/packets/game/c_set_action_bar_text.rs b/azalea-protocol/src/packets/game/c_set_action_bar_text.rs new file mode 100755 index 00000000..d08c5021 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_action_bar_text.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetActionBarText { + pub text: FormattedText, +} diff --git a/azalea-protocol/src/packets/game/c_set_border_center.rs b/azalea-protocol/src/packets/game/c_set_border_center.rs new file mode 100755 index 00000000..afc49556 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_border_center.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetBorderCenter { + pub new_center_x: f64, + pub new_center_z: f64, +} diff --git a/azalea-protocol/src/packets/game/c_set_border_lerp_size.rs b/azalea-protocol/src/packets/game/c_set_border_lerp_size.rs new file mode 100755 index 00000000..3c70a40e --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_border_lerp_size.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetBorderLerpSize { + pub old_size: f64, + pub new_size: f64, + #[var] + pub lerp_time: u64, +} diff --git a/azalea-protocol/src/packets/game/c_set_border_size.rs b/azalea-protocol/src/packets/game/c_set_border_size.rs new file mode 100755 index 00000000..6884cde6 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_border_size.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetBorderSize { + pub size: f64, +} diff --git a/azalea-protocol/src/packets/game/c_set_border_warning_delay.rs b/azalea-protocol/src/packets/game/c_set_border_warning_delay.rs new file mode 100755 index 00000000..e1126165 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_border_warning_delay.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetBorderWarningDelay { + #[var] + pub warning_delay: u32, +} diff --git a/azalea-protocol/src/packets/game/c_set_border_warning_distance.rs b/azalea-protocol/src/packets/game/c_set_border_warning_distance.rs new file mode 100755 index 00000000..dbb2a742 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_border_warning_distance.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetBorderWarningDistance { + #[var] + pub warning_blocks: u32, +} diff --git a/azalea-protocol/src/packets/game/c_set_camera.rs b/azalea-protocol/src/packets/game/c_set_camera.rs new file mode 100755 index 00000000..4ce4547c --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_camera.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetCamera { + #[var] + pub camera_id: u32, +} diff --git a/azalea-protocol/src/packets/game/c_set_chunk_cache_center.rs b/azalea-protocol/src/packets/game/c_set_chunk_cache_center.rs new file mode 100755 index 00000000..4c66213c --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_chunk_cache_center.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetChunkCacheCenter { + #[var] + pub x: i32, + #[var] + pub z: i32, +} diff --git a/azalea-protocol/src/packets/game/c_set_chunk_cache_radius.rs b/azalea-protocol/src/packets/game/c_set_chunk_cache_radius.rs new file mode 100755 index 00000000..b992e572 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_chunk_cache_radius.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetChunkCacheRadius { + #[var] + pub radius: u32, +} diff --git a/azalea-protocol/src/packets/game/c_set_cursor_item.rs b/azalea-protocol/src/packets/game/c_set_cursor_item.rs new file mode 100644 index 00000000..2c10ae26 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_cursor_item.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_inventory::ItemStack; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetCursorItem { + pub contents: Option, +} diff --git a/azalea-protocol/src/packets/game/c_set_default_spawn_position.rs b/azalea-protocol/src/packets/game/c_set_default_spawn_position.rs new file mode 100755 index 00000000..b6262ac8 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_default_spawn_position.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_core::position::BlockPos; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetDefaultSpawnPosition { + pub pos: BlockPos, + pub angle: f32, +} diff --git a/azalea-protocol/src/packets/game/c_set_display_chat_preview.rs b/azalea-protocol/src/packets/game/c_set_display_chat_preview.rs new file mode 100755 index 00000000..df2a62d4 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_display_chat_preview.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetDisplayChatPreview { + pub enabled: bool, +} diff --git a/azalea-protocol/src/packets/game/c_set_display_objective.rs b/azalea-protocol/src/packets/game/c_set_display_objective.rs new file mode 100755 index 00000000..12118772 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_display_objective.rs @@ -0,0 +1,31 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetDisplayObjective { + pub slot: DisplaySlot, + pub objective_name: String, +} + +#[derive(Clone, Debug, Copy, AzBuf)] +pub enum DisplaySlot { + List = 0, + Sidebar, + BelowName, + TeamBlack, + TeamDarkBlue, + TeamDarkGreen, + TeamDarkAqua, + TeamDarkRed, + TeamDarkPurple, + TeamGold, + TeamGray, + TeamDarkGray, + TeamBlue, + TeamGreen, + TeamAqua, + TeamRed, + TeamLightPurple, + TeamYellow, + TeamWhite, +} diff --git a/azalea-protocol/src/packets/game/c_set_entity_data.rs b/azalea-protocol/src/packets/game/c_set_entity_data.rs new file mode 100755 index 00000000..da6536fe --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_entity_data.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_entity::EntityMetadataItems; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetEntityData { + #[var] + pub id: u32, + pub packed_items: EntityMetadataItems, +} diff --git a/azalea-protocol/src/packets/game/c_set_entity_link.rs b/azalea-protocol/src/packets/game/c_set_entity_link.rs new file mode 100755 index 00000000..c4ce8bdf --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_entity_link.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetEntityLink { + pub source_id: u32, + pub dest_id: u32, +} diff --git a/azalea-protocol/src/packets/game/c_set_entity_motion.rs b/azalea-protocol/src/packets/game/c_set_entity_motion.rs new file mode 100755 index 00000000..d0dd7698 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_entity_motion.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetEntityMotion { + #[var] + pub id: u32, + pub xa: i16, + pub ya: i16, + pub za: i16, +} diff --git a/azalea-protocol/src/packets/game/c_set_equipment.rs b/azalea-protocol/src/packets/game/c_set_equipment.rs new file mode 100755 index 00000000..637b2b52 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_equipment.rs @@ -0,0 +1,81 @@ +use std::io::Cursor; + +use azalea_buf::{AzBuf, BufReadError}; +use azalea_buf::{AzaleaRead, AzaleaWrite}; +use azalea_inventory::ItemStack; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetEquipment { + #[var] + pub entity_id: u32, + pub slots: EquipmentSlots, +} + +#[derive(Clone, Debug)] +pub struct EquipmentSlots { + pub slots: Vec<(EquipmentSlot, ItemStack)>, +} + +impl AzaleaRead for EquipmentSlots { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let mut slots = vec![]; + + loop { + let equipment_byte = u8::azalea_read(buf)?; + let equipment_slot = + EquipmentSlot::from_byte(equipment_byte & 127).ok_or_else(|| { + BufReadError::UnexpectedEnumVariant { + id: equipment_byte.into(), + } + })?; + let item = ItemStack::azalea_read(buf)?; + slots.push((equipment_slot, item)); + if equipment_byte & 128 == 0 { + break; + }; + } + + Ok(EquipmentSlots { slots }) + } +} +impl AzaleaWrite for EquipmentSlots { + fn azalea_write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { + for i in 0..self.slots.len() { + let (equipment_slot, item) = &self.slots[i]; + let mut equipment_byte = *equipment_slot as u8; + if i != self.slots.len() - 1 { + equipment_byte |= 128; + } + equipment_byte.azalea_write(buf)?; + item.azalea_write(buf)?; + } + + Ok(()) + } +} + +#[derive(Clone, Debug, Copy, AzBuf)] +pub enum EquipmentSlot { + MainHand = 0, + OffHand = 1, + Feet = 2, + Legs = 3, + Chest = 4, + Head = 5, +} + +impl EquipmentSlot { + #[must_use] + pub fn from_byte(byte: u8) -> Option { + match byte { + 0 => Some(EquipmentSlot::MainHand), + 1 => Some(EquipmentSlot::OffHand), + 2 => Some(EquipmentSlot::Feet), + 3 => Some(EquipmentSlot::Legs), + 4 => Some(EquipmentSlot::Chest), + 5 => Some(EquipmentSlot::Head), + _ => None, + } + } +} diff --git a/azalea-protocol/src/packets/game/c_set_experience.rs b/azalea-protocol/src/packets/game/c_set_experience.rs new file mode 100755 index 00000000..c11482a0 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_experience.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetExperience { + pub experience_progress: f32, + #[var] + pub experience_level: u32, + #[var] + pub total_experience: u32, +} diff --git a/azalea-protocol/src/packets/game/c_set_health.rs b/azalea-protocol/src/packets/game/c_set_health.rs new file mode 100755 index 00000000..56f3fe03 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_health.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetHealth { + pub health: f32, + #[var] + pub food: u32, + pub saturation: f32, +} diff --git a/azalea-protocol/src/packets/game/c_set_held_slot.rs b/azalea-protocol/src/packets/game/c_set_held_slot.rs new file mode 100644 index 00000000..81c21651 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_held_slot.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetHeldSlot { + pub slot: u8, +} diff --git a/azalea-protocol/src/packets/game/c_set_objective.rs b/azalea-protocol/src/packets/game/c_set_objective.rs new file mode 100755 index 00000000..7ddb3f71 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_objective.rs @@ -0,0 +1,82 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite}; +use azalea_chat::{numbers::NumberFormat, FormattedText}; +use azalea_core::objectives::ObjectiveCriteria; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetObjective { + pub objective_name: String, + pub method: Method, +} + +#[derive(Clone, Copy, Debug, AzBuf)] +pub enum MethodKind { + Add, + Remove, + Change, +} + +#[derive(Clone, Debug)] +pub enum Method { + Add { + display_name: FormattedText, + render_type: ObjectiveCriteria, + number_format: NumberFormat, + }, + Remove, + Change { + display_name: FormattedText, + render_type: ObjectiveCriteria, + number_format: NumberFormat, + }, +} + +impl AzaleaRead for Method { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let kind = MethodKind::azalea_read(buf)?; + match kind { + MethodKind::Add => Ok(Method::Add { + display_name: FormattedText::azalea_read(buf)?, + render_type: ObjectiveCriteria::azalea_read(buf)?, + number_format: NumberFormat::azalea_read(buf)?, + }), + MethodKind::Remove => Ok(Method::Remove), + MethodKind::Change => Ok(Method::Change { + display_name: FormattedText::azalea_read(buf)?, + render_type: ObjectiveCriteria::azalea_read(buf)?, + number_format: NumberFormat::azalea_read(buf)?, + }), + } + } +} + +impl AzaleaWrite for Method { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + match self { + Method::Add { + display_name, + render_type, + number_format, + } => { + MethodKind::Add.azalea_write(buf)?; + display_name.azalea_write(buf)?; + render_type.azalea_write(buf)?; + number_format.azalea_write(buf)?; + } + Method::Remove => MethodKind::Remove.azalea_write(buf)?, + Method::Change { + display_name, + render_type, + number_format, + } => { + MethodKind::Change.azalea_write(buf)?; + display_name.azalea_write(buf)?; + render_type.azalea_write(buf)?; + number_format.azalea_write(buf)?; + } + } + Ok(()) + } +} diff --git a/azalea-protocol/src/packets/game/c_set_passengers.rs b/azalea-protocol/src/packets/game/c_set_passengers.rs new file mode 100755 index 00000000..76fc3ca0 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_passengers.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetPassengers { + #[var] + pub vehicle: u32, + #[var] + pub passengers: Vec, +} diff --git a/azalea-protocol/src/packets/game/c_set_player_inventory.rs b/azalea-protocol/src/packets/game/c_set_player_inventory.rs new file mode 100644 index 00000000..ca8955ee --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_player_inventory.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_inventory::ItemStack; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetPlayerInventory { + #[var] + pub slot: i32, + pub contents: Option, +} diff --git a/azalea-protocol/src/packets/game/c_set_player_team.rs b/azalea-protocol/src/packets/game/c_set_player_team.rs new file mode 100755 index 00000000..38249cf3 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_player_team.rs @@ -0,0 +1,74 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError}; +use azalea_chat::{style::ChatFormatting, FormattedText}; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetPlayerTeam { + pub name: String, + pub method: Method, +} + +#[derive(Clone, Debug)] +pub enum Method { + Add((Parameters, PlayerList)), + Remove, + Change(Parameters), + Join(PlayerList), + Leave(PlayerList), +} + +impl AzaleaRead for Method { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + Ok(match u8::azalea_read(buf)? { + 0 => Method::Add((Parameters::azalea_read(buf)?, PlayerList::azalea_read(buf)?)), + 1 => Method::Remove, + 2 => Method::Change(Parameters::azalea_read(buf)?), + 3 => Method::Join(PlayerList::azalea_read(buf)?), + 4 => Method::Leave(PlayerList::azalea_read(buf)?), + id => return Err(BufReadError::UnexpectedEnumVariant { id: i32::from(id) }), + }) + } +} + +impl AzaleaWrite for Method { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + match self { + Method::Add((parameters, playerlist)) => { + 0u8.azalea_write(buf)?; + parameters.azalea_write(buf)?; + playerlist.azalea_write(buf)?; + } + Method::Remove => { + 1u8.azalea_write(buf)?; + } + Method::Change(parameters) => { + 2u8.azalea_write(buf)?; + parameters.azalea_write(buf)?; + } + Method::Join(playerlist) => { + 3u8.azalea_write(buf)?; + playerlist.azalea_write(buf)?; + } + Method::Leave(playerlist) => { + 4u8.azalea_write(buf)?; + playerlist.azalea_write(buf)?; + } + } + Ok(()) + } +} + +#[derive(AzBuf, Clone, Debug)] +pub struct Parameters { + pub display_name: FormattedText, + pub options: u8, + pub nametag_visibility: String, + pub collision_rule: String, + pub color: ChatFormatting, + pub player_prefix: FormattedText, + pub player_suffix: FormattedText, +} + +type PlayerList = Vec; diff --git a/azalea-protocol/src/packets/game/c_set_score.rs b/azalea-protocol/src/packets/game/c_set_score.rs new file mode 100755 index 00000000..5a16d134 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_score.rs @@ -0,0 +1,13 @@ +use azalea_buf::AzBuf; +use azalea_chat::{numbers::NumberFormat, FormattedText}; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetScore { + pub owner: String, + pub objective_name: String, + #[var] + pub score: u32, + pub display: Option, + pub number_format: Option, +} diff --git a/azalea-protocol/src/packets/game/c_set_simulation_distance.rs b/azalea-protocol/src/packets/game/c_set_simulation_distance.rs new file mode 100755 index 00000000..2a80d1f1 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_simulation_distance.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetSimulationDistance { + #[var] + pub simulation_distance: u32, +} diff --git a/azalea-protocol/src/packets/game/c_set_subtitle_text.rs b/azalea-protocol/src/packets/game/c_set_subtitle_text.rs new file mode 100755 index 00000000..31405739 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_subtitle_text.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetSubtitleText { + pub text: FormattedText, +} diff --git a/azalea-protocol/src/packets/game/c_set_time.rs b/azalea-protocol/src/packets/game/c_set_time.rs new file mode 100755 index 00000000..b1970eec --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_time.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetTime { + pub game_time: u64, + pub day_time: u64, + pub tick_day_time: bool, +} diff --git a/azalea-protocol/src/packets/game/c_set_title_text.rs b/azalea-protocol/src/packets/game/c_set_title_text.rs new file mode 100755 index 00000000..4ef3e590 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_title_text.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetTitleText { + pub text: FormattedText, +} diff --git a/azalea-protocol/src/packets/game/c_set_titles_animation.rs b/azalea-protocol/src/packets/game/c_set_titles_animation.rs new file mode 100755 index 00000000..cc0c37fc --- /dev/null +++ b/azalea-protocol/src/packets/game/c_set_titles_animation.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSetTitlesAnimation { + pub fade_in: u32, + pub stay: u32, + pub fade_out: u32, +} diff --git a/azalea-protocol/src/packets/game/c_sound.rs b/azalea-protocol/src/packets/game/c_sound.rs new file mode 100755 index 00000000..77161769 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_sound.rs @@ -0,0 +1,29 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; +use azalea_registry::SoundEvent; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSound { + pub sound: SoundEvent, + pub source: SoundSource, + pub x: i32, + pub y: i32, + pub z: i32, + pub volume: f32, + pub pitch: f32, + pub seed: u64, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum SoundSource { + Master = 0, + Music = 1, + Records = 2, + Weather = 3, + Blocks = 4, + Hostile = 5, + Neutral = 6, + Players = 7, + Ambient = 8, + Voice = 9, +} diff --git a/azalea-protocol/src/packets/game/c_sound_entity.rs b/azalea-protocol/src/packets/game/c_sound_entity.rs new file mode 100755 index 00000000..96b22cb8 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_sound_entity.rs @@ -0,0 +1,27 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundSoundEntity { + pub source: SoundSource, + #[var] + pub id: u32, + pub volume: f32, + pub pitch: f32, + #[var] + pub seed: u64, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum SoundSource { + Master = 0, + Music = 1, + Records = 2, + Weather = 3, + Blocks = 4, + Hostile = 5, + Neutral = 6, + Players = 7, + Ambient = 8, + Voice = 9, +} diff --git a/azalea-protocol/src/packets/game/c_start_configuration.rs b/azalea-protocol/src/packets/game/c_start_configuration.rs new file mode 100644 index 00000000..6955b70d --- /dev/null +++ b/azalea-protocol/src/packets/game/c_start_configuration.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundStartConfiguration {} diff --git a/azalea-protocol/src/packets/game/c_stop_sound.rs b/azalea-protocol/src/packets/game/c_stop_sound.rs new file mode 100755 index 00000000..0a01fa71 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_stop_sound.rs @@ -0,0 +1,51 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{BufReadError, AzaleaRead, AzaleaWrite}; +use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation}; +use azalea_protocol_macros::ClientboundGamePacket; + +use super::c_sound::SoundSource; + +#[derive(Clone, Debug, ClientboundGamePacket)] +pub struct ClientboundStopSound { + pub source: Option, + pub name: Option, +} + +impl AzaleaRead for ClientboundStopSound { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let set = FixedBitSet::<2>::azalea_read(buf)?; + let source = if set.index(0) { + Some(SoundSource::azalea_read(buf)?) + } else { + None + }; + let name = if set.index(1) { + Some(ResourceLocation::azalea_read(buf)?) + } else { + None + }; + + Ok(Self { source, name }) + } +} + +impl AzaleaWrite for ClientboundStopSound { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let mut set = FixedBitSet::<2>::new(); + if self.source.is_some() { + set.set(0); + } + if self.name.is_some() { + set.set(1); + } + set.azalea_write(buf)?; + if let Some(source) = &self.source { + source.azalea_write(buf)?; + } + if let Some(name) = &self.name { + name.azalea_write(buf)?; + } + Ok(()) + } +} diff --git a/azalea-protocol/src/packets/game/c_store_cookie.rs b/azalea-protocol/src/packets/game/c_store_cookie.rs new file mode 100644 index 00000000..a1deee4f --- /dev/null +++ b/azalea-protocol/src/packets/game/c_store_cookie.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundStoreCookie { + pub key: ResourceLocation, + pub payload: Vec, +} diff --git a/azalea-protocol/src/packets/game/c_system_chat.rs b/azalea-protocol/src/packets/game/c_system_chat.rs new file mode 100755 index 00000000..14dfdcbf --- /dev/null +++ b/azalea-protocol/src/packets/game/c_system_chat.rs @@ -0,0 +1,45 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket, PartialEq)] +pub struct ClientboundSystemChat { + pub content: FormattedText, + pub overlay: bool, +} + +#[cfg(test)] +mod tests { + use std::io::Cursor; + + use azalea_buf::AzaleaRead; + + use super::*; + + #[test] + fn test_c_system_chat_packet() { + #[rustfmt::skip] + let bytes = [ + 10, 9, 0, 4, 119, 105, 116, 104, 10, 0, 0, 0, 2, 10, 0, 10, 104, 111, 118, 101, 114, 69, 118, 101, 110, 116, 10, 0, 8, 99, 111, 110, 116, 101, 110, 116, 115, 8, 0, 4, 110, 97, 109, 101, 0, 3, 112, 121, 53, 11, 0, 2, 105, 100, 0, 0, 0, 4, 101, 54, 191, 237, 134, 149, 72, 253, 131, 161, 236, 210, 76, 242, 160, 253, 8, 0, 4, 116, 121, 112, 101, 0, 16, 109, 105, 110, 101, 99, 114, 97, 102, 116, 58, 112, 108, 97, 121, 101, 114, 0, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 11, 115, 104, 111, 119, 95, 101, 110, 116, 105, 116, 121, 0, 10, 0, 10, 99, 108, 105, 99, 107, 69, 118, 101, 110, 116, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 15, 115, 117, 103, 103, 101, 115, 116, 95, 99, 111, 109, 109, 97, 110, 100, 8, 0, 5, 118, 97, 108, 117, 101, 0, 10, 47, 116, 101, 108, 108, 32, 112, 121, 53, 32, 0, 8, 0, 9, 105, 110, 115, 101, 114, 116, 105, 111, 110, 0, 3, 112, 121, 53, 8, 0, 4, 116, 101, 120, 116, 0, 3, 112, 121, 53, 0, 9, 0, 4, 119, 105, 116, 104, 10, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 1, 0, 10, 0, 10, 104, 111, 118, 101, 114, 69, 118, 101, 110, 116, 10, 0, 8, 99, 111, 110, 116, 101, 110, 116, 115, 8, 0, 2, 105, 100, 0, 25, 109, 105, 110, 101, 99, 114, 97, 102, 116, 58, 100, 105, 97, 109, 111, 110, 100, 95, 112, 105, 99, 107, 97, 120, 101, 8, 0, 3, 116, 97, 103, 0, 10, 123, 68, 97, 109, 97, 103, 101, 58, 48, 125, 0, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 9, 115, 104, 111, 119, 95, 105, 116, 101, 109, 0, 9, 0, 4, 119, 105, 116, 104, 10, 0, 0, 0, 1, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 8, 0, 9, 116, 114, 97, 110, 115, 108, 97, 116, 101, 0, 30, 105, 116, 101, 109, 46, 109, 105, 110, 101, 99, 114, 97, 102, 116, 46, 100, 105, 97, 109, 111, 110, 100, 95, 112, 105, 99, 107, 97, 120, 101, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 8, 0, 9, 116, 114, 97, 110, 115, 108, 97, 116, 101, 0, 20, 99, 104, 97, 116, 46, 115, 113, 117, 97, 114, 101, 95, 98, 114, 97, 99, 107, 101, 116, 115, 0, 10, 0, 10, 104, 111, 118, 101, 114, 69, 118, 101, 110, 116, 10, 0, 8, 99, 111, 110, 116, 101, 110, 116, 115, 8, 0, 4, 110, 97, 109, 101, 0, 3, 112, 121, 53, 11, 0, 2, 105, 100, 0, 0, 0, 4, 101, 54, 191, 237, 134, 149, 72, 253, 131, 161, 236, 210, 76, 242, 160, 253, 8, 0, 4, 116, 121, 112, 101, 0, 16, 109, 105, 110, 101, 99, 114, 97, 102, 116, 58, 112, 108, 97, 121, 101, 114, 0, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 11, 115, 104, 111, 119, 95, 101, 110, 116, 105, 116, 121, 0, 10, 0, 10, 99, 108, 105, 99, 107, 69, 118, 101, 110, 116, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 15, 115, 117, 103, 103, 101, 115, 116, 95, 99, 111, 109, 109, 97, 110, 100, 8, 0, 5, 118, 97, 108, 117, 101, 0, 10, 47, 116, 101, 108, 108, 32, 112, 121, 53, 32, 0, 8, 0, 9, 105, 110, 115, 101, 114, 116, 105, 111, 110, 0, 3, 112, 121, 53, 8, 0, 4, 116, 101, 120, 116, 0, 3, 112, 121, 53, 0, 8, 0, 9, 116, 114, 97, 110, 115, 108, 97, 116, 101, 0, 28, 99, 111, 109, 109, 97, 110, 100, 115, 46, 103, 105, 118, 101, 46, 115, 117, 99, 99, 101, 115, 115, 46, 115, 105, 110, 103, 108, 101, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 114, 97, 121, 1, 0, 6, 105, 116, 97, 108, 105, 99, 1, 8, 0, 9, 116, 114, 97, 110, 115, 108, 97, 116, 101, 0, 15, 99, 104, 97, 116, 46, 116, 121, 112, 101, 46, 97, 100, 109, 105, 110, 0, 0 + ]; + + let packet = ClientboundSystemChat::azalea_read(&mut Cursor::new(&bytes)).unwrap(); + assert_eq!( + packet.content.to_string(), + "[py5: Gave 1 [Diamond Pickaxe] to py5]".to_string() + ); + } + + #[test] + fn test_translate_with_string_array_c_system_chat_packet() { + #[rustfmt::skip] + let bytes = [ + 10, 9, 0, 4, 119, 105, 116, 104, 8, 0, 0, 0, 1, 0, 14, 109, 105, 110, 101, 99, 114, 97, 102, 116, 58, 100, 117, 115, 116, 8, 0, 9, 116, 114, 97, 110, 115, 108, 97, 116, 101, 0, 25, 99, 111, 109, 109, 97, 110, 100, 115, 46, 112, 97, 114, 116, 105, 99, 108, 101, 46, 115, 117, 99, 99, 101, 115, 115, 0, 0 + ]; + let packet = ClientboundSystemChat::azalea_read(&mut Cursor::new(&bytes)).unwrap(); + assert_eq!( + packet.content.to_string(), + "Displaying particle minecraft:dust".to_string() + ); + } +} diff --git a/azalea-protocol/src/packets/game/c_tab_list.rs b/azalea-protocol/src/packets/game/c_tab_list.rs new file mode 100755 index 00000000..268351da --- /dev/null +++ b/azalea-protocol/src/packets/game/c_tab_list.rs @@ -0,0 +1,28 @@ +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundTabList { + pub header: FormattedText, + pub footer: FormattedText, +} + +#[cfg(test)] +mod tests { + use std::io::Cursor; + + use azalea_buf::AzaleaRead; + + use super::*; + + #[test] + fn test_packet_from_viaversion() { + #[rustfmt::skip] + let mut bytes = Cursor::new(&[ + 10, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 3, 1, 0, 4, 98, 111, 108, 100, 1, 8, 0, 4, 116, 101, 120, 116, 0, 16, 50, 66, 85, 73, 76, 68, 69, 82, 83, 50, 84, 79, 79, 76, 83, 10, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 114, 97, 121, 0, 8, 0, 0, 0, 1, 10, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 111, 108, 100, 8, 0, 4, 116, 101, 120, 116, 0, 27, 80, 101, 110, 100, 105, 110, 103, 32, 99, 111, 110, 110, 101, 99, 116, 105, 111, 110, 32, 116, 111, 32, 50, 98, 50, 116, 10, 0, 8, 0, 4, 116, 101, 120, 116, 0, 1, 10, 0, 10, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 111, 108, 100, 8, 0, 4, 116, 101, 120, 116, 0, 72, 84, 104, 105, 115, 32, 97, 99, 99, 111, 117, 110, 116, 32, 104, 97, 115, 32, 112, 114, 105, 111, 114, 105, 116, 121, 32, 115, 116, 97, 116, 117, 115, 32, 97, 110, 100, 32, 119, 105, 108, 108, 32, 98, 101, 32, 112, 108, 97, 99, 101, 100, 32, 105, 110, 32, 97, 32, 115, 104, 111, 114, 116, 101, 114, 32, 113, 117, 101, 117, 101, 46, 10, 0, 8, 0, 4, 116, 101, 120, 116, 0, 1, 10, 0 + ][..]); + let _packet = ClientboundTabList::azalea_read(&mut bytes).unwrap(); + assert!(bytes.get_ref()[bytes.position() as usize..].is_empty()); + } +} diff --git a/azalea-protocol/src/packets/game/c_tag_query.rs b/azalea-protocol/src/packets/game/c_tag_query.rs new file mode 100755 index 00000000..efd94e32 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_tag_query.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; +use simdnbt::owned::NbtTag; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundTagQuery { + #[var] + pub transaction_id: u32, + pub tag: NbtTag, +} diff --git a/azalea-protocol/src/packets/game/c_take_item_entity.rs b/azalea-protocol/src/packets/game/c_take_item_entity.rs new file mode 100755 index 00000000..0dfc8552 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_take_item_entity.rs @@ -0,0 +1,12 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundTakeItemEntity { + #[var] + pub item_id: u32, + #[var] + pub player_id: u32, + #[var] + pub amount: u32, +} diff --git a/azalea-protocol/src/packets/game/c_teleport_entity.rs b/azalea-protocol/src/packets/game/c_teleport_entity.rs new file mode 100755 index 00000000..0f026133 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_teleport_entity.rs @@ -0,0 +1,13 @@ +use azalea_buf::AzBuf; +use azalea_core::position::Vec3; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundTeleportEntity { + #[var] + pub id: u32, + pub position: Vec3, + pub y_rot: i8, + pub x_rot: i8, + pub on_ground: bool, +} diff --git a/azalea-protocol/src/packets/game/c_ticking_state.rs b/azalea-protocol/src/packets/game/c_ticking_state.rs new file mode 100644 index 00000000..3e4e11c2 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_ticking_state.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundTickingState { + pub tick_rate: f32, + pub is_frozen: bool, +} diff --git a/azalea-protocol/src/packets/game/c_ticking_step.rs b/azalea-protocol/src/packets/game/c_ticking_step.rs new file mode 100644 index 00000000..0a151134 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_ticking_step.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundTickingStep { + #[var] + pub tick_steps: u32, +} diff --git a/azalea-protocol/src/packets/game/c_transfer.rs b/azalea-protocol/src/packets/game/c_transfer.rs new file mode 100644 index 00000000..ad7de333 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_transfer.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundTransfer { + pub host: String, + #[var] + pub port: u32, +} diff --git a/azalea-protocol/src/packets/game/c_update_advancements.rs b/azalea-protocol/src/packets/game/c_update_advancements.rs new file mode 100755 index 00000000..cd0c0b98 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_update_advancements.rs @@ -0,0 +1,205 @@ +use std::collections::HashMap; +use std::io::Cursor; + +use azalea_buf::AzBuf; +use azalea_chat::FormattedText; +use azalea_core::resource_location::ResourceLocation; +use azalea_inventory::ItemStack; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundUpdateAdvancements { + pub reset: bool, + pub added: Vec, + pub removed: Vec, + pub progress: HashMap, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct Advancement { + pub parent_id: Option, + pub display: Option, + pub requirements: Vec>, + pub sends_telemetry_event: bool, +} + +#[derive(Clone, Debug)] +pub struct DisplayInfo { + pub title: FormattedText, + pub description: FormattedText, + pub icon: ItemStack, + pub frame: FrameType, + pub show_toast: bool, + pub hidden: bool, + pub background: Option, + pub x: f32, + pub y: f32, +} + +impl azalea_buf::AzaleaWrite for DisplayInfo { + fn azalea_write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { + self.title.azalea_write(buf)?; + self.description.azalea_write(buf)?; + self.icon.azalea_write(buf)?; + self.frame.azalea_write(buf)?; + + let mut data: u32 = 0; + if self.background.is_some() { + data |= 0b001; + } + if self.show_toast { + data |= 0b010; + } + if self.hidden { + data |= 0b100; + } + data.azalea_write(buf)?; + + if let Some(background) = &self.background { + background.azalea_write(buf)?; + } + self.x.azalea_write(buf)?; + self.y.azalea_write(buf)?; + Ok(()) + } +} +impl azalea_buf::AzaleaRead for DisplayInfo { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let title = azalea_buf::AzaleaRead::azalea_read(buf)?; + let description = azalea_buf::AzaleaRead::azalea_read(buf)?; + let icon = azalea_buf::AzaleaRead::azalea_read(buf)?; + let frame = azalea_buf::AzaleaRead::azalea_read(buf)?; + + let data = u32::azalea_read(buf)?; + let has_background = (data & 0b1) != 0; + let show_toast = (data & 0b10) != 0; + let hidden = (data & 0b100) != 0; + + let background = if has_background { + Some(ResourceLocation::azalea_read(buf)?) + } else { + None + }; + let x = azalea_buf::AzaleaRead::azalea_read(buf)?; + let y = azalea_buf::AzaleaRead::azalea_read(buf)?; + Ok(DisplayInfo { + title, + description, + icon, + frame, + show_toast, + hidden, + background, + x, + y, + }) + } +} + +#[derive(Clone, Debug, Copy, AzBuf)] +pub enum FrameType { + Task = 0, + Challenge = 1, + Goal = 2, +} + +pub type AdvancementProgress = HashMap; + +#[derive(Clone, Debug, AzBuf)] +pub struct CriterionProgress { + pub date: Option, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct AdvancementHolder { + pub id: ResourceLocation, + pub value: Advancement, +} + +#[cfg(test)] +mod tests { + use azalea_buf::{AzaleaRead, AzaleaWrite}; + + use super::*; + + #[test] + fn test() { + let packet = ClientboundUpdateAdvancements { + reset: true, + added: [AdvancementHolder { + id: ResourceLocation::new("minecraft:test"), + value: Advancement { + parent_id: None, + display: Some(DisplayInfo { + title: FormattedText::from("title".to_string()), + description: FormattedText::from("description".to_string()), + icon: ItemStack::Empty, + frame: FrameType::Task, + show_toast: true, + hidden: false, + background: None, + x: 0.0, + y: 0.0, + }), + requirements: Vec::new(), + sends_telemetry_event: false, + }, + }] + .into_iter() + .collect(), + removed: vec![ResourceLocation::new("minecraft:test2")], + progress: [( + ResourceLocation::new("minecraft:test3"), + [( + "minecraft:test4".to_string(), + CriterionProgress { + date: Some(123456789), + }, + )] + .into_iter() + .collect(), + )] + .into_iter() + .collect(), + }; + + let mut data = Vec::new(); + packet.azalea_write(&mut data).unwrap(); + let mut buf: Cursor<&[u8]> = Cursor::new(&data); + + let read_packet = ClientboundUpdateAdvancements::azalea_read(&mut buf).unwrap(); + assert_eq!(packet.reset, read_packet.reset); + assert_eq!(packet.removed, read_packet.removed); + + let advancement = packet + .added + .into_iter() + .find_map(|a| { + if a.id == ResourceLocation::new("minecraft:test") { + Some(a.value) + } else { + None + } + }) + .unwrap() + .clone(); + let read_advancement = read_packet + .added + .into_iter() + .find_map(|a| { + if a.id == ResourceLocation::new("minecraft:test") { + Some(a.value) + } else { + None + } + }) + .unwrap() + .clone(); + assert_eq!(advancement.parent_id, read_advancement.parent_id); + + let display = advancement.display.unwrap(); + let read_display = read_advancement.display.unwrap(); + assert_eq!(display.title, read_display.title); + assert_eq!(display.description, read_display.description); + } +} diff --git a/azalea-protocol/src/packets/game/c_update_attributes.rs b/azalea-protocol/src/packets/game/c_update_attributes.rs new file mode 100755 index 00000000..2b800643 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_update_attributes.rs @@ -0,0 +1,18 @@ +use azalea_buf::AzBuf; +use azalea_entity::attributes::AttributeModifier; +use azalea_protocol_macros::ClientboundGamePacket; +use azalea_registry::Attribute; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundUpdateAttributes { + #[var] + pub entity_id: u32, + pub values: Vec, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct AttributeSnapshot { + pub attribute: Attribute, + pub base: f64, + pub modifiers: Vec, +} diff --git a/azalea-protocol/src/packets/game/c_update_enabled_features.rs b/azalea-protocol/src/packets/game/c_update_enabled_features.rs new file mode 100644 index 00000000..d4dac483 --- /dev/null +++ b/azalea-protocol/src/packets/game/c_update_enabled_features.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundUpdateEnabledFeatures { + pub features: Vec, +} diff --git a/azalea-protocol/src/packets/game/c_update_mob_effect.rs b/azalea-protocol/src/packets/game/c_update_mob_effect.rs new file mode 100755 index 00000000..6a31ccab --- /dev/null +++ b/azalea-protocol/src/packets/game/c_update_mob_effect.rs @@ -0,0 +1,15 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundGamePacket; +use azalea_registry::MobEffect; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundUpdateMobEffect { + #[var] + pub entity_id: u32, + pub mob_effect: MobEffect, + #[var] + pub effect_amplifier: u32, + #[var] + pub effect_duration_ticks: u32, + pub flags: u8, +} diff --git a/azalea-protocol/src/packets/game/c_update_recipes.rs b/azalea-protocol/src/packets/game/c_update_recipes.rs new file mode 100755 index 00000000..38c4f37b --- /dev/null +++ b/azalea-protocol/src/packets/game/c_update_recipes.rs @@ -0,0 +1,74 @@ +use std::collections::HashMap; + +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_inventory::ItemStack; +use azalea_protocol_macros::ClientboundGamePacket; +use azalea_registry::HolderSet; + +#[derive(Clone, Debug, PartialEq, AzBuf, ClientboundGamePacket)] +pub struct ClientboundUpdateRecipes { + pub item_sets: HashMap, + pub stonecutter_recipes: Vec, +} + +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub struct SingleInputEntry { + pub input: Ingredient, + pub recipe: SelectableRecipe, +} +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub struct SelectableRecipe { + pub option_display: SlotDisplayData, +} + +/// [`azalea_registry::SlotDisplay`] +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub enum SlotDisplayData { + Empty, + AnyFuel, + Item(ItemStackDisplay), + ItemStack(ItemStackSlotDisplay), + Tag(ResourceLocation), + SmithingTrim(Box), + WithRemainder(Box), + Composite(CompositeSlotDisplay), +} + +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub struct ItemStackDisplay { + pub item: azalea_registry::Item, +} +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub struct ItemStackSlotDisplay { + pub stack: ItemStack, +} +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub struct TagSlotDisplay { + pub tag: azalea_registry::Item, +} +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub struct SmithingTrimDemoSlotDisplay { + pub base: SlotDisplayData, + pub material: SlotDisplayData, + pub pattern: SlotDisplayData, +} +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub struct WithRemainderSlotDisplay { + pub input: SlotDisplayData, + pub remainder: SlotDisplayData, +} +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub struct CompositeSlotDisplay { + pub contents: Vec, +} + +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub struct RecipePropertySet { + pub items: Vec, +} + +#[derive(Clone, Debug, PartialEq, AzBuf)] +pub struct Ingredient { + pub allowed: HolderSet, +} diff --git a/azalea-protocol/src/packets/game/c_update_tags.rs b/azalea-protocol/src/packets/game/c_update_tags.rs new file mode 100755 index 00000000..4b63ec8f --- /dev/null +++ b/azalea-protocol/src/packets/game/c_update_tags.rs @@ -0,0 +1,74 @@ +use std::io::Cursor; +use std::ops::Deref; +use std::{collections::HashMap, io::Write}; + +use azalea_buf::{AzBuf, AzaleaReadVar, AzaleaWriteVar, BufReadError}; +use azalea_buf::{AzaleaRead, AzaleaWrite}; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] +pub struct ClientboundUpdateTags { + pub tags: TagMap, +} + +#[derive(Clone, Debug)] +pub struct Tags { + pub name: ResourceLocation, + pub elements: Vec, +} + +#[derive(Clone, Debug)] +pub struct TagMap(pub HashMap>); + +impl AzaleaRead for TagMap { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let length = u32::azalea_read_var(buf)? as usize; + let mut data = HashMap::with_capacity(length); + for _ in 0..length { + let tag_type = ResourceLocation::azalea_read(buf)?; + let tags_count = i32::azalea_read_var(buf)? as usize; + let mut tags_vec = Vec::with_capacity(tags_count); + for _ in 0..tags_count { + let tags = Tags::azalea_read(buf)?; + tags_vec.push(tags); + } + data.insert(tag_type, tags_vec); + } + Ok(TagMap(data)) + } +} + +impl AzaleaWrite for TagMap { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + (self.len() as u32).azalea_write_var(buf)?; + for (k, v) in &self.0 { + k.azalea_write(buf)?; + v.azalea_write(buf)?; + } + Ok(()) + } +} +impl AzaleaRead for Tags { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let name = ResourceLocation::azalea_read(buf)?; + let elements = Vec::::azalea_read_var(buf)?; + Ok(Tags { name, elements }) + } +} + +impl AzaleaWrite for Tags { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + self.name.azalea_write(buf)?; + self.elements.azalea_write_var(buf)?; + Ok(()) + } +} + +impl Deref for TagMap { + type Target = HashMap>; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} diff --git a/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs b/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs deleted file mode 100755 index 6b62df19..00000000 --- a/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs +++ /dev/null @@ -1,37 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::{position::Vec3, resource_location::ResourceLocation}; -use azalea_entity::{metadata::apply_default_metadata, EntityBundle}; -use azalea_protocol_macros::ClientboundGamePacket; -use uuid::Uuid; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundAddEntityPacket { - /// The id of the entity. - #[var] - pub id: u32, - pub uuid: Uuid, - pub entity_type: azalea_registry::EntityKind, - pub position: Vec3, - pub x_rot: i8, - pub y_rot: i8, - pub y_head_rot: i8, - #[var] - pub data: u32, - pub x_vel: i16, - pub y_vel: i16, - pub z_vel: i16, -} - -impl ClientboundAddEntityPacket { - /// Make the entity into a bundle that can be inserted into the ECS. You - /// must apply the metadata after inserting the bundle with - /// [`Self::apply_metadata`]. - pub fn as_entity_bundle(&self, world_name: ResourceLocation) -> EntityBundle { - EntityBundle::new(self.uuid, self.position, self.entity_type, world_name) - } - - /// Apply the default metadata for the given entity. - pub fn apply_metadata(&self, entity: &mut bevy_ecs::system::EntityCommands) { - apply_default_metadata(entity, self.entity_type); - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_add_experience_orb_packet.rs b/azalea-protocol/src/packets/game/clientbound_add_experience_orb_packet.rs deleted file mode 100755 index 84edcae6..00000000 --- a/azalea-protocol/src/packets/game/clientbound_add_experience_orb_packet.rs +++ /dev/null @@ -1,12 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundAddExperienceOrbPacket { - #[var] - pub id: u32, - pub x: f64, - pub y: f64, - pub z: f64, - pub value: u16, -} diff --git a/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs b/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs deleted file mode 100755 index 45ab4584..00000000 --- a/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs +++ /dev/null @@ -1,27 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::{ResourceLocation, Vec3}; -use azalea_entity::{metadata::PlayerMetadataBundle, EntityBundle, PlayerBundle}; -use azalea_protocol_macros::ClientboundGamePacket; -use azalea_registry::EntityKind; -use uuid::Uuid; - -/// This packet is sent by the server when a player comes into visible range, -/// not when a player joins. -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundAddPlayerPacket { - #[var] - pub id: u32, - pub uuid: Uuid, - pub position: Vec3, - pub x_rot: i8, - pub y_rot: i8, -} - -impl ClientboundAddPlayerPacket { - pub fn as_player_bundle(&self, world_name: ResourceLocation) -> PlayerBundle { - PlayerBundle { - entity: EntityBundle::new(self.uuid, self.position, EntityKind::Player, world_name), - metadata: PlayerMetadataBundle::default(), - } - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_animate_packet.rs b/azalea-protocol/src/packets/game/clientbound_animate_packet.rs deleted file mode 100755 index 8c99b1b7..00000000 --- a/azalea-protocol/src/packets/game/clientbound_animate_packet.rs +++ /dev/null @@ -1,21 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundAnimatePacket { - #[var] - pub id: u32, - pub action: AnimationAction, -} - -// minecraft actually uses a u8 for this, but a varint still works and makes it -// so i don't have to add a special handler -#[derive(Clone, Debug, Copy, McBuf)] -pub enum AnimationAction { - SwingMainHand = 0, - Hurt = 1, - WakeUp = 2, - SwingOffHand = 3, - CriticalHit = 4, - MagicCriticalHit = 5, -} diff --git a/azalea-protocol/src/packets/game/clientbound_award_stats_packet.rs b/azalea-protocol/src/packets/game/clientbound_award_stats_packet.rs deleted file mode 100755 index 32e2c8aa..00000000 --- a/azalea-protocol/src/packets/game/clientbound_award_stats_packet.rs +++ /dev/null @@ -1,23 +0,0 @@ -use std::collections::HashMap; - -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundAwardStatsPacket { - #[var] - pub stats: HashMap, -} - -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, McBuf)] -pub enum Stat { - Mined(azalea_registry::Block), - Crafted(azalea_registry::Item), - Used(azalea_registry::Item), - Broken(azalea_registry::Item), - PickedUp(azalea_registry::Item), - Dropped(azalea_registry::Item), - Killed(azalea_registry::EntityKind), - KilledBy(azalea_registry::EntityKind), - Custom(azalea_registry::CustomStat), -} diff --git a/azalea-protocol/src/packets/game/clientbound_block_changed_ack_packet.rs b/azalea-protocol/src/packets/game/clientbound_block_changed_ack_packet.rs deleted file mode 100755 index e9e57c8d..00000000 --- a/azalea-protocol/src/packets/game/clientbound_block_changed_ack_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundBlockChangedAckPacket { - #[var] - pub sequence: i32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_block_destruction_packet.rs b/azalea-protocol/src/packets/game/clientbound_block_destruction_packet.rs deleted file mode 100755 index 130c698e..00000000 --- a/azalea-protocol/src/packets/game/clientbound_block_destruction_packet.rs +++ /dev/null @@ -1,13 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::position::BlockPos; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundBlockDestructionPacket { - /// The ID of the entity breaking the block. - #[var] - pub id: u32, - pub pos: BlockPos, - /// 0–9 to set it, any other value to remove it. - pub progress: u8, -} diff --git a/azalea-protocol/src/packets/game/clientbound_block_entity_data_packet.rs b/azalea-protocol/src/packets/game/clientbound_block_entity_data_packet.rs deleted file mode 100755 index 3406a75f..00000000 --- a/azalea-protocol/src/packets/game/clientbound_block_entity_data_packet.rs +++ /dev/null @@ -1,11 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::position::BlockPos; -use azalea_protocol_macros::ClientboundGamePacket; -use simdnbt::owned::Nbt; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundBlockEntityDataPacket { - pub pos: BlockPos, - pub block_entity_type: azalea_registry::BlockEntityKind, - pub tag: Nbt, -} diff --git a/azalea-protocol/src/packets/game/clientbound_block_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_block_event_packet.rs deleted file mode 100755 index 86f57b97..00000000 --- a/azalea-protocol/src/packets/game/clientbound_block_event_packet.rs +++ /dev/null @@ -1,12 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::position::BlockPos; -use azalea_protocol_macros::ClientboundGamePacket; -use azalea_registry::Block; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundBlockEventPacket { - pub pos: BlockPos, - pub action_id: u8, - pub action_parameter: u8, - pub block: Block, -} diff --git a/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs b/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs deleted file mode 100755 index c1869e74..00000000 --- a/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_block::BlockState; -use azalea_buf::McBuf; -use azalea_core::position::BlockPos; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundBlockUpdatePacket { - pub pos: BlockPos, - pub block_state: BlockState, -} diff --git a/azalea-protocol/src/packets/game/clientbound_boss_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_boss_event_packet.rs deleted file mode 100755 index 65240edf..00000000 --- a/azalea-protocol/src/packets/game/clientbound_boss_event_packet.rs +++ /dev/null @@ -1,145 +0,0 @@ -use std::io::Cursor; -use std::io::Write; - -use azalea_buf::{ - BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, -}; -use azalea_chat::FormattedText; -use azalea_core::bitset::FixedBitSet; -use azalea_protocol_macros::ClientboundGamePacket; -use uuid::Uuid; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundBossEventPacket { - pub id: Uuid, - pub operation: Operation, -} - -#[derive(Clone, Debug)] -pub enum Operation { - Add(AddOperation), - Remove, - UpdateProgress(f32), - UpdateName(FormattedText), - UpdateStyle(Style), - UpdateProperties(Properties), -} - -impl McBufReadable for Operation { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let operation_id = u32::var_read_from(buf)?; - Ok(match operation_id { - 0 => Operation::Add(AddOperation::read_from(buf)?), - 1 => Operation::Remove, - 2 => Operation::UpdateProgress(f32::read_from(buf)?), - 3 => Operation::UpdateName(FormattedText::read_from(buf)?), - 4 => Operation::UpdateStyle(Style::read_from(buf)?), - 5 => Operation::UpdateProperties(Properties::read_from(buf)?), - _ => { - return Err(BufReadError::UnexpectedEnumVariant { - id: operation_id as i32, - }) - } - }) - } -} - -impl McBufWritable for Operation { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - match self { - Operation::Add(add) => { - 0u32.var_write_into(buf)?; - add.write_into(buf)?; - } - Operation::Remove => { - 1u32.var_write_into(buf)?; - } - Operation::UpdateProgress(progress) => { - 2u32.var_write_into(buf)?; - progress.write_into(buf)?; - } - Operation::UpdateName(name) => { - 3u32.var_write_into(buf)?; - name.write_into(buf)?; - } - Operation::UpdateStyle(style) => { - 4u32.var_write_into(buf)?; - style.write_into(buf)?; - } - Operation::UpdateProperties(properties) => { - 5u32.var_write_into(buf)?; - properties.write_into(buf)?; - } - } - Ok(()) - } -} - -#[derive(Clone, Debug, McBuf)] -pub struct AddOperation { - pub name: FormattedText, - pub progress: f32, - pub style: Style, - pub properties: Properties, -} - -#[derive(Clone, Debug, McBuf)] -pub struct Style { - pub color: BossBarColor, - pub overlay: BossBarOverlay, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum BossBarColor { - Pink = 0, - Blue = 1, - Red = 2, - Green = 3, - Yellow = 4, - Purple = 5, - White = 6, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum BossBarOverlay { - Progress = 0, - Notched6 = 1, - Notched10 = 2, - Notched12 = 3, - Notched20 = 4, -} - -#[derive(Clone, Debug)] -pub struct Properties { - pub darken_screen: bool, - pub play_music: bool, - pub create_world_fog: bool, -} - -impl McBufReadable for Properties { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let set = FixedBitSet::<3>::read_from(buf)?; - Ok(Self { - darken_screen: set.index(0), - play_music: set.index(1), - create_world_fog: set.index(2), - }) - } -} - -impl McBufWritable for Properties { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - let mut set = FixedBitSet::<3>::new(); - if self.darken_screen { - set.set(0); - } - if self.play_music { - set.set(1); - } - if self.create_world_fog { - set.set(2); - } - set.write_into(buf)?; - Ok(()) - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_bundle_packet.rs b/azalea-protocol/src/packets/game/clientbound_bundle_packet.rs deleted file mode 100644 index cad2eca3..00000000 --- a/azalea-protocol/src/packets/game/clientbound_bundle_packet.rs +++ /dev/null @@ -1,5 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundBundlePacket {} diff --git a/azalea-protocol/src/packets/game/clientbound_change_difficulty_packet.rs b/azalea-protocol/src/packets/game/clientbound_change_difficulty_packet.rs deleted file mode 100755 index e7dafbeb..00000000 --- a/azalea-protocol/src/packets/game/clientbound_change_difficulty_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::difficulty::Difficulty; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundChangeDifficultyPacket { - pub difficulty: Difficulty, - pub locked: bool, -} diff --git a/azalea-protocol/src/packets/game/clientbound_chat_preview_packet.rs b/azalea-protocol/src/packets/game/clientbound_chat_preview_packet.rs deleted file mode 100755 index 40f28259..00000000 --- a/azalea-protocol/src/packets/game/clientbound_chat_preview_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundChatPreviewPacket { - pub query_id: i32, - pub preview: Option, -} diff --git a/azalea-protocol/src/packets/game/clientbound_chunk_batch_finished_packet.rs b/azalea-protocol/src/packets/game/clientbound_chunk_batch_finished_packet.rs deleted file mode 100644 index 27bc2f25..00000000 --- a/azalea-protocol/src/packets/game/clientbound_chunk_batch_finished_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundChunkBatchFinishedPacket { - #[var] - pub batch_size: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_chunk_batch_start_packet.rs b/azalea-protocol/src/packets/game/clientbound_chunk_batch_start_packet.rs deleted file mode 100644 index 308ba8c9..00000000 --- a/azalea-protocol/src/packets/game/clientbound_chunk_batch_start_packet.rs +++ /dev/null @@ -1,5 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundChunkBatchStartPacket {} diff --git a/azalea-protocol/src/packets/game/clientbound_chunks_biomes_packet.rs b/azalea-protocol/src/packets/game/clientbound_chunks_biomes_packet.rs deleted file mode 100644 index 7c8f2154..00000000 --- a/azalea-protocol/src/packets/game/clientbound_chunks_biomes_packet.rs +++ /dev/null @@ -1,14 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::position::ChunkPos; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundChunksBiomesPacket { - pub chunk_biome_data: Vec, -} - -#[derive(Clone, Debug, McBuf)] -pub struct ChunkBiomeData { - pub pos: ChunkPos, - pub buffer: Vec, -} diff --git a/azalea-protocol/src/packets/game/clientbound_clear_titles_packet.rs b/azalea-protocol/src/packets/game/clientbound_clear_titles_packet.rs deleted file mode 100644 index 3bdc0c79..00000000 --- a/azalea-protocol/src/packets/game/clientbound_clear_titles_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundClearTitlesPacket { - pub reset_times: bool, -} diff --git a/azalea-protocol/src/packets/game/clientbound_command_suggestions_packet.rs b/azalea-protocol/src/packets/game/clientbound_command_suggestions_packet.rs deleted file mode 100755 index c9752ee9..00000000 --- a/azalea-protocol/src/packets/game/clientbound_command_suggestions_packet.rs +++ /dev/null @@ -1,37 +0,0 @@ -use azalea_brigadier::suggestion::Suggestions; -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundCommandSuggestionsPacket { - #[var] - pub id: u32, - pub suggestions: Suggestions, -} - -#[cfg(test)] -mod tests { - use std::io::Cursor; - - use azalea_brigadier::{context::StringRange, suggestion::Suggestion}; - use azalea_buf::{McBufReadable, McBufWritable}; - - use super::*; - - #[test] - fn test_suggestions() { - let suggestions = Suggestions::new( - StringRange::new(0, 5), - vec![Suggestion::new_with_tooltip( - StringRange::new(1, 4), - "foo", - "bar".to_string(), - )], - ); - let mut buf = Vec::new(); - suggestions.write_into(&mut buf).unwrap(); - let mut cursor = Cursor::new(&buf[..]); - let suggestions = Suggestions::read_from(&mut cursor).unwrap(); - assert_eq!(suggestions, suggestions); - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_commands_packet.rs b/azalea-protocol/src/packets/game/clientbound_commands_packet.rs deleted file mode 100755 index 10055e37..00000000 --- a/azalea-protocol/src/packets/game/clientbound_commands_packet.rs +++ /dev/null @@ -1,380 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::{ - BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, -}; -use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation}; -use azalea_protocol_macros::ClientboundGamePacket; -use tracing::warn; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundCommandsPacket { - pub entries: Vec, - #[var] - pub root_index: u32, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct BrigadierNodeStub { - pub is_executable: bool, - pub children: Vec, - pub redirect_node: Option, - pub node_type: NodeType, -} - -#[derive(Debug, Clone, Eq)] -pub struct BrigadierNumber { - pub min: Option, - pub max: Option, -} -impl BrigadierNumber { - pub fn new(min: Option, max: Option) -> BrigadierNumber { - BrigadierNumber { min, max } - } -} -impl PartialEq for BrigadierNumber { - fn eq(&self, other: &Self) -> bool { - match (&self.min, &self.max, &other.min, &other.max) { - (Some(f_min), None, Some(s_min), None) => f_min == s_min, - (None, Some(f_max), None, Some(s_max)) => f_max == s_max, - (Some(f_min), Some(f_max), Some(s_min), Some(s_max)) => { - f_min == s_min && f_max == s_max - } - (None, None, None, None) => true, - _ => false, - } - } -} - -impl McBufReadable for BrigadierNumber { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let flags = FixedBitSet::<2>::read_from(buf)?; - let min = if flags.index(0) { - Some(T::read_from(buf)?) - } else { - None - }; - let max = if flags.index(1) { - Some(T::read_from(buf)?) - } else { - None - }; - Ok(BrigadierNumber { min, max }) - } -} -impl McBufWritable for BrigadierNumber { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - let mut flags = FixedBitSet::<2>::new(); - if self.min.is_some() { - flags.set(0); - } - if self.max.is_some() { - flags.set(1); - } - flags.write_into(buf)?; - if let Some(min) = &self.min { - min.write_into(buf)?; - } - if let Some(max) = &self.max { - max.write_into(buf)?; - } - Ok(()) - } -} - -#[derive(Debug, Clone, Copy, McBuf, PartialEq, Eq)] -pub enum BrigadierString { - /// Reads a single word - SingleWord = 0, - // If it starts with a ", keeps reading until another " (allowing escaping with \). Otherwise - // behaves the same as SINGLE_WORD - QuotablePhrase = 1, - // Reads the rest of the content after the cursor. Quotes will not be removed. - GreedyPhrase = 2, -} - -#[derive(Debug, Clone, McBuf, PartialEq)] -pub enum BrigadierParser { - Bool, - Float(BrigadierNumber), - Double(BrigadierNumber), - Integer(BrigadierNumber), - Long(BrigadierNumber), - String(BrigadierString), - Entity(EntityParser), - GameProfile, - BlockPos, - ColumnPos, - Vec3, - Vec2, - BlockState, - BlockPredicate, - ItemStack, - ItemPredicate, - Color, - FormattedText, - Style, - Message, - NbtCompoundTag, - NbtTag, - NbtPath, - Objective, - ObjectiveCriteria, - Operation, - Particle, - Angle, - Rotation, - ScoreboardSlot, - ScoreHolder { allows_multiple: bool }, - Swizzle, - Team, - ItemSlot, - ItemSlots, - ResourceLocation, - Function, - EntityAnchor, - IntRange, - FloatRange, - Dimension, - GameMode, - Time { min: i32 }, - ResourceOrTag { registry_key: ResourceLocation }, - ResourceOrTagKey { registry_key: ResourceLocation }, - Resource { registry_key: ResourceLocation }, - ResourceKey { registry_key: ResourceLocation }, - TemplateMirror, - TemplateRotation, - Heightmap, - LootTable, - LootPredicate, - LootModifier, - Uuid, -} - -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct EntityParser { - pub single: bool, - pub players_only: bool, -} -impl McBufReadable for EntityParser { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let flags = FixedBitSet::<2>::read_from(buf)?; - Ok(EntityParser { - single: flags.index(0), - players_only: flags.index(1), - }) - } -} -impl McBufWritable for EntityParser { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - let mut flags = FixedBitSet::<2>::new(); - if self.single { - flags.set(0); - } - if self.players_only { - flags.set(1); - } - flags.write_into(buf)?; - Ok(()) - } -} - -// TODO: BrigadierNodeStub should have more stuff -impl McBufReadable for BrigadierNodeStub { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let flags = FixedBitSet::<8>::read_from(buf)?; - if flags.index(5) || flags.index(6) || flags.index(7) { - warn!("Warning: The flags from a Brigadier node are over 31. This is probably a bug.",); - } - - let node_type = u8::from(flags.index(0)) + (u8::from(flags.index(1)) * 2); - let is_executable = flags.index(2); - let has_redirect = flags.index(3); - let has_suggestions_type = flags.index(4); - - let children = Vec::::var_read_from(buf)?; - let redirect_node = if has_redirect { - Some(u32::var_read_from(buf)?) - } else { - None - }; - - // argument node - if node_type == 2 { - let name = String::read_from(buf)?; - let parser = BrigadierParser::read_from(buf)?; - let suggestions_type = if has_suggestions_type { - Some(ResourceLocation::read_from(buf)?) - } else { - None - }; - let node = BrigadierNodeStub { - is_executable, - children, - redirect_node, - node_type: NodeType::Argument { - name, - parser, - suggestions_type, - }, - }; - return Ok(node); - } - // literal node - else if node_type == 1 { - let name = String::read_from(buf)?; - return Ok(BrigadierNodeStub { - is_executable, - children, - redirect_node, - node_type: NodeType::Literal { name }, - }); - } - Ok(BrigadierNodeStub { - is_executable, - children, - redirect_node, - node_type: NodeType::Root, - }) - } -} - -impl McBufWritable for BrigadierNodeStub { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - let mut flags = FixedBitSet::<4>::new(); - if self.is_executable { - flags.set(2); - } - if self.redirect_node.is_some() { - flags.set(3); - } - - match &self.node_type { - NodeType::Root => { - flags.write_into(buf)?; - - self.children.var_write_into(buf)?; - - if let Some(redirect) = self.redirect_node { - redirect.var_write_into(buf)?; - } - } - NodeType::Literal { name } => { - flags.set(0); - flags.write_into(buf)?; - - self.children.var_write_into(buf)?; - - if let Some(redirect) = self.redirect_node { - redirect.var_write_into(buf)?; - } - - name.write_into(buf)?; - } - NodeType::Argument { - name, - parser, - suggestions_type, - } => { - flags.set(1); - if suggestions_type.is_some() { - flags.set(4); - } - flags.write_into(buf)?; - - self.children.var_write_into(buf)?; - - if let Some(redirect) = self.redirect_node { - redirect.var_write_into(buf)?; - } - - name.write_into(buf)?; - parser.write_into(buf)?; - - if let Some(suggestion) = suggestions_type { - suggestion.write_into(buf)?; - } - } - } - Ok(()) - } -} - -#[derive(Debug, Clone, PartialEq)] -pub enum NodeType { - Root, - Literal { - name: String, - }, - Argument { - name: String, - parser: BrigadierParser, - suggestions_type: Option, - }, -} - -impl BrigadierNodeStub { - #[must_use] - pub fn name(&self) -> Option<&str> { - match &self.node_type { - NodeType::Root => None, - NodeType::Literal { name } | NodeType::Argument { name, .. } => Some(name), - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_brigadier_node_stub_root() { - let data = BrigadierNodeStub { - is_executable: false, - children: vec![1, 2], - redirect_node: None, - node_type: NodeType::Root, - }; - let mut buf = Vec::new(); - data.write_into(&mut buf).unwrap(); - let mut data_cursor: Cursor<&[u8]> = Cursor::new(&buf); - let read_data = BrigadierNodeStub::read_from(&mut data_cursor).unwrap(); - assert_eq!(data, read_data); - } - - #[test] - fn test_brigadier_node_stub_literal() { - let data = BrigadierNodeStub { - is_executable: true, - children: vec![], - redirect_node: None, - node_type: NodeType::Literal { - name: "String".to_string(), - }, - }; - let mut buf = Vec::new(); - data.write_into(&mut buf).unwrap(); - let mut data_cursor: Cursor<&[u8]> = Cursor::new(&buf); - let read_data = BrigadierNodeStub::read_from(&mut data_cursor).unwrap(); - assert_eq!(data, read_data); - } - - #[test] - fn test_brigadier_node_stub_argument() { - let data = BrigadierNodeStub { - is_executable: false, - children: vec![6, 9], - redirect_node: Some(5), - node_type: NodeType::Argument { - name: "position".to_string(), - parser: BrigadierParser::Vec3, - suggestions_type: Some(ResourceLocation::new("minecraft:test_suggestion")), - }, - }; - let mut buf = Vec::new(); - data.write_into(&mut buf).unwrap(); - let mut data_cursor: Cursor<&[u8]> = Cursor::new(&buf); - let read_data = BrigadierNodeStub::read_from(&mut data_cursor).unwrap(); - assert_eq!(data, read_data); - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_container_close_packet.rs b/azalea-protocol/src/packets/game/clientbound_container_close_packet.rs deleted file mode 100644 index a59da450..00000000 --- a/azalea-protocol/src/packets/game/clientbound_container_close_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundContainerClosePacket { - pub container_id: u8, -} diff --git a/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs b/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs deleted file mode 100755 index 4e08232d..00000000 --- a/azalea-protocol/src/packets/game/clientbound_container_set_content_packet.rs +++ /dev/null @@ -1,12 +0,0 @@ -use azalea_buf::McBuf; -use azalea_inventory::ItemSlot; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundContainerSetContentPacket { - pub container_id: i8, - #[var] - pub state_id: u32, - pub items: Vec, - pub carried_item: ItemSlot, -} diff --git a/azalea-protocol/src/packets/game/clientbound_container_set_data_packet.rs b/azalea-protocol/src/packets/game/clientbound_container_set_data_packet.rs deleted file mode 100755 index dc53a024..00000000 --- a/azalea-protocol/src/packets/game/clientbound_container_set_data_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundContainerSetDataPacket { - pub container_id: i8, - pub id: u16, - pub value: u16, -} diff --git a/azalea-protocol/src/packets/game/clientbound_container_set_slot_packet.rs b/azalea-protocol/src/packets/game/clientbound_container_set_slot_packet.rs deleted file mode 100755 index 9b954fa0..00000000 --- a/azalea-protocol/src/packets/game/clientbound_container_set_slot_packet.rs +++ /dev/null @@ -1,12 +0,0 @@ -use azalea_buf::McBuf; -use azalea_inventory::ItemSlot; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundContainerSetSlotPacket { - pub container_id: i8, - #[var] - pub state_id: u32, - pub slot: u16, - pub item_stack: ItemSlot, -} diff --git a/azalea-protocol/src/packets/game/clientbound_cookie_request_packet.rs b/azalea-protocol/src/packets/game/clientbound_cookie_request_packet.rs deleted file mode 100755 index 9f1c1d43..00000000 --- a/azalea-protocol/src/packets/game/clientbound_cookie_request_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundCookieRequestPacket { - pub key: ResourceLocation, -} diff --git a/azalea-protocol/src/packets/game/clientbound_cooldown_packet.rs b/azalea-protocol/src/packets/game/clientbound_cooldown_packet.rs deleted file mode 100755 index 41c8291a..00000000 --- a/azalea-protocol/src/packets/game/clientbound_cooldown_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundCooldownPacket { - pub item: azalea_registry::Item, - #[var] - pub duration: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_custom_chat_completions_packet.rs b/azalea-protocol/src/packets/game/clientbound_custom_chat_completions_packet.rs deleted file mode 100755 index 3165bbbe..00000000 --- a/azalea-protocol/src/packets/game/clientbound_custom_chat_completions_packet.rs +++ /dev/null @@ -1,15 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundCustomChatCompletionsPacket { - pub action: Action, - pub entries: Vec, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum Action { - Add = 0, - Remove = 1, - Set = 2, -} diff --git a/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs b/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs deleted file mode 100755 index fb5f11ba..00000000 --- a/azalea-protocol/src/packets/game/clientbound_custom_payload_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_buf::UnsizedByteArray; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundCustomPayloadPacket { - pub identifier: ResourceLocation, - pub data: UnsizedByteArray, -} diff --git a/azalea-protocol/src/packets/game/clientbound_custom_report_details_packet.rs b/azalea-protocol/src/packets/game/clientbound_custom_report_details_packet.rs deleted file mode 100644 index a098f915..00000000 --- a/azalea-protocol/src/packets/game/clientbound_custom_report_details_packet.rs +++ /dev/null @@ -1,14 +0,0 @@ -use std::collections::HashMap; - -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundCustomReportDetailsPacket { - // azalea doesn't implement max lengths yet - - // max length = 32 - // key string is limited to 128 bytes - // value string is limited to 4096 bytes - pub details: HashMap, -} diff --git a/azalea-protocol/src/packets/game/clientbound_custom_sound_packet.rs b/azalea-protocol/src/packets/game/clientbound_custom_sound_packet.rs deleted file mode 100644 index 05b1560b..00000000 --- a/azalea-protocol/src/packets/game/clientbound_custom_sound_packet.rs +++ /dev/null @@ -1,28 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundCustomSoundPacket { - pub name: ResourceLocation, - pub source: SoundSource, - pub x: i32, - pub y: i32, - pub z: i32, - pub volume: f32, - pub pitch: f32, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum SoundSource { - Master = 0, - Music = 1, - Records = 2, - Weather = 3, - Blocks = 4, - Hostile = 5, - Neutral = 6, - Players = 7, - Ambient = 8, - Voice = 9, -} diff --git a/azalea-protocol/src/packets/game/clientbound_damage_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_damage_event_packet.rs deleted file mode 100644 index cf5d369a..00000000 --- a/azalea-protocol/src/packets/game/clientbound_damage_event_packet.rs +++ /dev/null @@ -1,35 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::{McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable}; -use azalea_core::position::Vec3; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundDamageEventPacket { - #[var] - pub entity_id: u32, - #[var] - pub source_type_id: u32, - pub source_cause_id: OptionalEntityId, - pub source_direct_id: OptionalEntityId, - pub source_position: Option, -} - -#[derive(Clone, Debug)] -pub struct OptionalEntityId(pub Option); -impl McBufReadable for OptionalEntityId { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - match u32::var_read_from(buf)? { - 0 => Ok(OptionalEntityId(None)), - id => Ok(OptionalEntityId(Some(id - 1))), - } - } -} -impl McBufWritable for OptionalEntityId { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - match self.0 { - Some(id) => (id + 1).var_write_into(buf), - None => 0u32.var_write_into(buf), - } - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_debug_sample_packet.rs b/azalea-protocol/src/packets/game/clientbound_debug_sample_packet.rs deleted file mode 100755 index 641fd05e..00000000 --- a/azalea-protocol/src/packets/game/clientbound_debug_sample_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -use super::serverbound_debug_sample_subscription::RemoteDebugSampleType; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundDebugSamplePacket { - pub sample: Vec, - pub debug_sample_type: RemoteDebugSampleType, -} diff --git a/azalea-protocol/src/packets/game/clientbound_delete_chat_packet.rs b/azalea-protocol/src/packets/game/clientbound_delete_chat_packet.rs deleted file mode 100755 index eef9b561..00000000 --- a/azalea-protocol/src/packets/game/clientbound_delete_chat_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -use super::clientbound_player_chat_packet::PackedMessageSignature; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundDeleteChatPacket { - pub signature: PackedMessageSignature, -} diff --git a/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs b/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs deleted file mode 100755 index f8771c37..00000000 --- a/azalea-protocol/src/packets/game/clientbound_disconnect_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundDisconnectPacket { - pub reason: FormattedText, -} diff --git a/azalea-protocol/src/packets/game/clientbound_disguised_chat_packet.rs b/azalea-protocol/src/packets/game/clientbound_disguised_chat_packet.rs deleted file mode 100644 index 24e1a992..00000000 --- a/azalea-protocol/src/packets/game/clientbound_disguised_chat_packet.rs +++ /dev/null @@ -1,42 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::{ - translatable_component::{StringOrComponent, TranslatableComponent}, - FormattedText, -}; -use azalea_protocol_macros::ClientboundGamePacket; - -use super::clientbound_player_chat_packet::ChatTypeBound; - -// A disguised chat packet is basically the same as a normal -// [`ClientboundPlayerChatPacket`], except that it doesn't have any of the chat -// signing things. Vanilla servers use this when messages are sent from the -// console. -#[derive(Clone, Debug, McBuf, ClientboundGamePacket, PartialEq)] -pub struct ClientboundDisguisedChatPacket { - pub message: FormattedText, - pub chat_type: ChatTypeBound, -} - -impl ClientboundDisguisedChatPacket { - /// Get the full message, including the sender part. - #[must_use] - pub fn message(&self) -> FormattedText { - let sender = self.chat_type.name.clone(); - let content = self.message.clone(); - let target = self.chat_type.target_name.clone(); - - let translation_key = self.chat_type.chat_type.chat_translation_key(); - - let mut args = vec![ - StringOrComponent::FormattedText(sender), - StringOrComponent::FormattedText(content), - ]; - if let Some(target) = target { - args.push(StringOrComponent::FormattedText(target)); - } - - let component = TranslatableComponent::new(translation_key.to_string(), args); - - FormattedText::Translatable(component) - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_entity_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_entity_event_packet.rs deleted file mode 100755 index 18076a33..00000000 --- a/azalea-protocol/src/packets/game/clientbound_entity_event_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundEntityEventPacket { - pub entity_id: u32, - pub event_id: u8, -} diff --git a/azalea-protocol/src/packets/game/clientbound_entity_position_sync_packet.rs b/azalea-protocol/src/packets/game/clientbound_entity_position_sync_packet.rs deleted file mode 100755 index 0125eeb4..00000000 --- a/azalea-protocol/src/packets/game/clientbound_entity_position_sync_packet.rs +++ /dev/null @@ -1,19 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::position::Vec3; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundEntityPositionSyncPacket { - #[var] - pub id: u32, - pub values: PositionMoveRotation, - pub on_ground: bool, -} - -#[derive(McBuf, Clone, Debug)] -pub struct PositionMoveRotation { - pub position: Vec3, - pub delta_movement: Vec3, - pub y_rot: f32, - pub x_rot: f32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_explode_packet.rs b/azalea-protocol/src/packets/game/clientbound_explode_packet.rs deleted file mode 100755 index 23c416d1..00000000 --- a/azalea-protocol/src/packets/game/clientbound_explode_packet.rs +++ /dev/null @@ -1,166 +0,0 @@ -use std::{ - io::{Cursor, Write}, - str::FromStr, -}; - -use azalea_buf::{ - BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, -}; -use azalea_core::{position::BlockPos, resource_location::ResourceLocation}; -use azalea_protocol_macros::ClientboundGamePacket; -use azalea_registry::{ParticleKind, SoundEvent}; - -#[derive(Clone, Debug, PartialEq, ClientboundGamePacket)] -pub struct ClientboundExplodePacket { - pub x: f64, - pub y: f64, - pub z: f64, - pub power: f32, - pub to_blow: Vec, - pub knockback_x: f32, - pub knockback_y: f32, - pub knockback_z: f32, - pub block_interaction: BlockInteraction, - pub small_explosion_particles: ParticleKind, - pub large_explosion_particles: ParticleKind, - pub explosion_sound: SoundEvent, -} - -#[derive(Clone, Copy, Debug, PartialEq, McBuf)] -pub enum BlockInteraction { - Keep, - Destroy, - DestroyWithDecay, - TriggerBlock, -} - -impl McBufReadable for ClientboundExplodePacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let x = f64::read_from(buf)?; - let y = f64::read_from(buf)?; - let z = f64::read_from(buf)?; - let power = f32::read_from(buf)?; - - let x_floor = x.floor() as i32; - let y_floor = y.floor() as i32; - let z_floor = z.floor() as i32; - - let to_blow_len = u32::var_read_from(buf)?; - let mut to_blow = Vec::with_capacity(to_blow_len as usize); - for _ in 0..to_blow_len { - // the bytes are offsets from the main x y z - let x = x_floor + i32::from(i8::read_from(buf)?); - let y = y_floor + i32::from(i8::read_from(buf)?); - let z = z_floor + i32::from(i8::read_from(buf)?); - to_blow.push(BlockPos { x, y, z }); - } - - let knockback_x = f32::read_from(buf)?; - let knockback_y = f32::read_from(buf)?; - let knockback_z = f32::read_from(buf)?; - - let block_interaction = BlockInteraction::read_from(buf)?; - let small_explosion_particles = ParticleKind::read_from(buf)?; - let large_explosion_particles = ParticleKind::read_from(buf)?; - - let sound_event_resource_location = ResourceLocation::read_from(buf)?.to_string(); - let explosion_sound = - SoundEvent::from_str(&sound_event_resource_location).map_err(|_| { - BufReadError::UnexpectedStringEnumVariant { - id: sound_event_resource_location, - } - })?; - - Ok(Self { - x, - y, - z, - power, - to_blow, - knockback_x, - knockback_y, - knockback_z, - block_interaction, - small_explosion_particles, - large_explosion_particles, - explosion_sound, - }) - } -} - -impl McBufWritable for ClientboundExplodePacket { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - self.x.write_into(buf)?; - self.y.write_into(buf)?; - self.z.write_into(buf)?; - self.power.write_into(buf)?; - - let to_blow_len = self.to_blow.len() as u32; - to_blow_len.var_write_into(buf)?; - - let x_floor = self.x.floor() as i32; - let y_floor = self.y.floor() as i32; - let z_floor = self.z.floor() as i32; - - for pos in &self.to_blow { - let x = (pos.x - x_floor) as i8; - let y = (pos.y - y_floor) as i8; - let z = (pos.z - z_floor) as i8; - x.write_into(buf)?; - y.write_into(buf)?; - z.write_into(buf)?; - } - - self.knockback_x.write_into(buf)?; - self.knockback_y.write_into(buf)?; - self.knockback_z.write_into(buf)?; - - self.block_interaction.write_into(buf)?; - self.small_explosion_particles.write_into(buf)?; - self.large_explosion_particles.write_into(buf)?; - - let sound_event_resource_location = - ResourceLocation::new(&self.explosion_sound.to_string()); - sound_event_resource_location.write_into(buf)?; - - Ok(()) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_read_write() { - let packet = ClientboundExplodePacket { - x: 123_456.0, - y: 789_012.0, - z: 345_678.0, - power: 1_000.0, - to_blow: vec![ - BlockPos { - x: 123_456 + 1, - y: 789_012 + 2, - z: 345_678 - 127, - }, - BlockPos { - x: 123_456 + 4, - y: 789_012 - 5, - z: 345_678 + 6, - }, - ], - knockback_x: 1_000.0, - knockback_y: 2_000.0, - knockback_z: 3_000.0, - block_interaction: BlockInteraction::Destroy, - small_explosion_particles: ParticleKind::Explosion, - large_explosion_particles: ParticleKind::ExplosionEmitter, - explosion_sound: SoundEvent::EntityGenericExplode, - }; - let mut buf = Vec::new(); - packet.write_into(&mut buf).unwrap(); - let packet2 = ClientboundExplodePacket::read_from(&mut Cursor::new(&buf)).unwrap(); - assert_eq!(packet, packet2); - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_forget_level_chunk_packet.rs b/azalea-protocol/src/packets/game/clientbound_forget_level_chunk_packet.rs deleted file mode 100755 index 027d41ee..00000000 --- a/azalea-protocol/src/packets/game/clientbound_forget_level_chunk_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::position::ChunkPos; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundForgetLevelChunkPacket { - pub pos: ChunkPos, -} diff --git a/azalea-protocol/src/packets/game/clientbound_game_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_game_event_packet.rs deleted file mode 100755 index 2416f7c3..00000000 --- a/azalea-protocol/src/packets/game/clientbound_game_event_packet.rs +++ /dev/null @@ -1,26 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundGameEventPacket { - pub event: EventType, - pub param: f32, -} - -#[derive(Clone, Debug, Copy, McBuf)] -pub enum EventType { - NoRespawnBlockAvailable = 0, - StartRaining = 1, - StopRaining = 2, - ChangeGameMode = 3, - WinGame = 4, - DemoEvent = 5, - ArrowHitPlayer = 6, - RainLevelChange = 7, - ThunderLevelChange = 8, - PufferFishSting = 9, - GuardianElderEffect = 10, - ImmediateRespawn = 11, - LimitedCrafting = 12, - WaitForLevelChunks = 13, -} diff --git a/azalea-protocol/src/packets/game/clientbound_horse_screen_open_packet.rs b/azalea-protocol/src/packets/game/clientbound_horse_screen_open_packet.rs deleted file mode 100755 index ad3f7b37..00000000 --- a/azalea-protocol/src/packets/game/clientbound_horse_screen_open_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundHorseScreenOpenPacket { - pub container_id: u8, - #[var] - pub size: u32, - pub entity_id: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_hurt_animation_packet.rs b/azalea-protocol/src/packets/game/clientbound_hurt_animation_packet.rs deleted file mode 100644 index d4a79a27..00000000 --- a/azalea-protocol/src/packets/game/clientbound_hurt_animation_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundHurtAnimationPacket { - #[var] - pub id: u32, - pub yaw: f32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs b/azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs deleted file mode 100755 index 77742c0a..00000000 --- a/azalea-protocol/src/packets/game/clientbound_initialize_border_packet.rs +++ /dev/null @@ -1,18 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, ClientboundGamePacket, McBuf)] -pub struct ClientboundInitializeBorderPacket { - pub new_center_x: f64, - pub new_center_z: f64, - pub old_size: f64, - pub new_size: f64, - #[var] - pub lerp_time: u64, - #[var] - pub new_absolute_max_size: u32, - #[var] - pub warning_blocks: u32, - #[var] - pub warning_time: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_keep_alive_packet.rs b/azalea-protocol/src/packets/game/clientbound_keep_alive_packet.rs deleted file mode 100755 index 16fe3357..00000000 --- a/azalea-protocol/src/packets/game/clientbound_keep_alive_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundKeepAlivePacket { - pub id: u64, -} diff --git a/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs b/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs deleted file mode 100755 index f7212ba7..00000000 --- a/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs +++ /dev/null @@ -1,66 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; -use simdnbt::owned::Nbt; - -use super::clientbound_light_update_packet::ClientboundLightUpdatePacketData; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundLevelChunkWithLightPacket { - pub x: i32, - pub z: i32, - pub chunk_data: ClientboundLevelChunkPacketData, - pub light_data: ClientboundLightUpdatePacketData, -} - -#[derive(Clone, Debug, McBuf)] -pub struct ClientboundLevelChunkPacketData { - pub heightmaps: Nbt, - // we can't parse the data in azalea-protocol because it depends on context from other packets - pub data: Vec, - pub block_entities: Vec, -} - -#[derive(Clone, Debug, McBuf)] -pub struct BlockEntity { - pub packed_xz: u8, - pub y: u16, - pub kind: azalea_registry::BlockEntityKind, - pub data: Nbt, -} - -#[cfg(test)] -mod tests { - use std::{io::Cursor, ops::Deref}; - - use azalea_buf::McBufReadable; - use azalea_world::Chunk; - use simdnbt::owned::BaseNbt; - - use super::*; - - #[test] - fn test_clientbound_level_chunk_with_light_packet() { - #[rustfmt::skip] - let bytes = [ - 255, 255, 255, 253, 0, 0, 0, 1, 10, 12, 0, 15, 77, 79, 84, 73, 79, 78, 95, 66, 76, 79, 67, 75, 73, 78, 71, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 240, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 195, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 33, 67, 101, 135, 169, 203, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 33, 67, 101, 135, 169, 203, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 16, 50, 84, 118, 152, 186, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 33, 67, 101, 135, 169, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 16, 50, 84, 118, 152, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 33, 67, 101, 135, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 16, 50, 84, 118, 0, 0, 0, 0, 0, 33, 67, 101, 0, 0, 0, 0, 0, 16, 50, 84, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 16, 50, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - ]; - - let packet = - ClientboundLevelChunkWithLightPacket::read_from(&mut Cursor::new(&bytes)).unwrap(); - - let heightmaps_nbt = &packet.chunk_data.heightmaps; - // necessary to make the unwrap_or work - let empty_nbt = BaseNbt::default(); - let heightmaps = heightmaps_nbt.unwrap_or(&empty_nbt).deref(); - - let chunk = Chunk::read_with_dimension_height( - &mut Cursor::new(&packet.chunk_data.data), - 256, - 0, - heightmaps, - ) - .unwrap(); - - assert_eq!(chunk.sections.len(), 16); - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_level_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_level_event_packet.rs deleted file mode 100755 index a79217f1..00000000 --- a/azalea-protocol/src/packets/game/clientbound_level_event_packet.rs +++ /dev/null @@ -1,11 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::position::BlockPos; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundLevelEventPacket { - pub event_type: u32, - pub pos: BlockPos, - pub data: u32, - pub global_event: bool, -} diff --git a/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs b/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs deleted file mode 100755 index eae99634..00000000 --- a/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs +++ /dev/null @@ -1,39 +0,0 @@ -use azalea_buf::McBuf; -use azalea_entity::particle::Particle; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundLevelParticlesPacket { - pub override_limiter: bool, - pub x: f64, - pub y: f64, - pub z: f64, - pub x_dist: f32, - pub y_dist: f32, - pub z_dist: f32, - pub max_speed: f32, - pub count: u32, - pub particle: Particle, -} - -#[cfg(test)] -mod tests { - use std::io::Cursor; - - use azalea_buf::McBufReadable; - - use super::*; - - #[test] - fn test_clientbound_level_particles_packet() { - let slice = &[ - 0, 64, 139, 10, 0, 0, 0, 0, 0, 192, 26, 0, 0, 0, 0, 0, 0, 64, 144, 58, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 13, 63, 128, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 63, 128, 0, 0, - ][..]; - let mut bytes = Cursor::new(slice); - - let _packet = ClientboundLevelParticlesPacket::read_from(&mut bytes).unwrap(); - assert_eq!(bytes.position(), slice.len() as u64); - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs b/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs deleted file mode 100755 index 8d50e94d..00000000 --- a/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs +++ /dev/null @@ -1,22 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::bitset::BitSet; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundLightUpdatePacket { - #[var] - pub x: i32, - #[var] - pub z: i32, - pub light_data: ClientboundLightUpdatePacketData, -} - -#[derive(Clone, Debug, McBuf)] -pub struct ClientboundLightUpdatePacketData { - pub sky_y_mask: BitSet, - pub block_y_mask: BitSet, - pub empty_sky_y_mask: BitSet, - pub empty_block_y_mask: BitSet, - pub sky_updates: Vec>, - pub block_updates: Vec>, -} diff --git a/azalea-protocol/src/packets/game/clientbound_login_packet.rs b/azalea-protocol/src/packets/game/clientbound_login_packet.rs deleted file mode 100755 index 234439d5..00000000 --- a/azalea-protocol/src/packets/game/clientbound_login_packet.rs +++ /dev/null @@ -1,27 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundGamePacket; - -use crate::packets::common::CommonPlayerSpawnInfo; - -/// The first packet sent by the server to the client after login. -/// -/// This packet contains information about the state of the player, the -/// world, and the registry. -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundLoginPacket { - pub player_id: u32, - pub hardcore: bool, - pub levels: Vec, - #[var] - pub max_players: i32, - #[var] - pub chunk_radius: u32, - #[var] - pub simulation_distance: u32, - pub reduced_debug_info: bool, - pub show_death_screen: bool, - pub do_limited_crafting: bool, - pub common: CommonPlayerSpawnInfo, - pub enforces_secure_chat: bool, -} diff --git a/azalea-protocol/src/packets/game/clientbound_map_item_data_packet.rs b/azalea-protocol/src/packets/game/clientbound_map_item_data_packet.rs deleted file mode 100755 index 0f858181..00000000 --- a/azalea-protocol/src/packets/game/clientbound_map_item_data_packet.rs +++ /dev/null @@ -1,88 +0,0 @@ -use azalea_buf::{McBuf, McBufReadable, McBufWritable}; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, ClientboundGamePacket, McBuf)] -pub struct ClientboundMapItemDataPacket { - #[var] - pub map_id: u32, - pub scale: u8, - pub locked: bool, - pub decorations: Option>, - pub color_patch: OptionalMapPatch, -} - -#[derive(Clone, Debug, McBuf)] -pub struct MapDecoration { - pub decoration_type: DecorationType, - pub x: i8, - pub y: i8, - /// Minecraft does & 15 on this value, azalea-protocol doesn't. I don't - /// think it matters. - pub rot: i8, - pub name: Option, -} - -#[derive(Debug, Clone)] -pub struct OptionalMapPatch(pub Option); - -impl McBufReadable for OptionalMapPatch { - fn read_from(buf: &mut std::io::Cursor<&[u8]>) -> Result { - let pos = buf.position(); - Ok(Self(if u8::read_from(buf)? == 0 { - None - } else { - buf.set_position(pos); - Some(MapPatch::read_from(buf)?) - })) - } -} - -impl McBufWritable for OptionalMapPatch { - fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { - match &self.0 { - None => 0u8.write_into(buf), - Some(m) => m.write_into(buf), - } - } -} - -#[derive(Debug, Clone, McBuf)] -pub struct MapPatch { - pub width: u8, - pub height: u8, - pub start_x: u8, - pub start_y: u8, - pub map_colors: Vec, -} - -#[derive(Clone, Copy, Debug, McBuf)] -pub enum DecorationType { - Player, - Frame, - RedMarker, - BlueMarker, - TargetX, - TargetPoint, - PlayerOffMap, - PlayerOffLimits, - Mansion, - Monument, - BannerWhite, - BannerOrange, - BannerMagenta, - BannerLightBlue, - BannerYellow, - BannerLime, - BannerPink, - BannerGray, - BannerLightGray, - BannerCyan, - BannerPurple, - BannerBlue, - BannerBrown, - BannerGreen, - BannerRed, - BannerBlack, - RedX, -} diff --git a/azalea-protocol/src/packets/game/clientbound_merchant_offers_packet.rs b/azalea-protocol/src/packets/game/clientbound_merchant_offers_packet.rs deleted file mode 100755 index 4253ace4..00000000 --- a/azalea-protocol/src/packets/game/clientbound_merchant_offers_packet.rs +++ /dev/null @@ -1,30 +0,0 @@ -use azalea_buf::McBuf; -use azalea_inventory::ItemSlot; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundMerchantOffersPacket { - #[var] - pub container_id: u32, - pub offers: Vec, - #[var] - pub villager_level: u32, - #[var] - pub villager_xp: u32, - pub show_progress: bool, - pub can_restock: bool, -} - -#[derive(Clone, Debug, McBuf)] -pub struct MerchantOffer { - pub base_cost_a: ItemSlot, - pub result: ItemSlot, - pub cost_b: ItemSlot, - pub out_of_stock: bool, - pub uses: u32, - pub max_uses: u32, - pub xp: u32, - pub special_price_diff: i32, - pub price_multiplier: f32, - pub demand: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_move_entity_pos_packet.rs b/azalea-protocol/src/packets/game/clientbound_move_entity_pos_packet.rs deleted file mode 100755 index d909fdcc..00000000 --- a/azalea-protocol/src/packets/game/clientbound_move_entity_pos_packet.rs +++ /dev/null @@ -1,11 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::delta::PositionDelta8; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundMoveEntityPosPacket { - #[var] - pub entity_id: u32, - pub delta: PositionDelta8, - pub on_ground: bool, -} diff --git a/azalea-protocol/src/packets/game/clientbound_move_entity_pos_rot_packet.rs b/azalea-protocol/src/packets/game/clientbound_move_entity_pos_rot_packet.rs deleted file mode 100755 index 5a5dfbd3..00000000 --- a/azalea-protocol/src/packets/game/clientbound_move_entity_pos_rot_packet.rs +++ /dev/null @@ -1,14 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::delta::PositionDelta8; -use azalea_protocol_macros::ClientboundGamePacket; - -/// This packet is sent by the server when an entity moves less then 8 blocks. -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundMoveEntityPosRotPacket { - #[var] - pub entity_id: u32, - pub delta: PositionDelta8, - pub y_rot: i8, - pub x_rot: i8, - pub on_ground: bool, -} diff --git a/azalea-protocol/src/packets/game/clientbound_move_entity_rot_packet.rs b/azalea-protocol/src/packets/game/clientbound_move_entity_rot_packet.rs deleted file mode 100755 index 666abe23..00000000 --- a/azalea-protocol/src/packets/game/clientbound_move_entity_rot_packet.rs +++ /dev/null @@ -1,11 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundMoveEntityRotPacket { - #[var] - pub entity_id: u32, - pub y_rot: i8, - pub x_rot: i8, - pub on_ground: bool, -} diff --git a/azalea-protocol/src/packets/game/clientbound_move_minecart_packet.rs b/azalea-protocol/src/packets/game/clientbound_move_minecart_packet.rs deleted file mode 100644 index 014e2aaa..00000000 --- a/azalea-protocol/src/packets/game/clientbound_move_minecart_packet.rs +++ /dev/null @@ -1,19 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::position::Vec3; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundMoveMinecartPacket { - #[var] - pub entity_id: u32, - pub lerp_steps: Vec, -} - -#[derive(Clone, Debug, McBuf)] -pub struct MinecartStep { - pub position: Vec3, - pub movement: Vec3, - pub y_rot: u8, - pub x_rot: u8, - pub weight: f32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_move_vehicle_packet.rs b/azalea-protocol/src/packets/game/clientbound_move_vehicle_packet.rs deleted file mode 100755 index d2376c35..00000000 --- a/azalea-protocol/src/packets/game/clientbound_move_vehicle_packet.rs +++ /dev/null @@ -1,11 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundMoveVehiclePacket { - pub x: f64, - pub y: f64, - pub z: f64, - pub y_rot: f32, - pub x_rot: f32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_open_book_packet.rs b/azalea-protocol/src/packets/game/clientbound_open_book_packet.rs deleted file mode 100755 index 1b450b80..00000000 --- a/azalea-protocol/src/packets/game/clientbound_open_book_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -use super::serverbound_interact_packet::InteractionHand; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundOpenBookPacket { - pub hand: InteractionHand, -} diff --git a/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs b/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs deleted file mode 100755 index 582cac17..00000000 --- a/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs +++ /dev/null @@ -1,11 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundOpenScreenPacket { - #[var] - pub container_id: u32, - pub menu_type: azalea_registry::MenuKind, - pub title: FormattedText, -} diff --git a/azalea-protocol/src/packets/game/clientbound_open_sign_editor_packet.rs b/azalea-protocol/src/packets/game/clientbound_open_sign_editor_packet.rs deleted file mode 100755 index 0b03cbe2..00000000 --- a/azalea-protocol/src/packets/game/clientbound_open_sign_editor_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::position::BlockPos; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundOpenSignEditorPacket { - pub pos: BlockPos, - pub is_front_text: bool, -} diff --git a/azalea-protocol/src/packets/game/clientbound_ping_packet.rs b/azalea-protocol/src/packets/game/clientbound_ping_packet.rs deleted file mode 100755 index 0bd2c8c3..00000000 --- a/azalea-protocol/src/packets/game/clientbound_ping_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPingPacket { - pub id: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_place_ghost_recipe_packet.rs b/azalea-protocol/src/packets/game/clientbound_place_ghost_recipe_packet.rs deleted file mode 100755 index 4d61a526..00000000 --- a/azalea-protocol/src/packets/game/clientbound_place_ghost_recipe_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlaceGhostRecipePacket { - pub container_id: u8, - pub recipe: ResourceLocation, -} diff --git a/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs deleted file mode 100755 index 48c8b41a..00000000 --- a/azalea-protocol/src/packets/game/clientbound_player_abilities_packet.rs +++ /dev/null @@ -1,53 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::{BufReadError, McBuf}; -use azalea_buf::{McBufReadable, McBufWritable}; -use azalea_core::bitset::FixedBitSet; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerAbilitiesPacket { - pub flags: PlayerAbilitiesFlags, - pub flying_speed: f32, - /// Used for the fov - pub walking_speed: f32, -} - -#[derive(Clone, Debug)] -pub struct PlayerAbilitiesFlags { - pub invulnerable: bool, - pub flying: bool, - pub can_fly: bool, - pub instant_break: bool, -} - -impl McBufReadable for PlayerAbilitiesFlags { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let set = FixedBitSet::<4>::read_from(buf)?; - Ok(PlayerAbilitiesFlags { - invulnerable: set.index(0), - flying: set.index(1), - can_fly: set.index(2), - instant_break: set.index(3), - }) - } -} - -impl McBufWritable for PlayerAbilitiesFlags { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - let mut set = FixedBitSet::<4>::new(); - if self.invulnerable { - set.set(0); - } - if self.flying { - set.set(1); - } - if self.can_fly { - set.set(2); - } - if self.instant_break { - set.set(3); - } - set.write_into(buf) - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_player_chat_header_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_chat_header_packet.rs deleted file mode 100755 index 0e86a36d..00000000 --- a/azalea-protocol/src/packets/game/clientbound_player_chat_header_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_crypto::{MessageSignature, SignedMessageHeader}; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerChatHeaderPacket { - pub header: SignedMessageHeader, - pub header_signature: MessageSignature, - pub body_digest: Vec, -} diff --git a/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs deleted file mode 100644 index 9cd20efc..00000000 --- a/azalea-protocol/src/packets/game/clientbound_player_chat_packet.rs +++ /dev/null @@ -1,202 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::{ - BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, -}; -use azalea_chat::{ - translatable_component::{StringOrComponent, TranslatableComponent}, - FormattedText, -}; -use azalea_core::bitset::BitSet; -use azalea_crypto::MessageSignature; -use azalea_protocol_macros::ClientboundGamePacket; -use uuid::Uuid; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket, PartialEq)] -pub struct ClientboundPlayerChatPacket { - pub sender: Uuid, - #[var] - pub index: u32, - pub signature: Option, - pub body: PackedSignedMessageBody, - pub unsigned_content: Option, - pub filter_mask: FilterMask, - pub chat_type: ChatTypeBound, -} - -#[derive(Clone, Debug, PartialEq, McBuf)] -pub struct PackedSignedMessageBody { - // the error is here, for some reason it skipped a byte earlier and here - // it's reading `0` when it should be `11` - pub content: String, - pub timestamp: u64, - pub salt: u64, - pub last_seen: PackedLastSeenMessages, -} - -#[derive(Clone, Debug, PartialEq, McBuf)] -pub struct PackedLastSeenMessages { - pub entries: Vec, -} - -/// Messages can be deleted by either their signature or message id. -#[derive(Clone, Debug, PartialEq)] -pub enum PackedMessageSignature { - Signature(Box), - Id(u32), -} - -#[derive(Clone, Debug, PartialEq, McBuf)] -pub enum FilterMask { - PassThrough, - FullyFiltered, - PartiallyFiltered(BitSet), -} - -#[derive(Copy, Clone, Debug, McBuf, PartialEq, Eq)] -pub enum ChatType { - Chat = 0, - SayCommand = 1, - MsgCommandIncoming = 2, - MsgCommandOutgoing = 3, - TeamMsgCommandIncoming = 4, - TeamMsgCommandOutgoing = 5, - EmoteCommand = 6, -} - -#[derive(Clone, Debug, McBuf, PartialEq)] -pub struct ChatTypeBound { - pub chat_type: ChatType, - pub name: FormattedText, - pub target_name: Option, -} - -// must be in Client -#[derive(Clone, Debug, PartialEq)] -pub struct MessageSignatureCache { - pub entries: Vec>, -} - -// impl MessageSignatureCache { -// pub fn unpacker(&self) -> impl Fn(u32) -> Option { - -// } -// } - -// impl PackedSignedMessageBody { -// pub fn unpack(&self, unpacker: impl Fn(u32) -> Option) -// {} } - -impl ClientboundPlayerChatPacket { - /// Returns the content of the message. If you want to get the FormattedText - /// for the whole message including the sender part, use - /// [`ClientboundPlayerChatPacket::message`]. - #[must_use] - pub fn content(&self) -> FormattedText { - self.unsigned_content - .clone() - .unwrap_or_else(|| FormattedText::from(self.body.content.clone())) - } - - /// Get the full message, including the sender part. - #[must_use] - pub fn message(&self) -> FormattedText { - let sender = self.chat_type.name.clone(); - let content = self.content(); - let target = self.chat_type.target_name.clone(); - - let translation_key = self.chat_type.chat_type.chat_translation_key(); - - let mut args = vec![ - StringOrComponent::FormattedText(sender), - StringOrComponent::FormattedText(content), - ]; - if let Some(target) = target { - args.push(StringOrComponent::FormattedText(target)); - } - - let component = TranslatableComponent::new(translation_key.to_string(), args); - - FormattedText::Translatable(component) - } -} - -impl ChatType { - #[must_use] - pub fn chat_translation_key(&self) -> &'static str { - match self { - ChatType::Chat => "chat.type.text", - ChatType::SayCommand => "chat.type.announcement", - ChatType::MsgCommandIncoming => "commands.message.display.incoming", - ChatType::MsgCommandOutgoing => "commands.message.display.outgoing", - ChatType::TeamMsgCommandIncoming => "chat.type.team.text", - ChatType::TeamMsgCommandOutgoing => "chat.type.team.sent", - ChatType::EmoteCommand => "chat.type.emote", - } - } - - #[must_use] - pub fn narrator_translation_key(&self) -> &'static str { - match self { - ChatType::EmoteCommand => "chat.type.emote", - _ => "chat.type.text.narrate", - } - } -} - -impl McBufReadable for PackedMessageSignature { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let id = u32::var_read_from(buf)?; - if id == 0 { - let full_signature = MessageSignature::read_from(buf)?; - - Ok(PackedMessageSignature::Signature(Box::new(full_signature))) - } else { - Ok(PackedMessageSignature::Id(id - 1)) - } - } -} -impl McBufWritable for PackedMessageSignature { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - match self { - PackedMessageSignature::Signature(full_signature) => { - 0u32.var_write_into(buf)?; - full_signature.write_into(buf)?; - } - PackedMessageSignature::Id(id) => { - (id + 1).var_write_into(buf)?; - } - } - Ok(()) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_read_player_chat_packet() { - let mut bytes = Cursor::new( - &[ - 55, 186, 28, 76, 92, 167, 177, 75, 188, 158, 200, 179, 191, 227, 16, 171, 145, 0, - 0, 4, 116, 101, 115, 116, 0, 0, 1, 140, 178, 225, 89, 103, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 10, 10, 0, 10, 104, 111, 118, 101, 114, 69, 118, 101, 110, 116, 10, 0, - 8, 99, 111, 110, 116, 101, 110, 116, 115, 8, 0, 4, 110, 97, 109, 101, 0, 12, 75, - 97, 115, 117, 109, 105, 77, 97, 114, 105, 115, 97, 11, 0, 2, 105, 100, 0, 0, 0, 4, - 186, 28, 76, 92, 167, 177, 75, 188, 158, 200, 179, 191, 227, 16, 171, 145, 8, 0, 4, - 116, 121, 112, 101, 0, 16, 109, 105, 110, 101, 99, 114, 97, 102, 116, 58, 112, 108, - 97, 121, 101, 114, 0, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 11, 115, 104, 111, - 119, 95, 101, 110, 116, 105, 116, 121, 0, 10, 0, 10, 99, 108, 105, 99, 107, 69, - 118, 101, 110, 116, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 15, 115, 117, 103, 103, - 101, 115, 116, 95, 99, 111, 109, 109, 97, 110, 100, 8, 0, 5, 118, 97, 108, 117, - 101, 0, 19, 47, 116, 101, 108, 108, 32, 75, 97, 115, 117, 109, 105, 77, 97, 114, - 105, 115, 97, 32, 0, 9, 0, 5, 101, 120, 116, 114, 97, 8, 0, 0, 0, 3, 0, 0, 0, 12, - 75, 97, 115, 117, 109, 105, 77, 97, 114, 105, 115, 97, 0, 0, 8, 0, 9, 105, 110, - 115, 101, 114, 116, 105, 111, 110, 0, 12, 75, 97, 115, 117, 109, 105, 77, 97, 114, - 105, 115, 97, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 0, - ][..], - ); - let _packet = ClientboundPlayerChatPacket::read_from(&mut bytes).unwrap(); - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_player_combat_end_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_combat_end_packet.rs deleted file mode 100755 index dafb839f..00000000 --- a/azalea-protocol/src/packets/game/clientbound_player_combat_end_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -/// Unused by the client in vanilla. -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerCombatEndPacket { - #[var] - pub duration: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_player_combat_enter_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_combat_enter_packet.rs deleted file mode 100755 index 42ee1838..00000000 --- a/azalea-protocol/src/packets/game/clientbound_player_combat_enter_packet.rs +++ /dev/null @@ -1,6 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -/// Unused in vanilla. -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerCombatEnterPacket {} diff --git a/azalea-protocol/src/packets/game/clientbound_player_combat_kill_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_combat_kill_packet.rs deleted file mode 100755 index c309342f..00000000 --- a/azalea-protocol/src/packets/game/clientbound_player_combat_kill_packet.rs +++ /dev/null @@ -1,11 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -/// Used to send a respawn screen. -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerCombatKillPacket { - #[var] - pub player_id: u32, - pub message: FormattedText, -} diff --git a/azalea-protocol/src/packets/game/clientbound_player_info_remove_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_info_remove_packet.rs deleted file mode 100644 index bb620272..00000000 --- a/azalea-protocol/src/packets/game/clientbound_player_info_remove_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; -use uuid::Uuid; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerInfoRemovePacket { - pub profile_ids: Vec, -} diff --git a/azalea-protocol/src/packets/game/clientbound_player_info_update_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_info_update_packet.rs deleted file mode 100644 index 2b286e64..00000000 --- a/azalea-protocol/src/packets/game/clientbound_player_info_update_packet.rs +++ /dev/null @@ -1,313 +0,0 @@ -use std::{ - collections::HashMap, - io::{Cursor, Write}, -}; - -use azalea_auth::game_profile::{GameProfile, ProfilePropertyValue}; -use azalea_buf::{ - BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, -}; -use azalea_chat::FormattedText; -use azalea_core::{bitset::FixedBitSet, game_type::GameMode}; -use azalea_protocol_macros::ClientboundGamePacket; -use uuid::Uuid; - -use super::serverbound_chat_session_update_packet::RemoteChatSessionData; - -#[derive(Clone, Debug, ClientboundGamePacket)] -pub struct ClientboundPlayerInfoUpdatePacket { - pub actions: ActionEnumSet, - pub entries: Vec, -} - -#[derive(Clone, Debug, Default)] -pub struct PlayerInfoEntry { - pub profile: GameProfile, - pub listed: bool, - pub latency: i32, - pub game_mode: GameMode, - pub display_name: Option, - pub list_order: i32, - pub chat_session: Option, -} - -#[derive(Clone, Debug, McBuf)] -pub struct AddPlayerAction { - pub name: String, - pub properties: HashMap, -} -#[derive(Clone, Debug, McBuf)] -pub struct InitializeChatAction { - pub chat_session: Option, -} -#[derive(Clone, Debug, McBuf)] -pub struct UpdateGameModeAction { - pub game_mode: GameMode, -} -#[derive(Clone, Debug, McBuf)] -pub struct UpdateListedAction { - pub listed: bool, -} -#[derive(Clone, Debug, McBuf)] -pub struct UpdateLatencyAction { - #[var] - pub latency: i32, -} -#[derive(Clone, Debug, McBuf)] -pub struct UpdateDisplayNameAction { - pub display_name: Option, -} -#[derive(Clone, Debug, McBuf)] -pub struct UpdateListOrderAction { - #[var] - pub list_order: i32, -} - -impl McBufReadable for ClientboundPlayerInfoUpdatePacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let actions = ActionEnumSet::read_from(buf)?; - let mut entries = Vec::new(); - - let entry_count = u32::var_read_from(buf)?; - for _ in 0..entry_count { - let profile_id = Uuid::read_from(buf)?; - let mut entry = PlayerInfoEntry::default(); - entry.profile.uuid = profile_id; - - if actions.add_player { - let action = AddPlayerAction::read_from(buf)?; - entry.profile.name = action.name; - entry.profile.properties = action.properties; - } - if actions.initialize_chat { - let action = InitializeChatAction::read_from(buf)?; - entry.chat_session = action.chat_session; - } - if actions.update_game_mode { - let action = UpdateGameModeAction::read_from(buf)?; - entry.game_mode = action.game_mode; - } - if actions.update_listed { - let action = UpdateListedAction::read_from(buf)?; - entry.listed = action.listed; - } - if actions.update_latency { - let action = UpdateLatencyAction::read_from(buf)?; - entry.latency = action.latency; - } - if actions.update_display_name { - let action = UpdateDisplayNameAction::read_from(buf)?; - entry.display_name = action.display_name; - } - if actions.update_list_order { - let action = UpdateListOrderAction::read_from(buf)?; - entry.list_order = action.list_order; - } - - entries.push(entry); - } - - Ok(ClientboundPlayerInfoUpdatePacket { actions, entries }) - } -} - -impl McBufWritable for ClientboundPlayerInfoUpdatePacket { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - self.actions.write_into(buf)?; - - (self.entries.len() as u32).var_write_into(buf)?; - for entry in &self.entries { - entry.profile.uuid.write_into(buf)?; - - if self.actions.add_player { - AddPlayerAction { - name: entry.profile.name.clone(), - properties: entry.profile.properties.clone(), - } - .write_into(buf)?; - } - if self.actions.initialize_chat { - InitializeChatAction { - chat_session: entry.chat_session.clone(), - } - .write_into(buf)?; - } - if self.actions.update_game_mode { - UpdateGameModeAction { - game_mode: entry.game_mode, - } - .write_into(buf)?; - } - if self.actions.update_listed { - UpdateListedAction { - listed: entry.listed, - } - .write_into(buf)?; - } - if self.actions.update_latency { - UpdateLatencyAction { - latency: entry.latency, - } - .write_into(buf)?; - } - if self.actions.update_display_name { - UpdateDisplayNameAction { - display_name: entry.display_name.clone(), - } - .write_into(buf)?; - } - } - - Ok(()) - } -} - -#[derive(Clone, Debug, PartialEq, Eq)] -pub struct ActionEnumSet { - pub add_player: bool, - pub initialize_chat: bool, - pub update_game_mode: bool, - pub update_listed: bool, - pub update_latency: bool, - pub update_display_name: bool, - pub update_list_order: bool, -} - -impl McBufReadable for ActionEnumSet { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let set = FixedBitSet::<7>::read_from(buf)?; - Ok(ActionEnumSet { - add_player: set.index(0), - initialize_chat: set.index(1), - update_game_mode: set.index(2), - update_listed: set.index(3), - update_latency: set.index(4), - update_display_name: set.index(5), - update_list_order: set.index(6), - }) - } -} - -impl McBufWritable for ActionEnumSet { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - let mut set = FixedBitSet::<7>::new(); - if self.add_player { - set.set(0); - } - if self.initialize_chat { - set.set(1); - } - if self.update_game_mode { - set.set(2); - } - if self.update_listed { - set.set(3); - } - if self.update_latency { - set.set(4); - } - if self.update_display_name { - set.set(5); - } - if self.update_list_order { - set.set(6); - } - set.write_into(buf)?; - Ok(()) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_action_enum_set() { - let data = ActionEnumSet { - add_player: true, - initialize_chat: false, - update_game_mode: true, - update_listed: false, - update_latency: true, - update_display_name: false, - update_list_order: true, - }; - let mut buf = Vec::new(); - data.write_into(&mut buf).unwrap(); - let mut data_cursor: Cursor<&[u8]> = Cursor::new(&buf); - let read_data = ActionEnumSet::read_from(&mut data_cursor).unwrap(); - assert_eq!(read_data, data); - } - - #[test] - fn read_player_info_update_packet() { - // from wynncraft - let mut bytes = Cursor::new( - &[ - 63, 1, 196, 217, 99, 243, 221, 101, 79, 183, 167, 88, 48, 71, 25, 49, 5, 142, 5, - 74, 66, 76, 80, 78, 1, 8, 116, 101, 120, 116, 117, 114, 101, 115, 152, 3, 101, 119, - 111, 103, 73, 67, 74, 48, 97, 87, 49, 108, 99, 51, 82, 104, 98, 88, 65, 105, 73, - 68, 111, 103, 77, 84, 99, 119, 77, 106, 99, 49, 78, 106, 89, 48, 77, 68, 81, 120, - 78, 105, 119, 75, 73, 67, 65, 105, 99, 72, 74, 118, 90, 109, 108, 115, 90, 85, 108, - 107, 73, 105, 65, 54, 73, 67, 74, 106, 78, 71, 81, 53, 78, 106, 78, 109, 77, 50, - 82, 107, 78, 106, 85, 48, 90, 109, 73, 51, 89, 84, 99, 49, 79, 68, 77, 119, 78, 68, - 99, 120, 79, 84, 77, 120, 77, 68, 85, 52, 90, 83, 73, 115, 67, 105, 65, 103, 73, - 110, 66, 121, 98, 50, 90, 112, 98, 71, 86, 79, 89, 87, 49, 108, 73, 105, 65, 54, - 73, 67, 74, 75, 81, 107, 120, 81, 84, 105, 73, 115, 67, 105, 65, 103, 73, 110, 78, - 112, 90, 50, 53, 104, 100, 72, 86, 121, 90, 86, 74, 108, 99, 88, 86, 112, 99, 109, - 86, 107, 73, 105, 65, 54, 73, 72, 82, 121, 100, 87, 85, 115, 67, 105, 65, 103, 73, - 110, 82, 108, 101, 72, 82, 49, 99, 109, 86, 122, 73, 105, 65, 54, 73, 72, 115, 75, - 73, 67, 65, 103, 73, 67, 74, 84, 83, 48, 108, 79, 73, 105, 65, 54, 73, 72, 115, 75, - 73, 67, 65, 103, 73, 67, 65, 103, 73, 110, 86, 121, 98, 67, 73, 103, 79, 105, 65, - 105, 97, 72, 82, 48, 99, 68, 111, 118, 76, 51, 82, 108, 101, 72, 82, 49, 99, 109, - 86, 122, 76, 109, 49, 112, 98, 109, 86, 106, 99, 109, 70, 109, 100, 67, 53, 117, - 90, 88, 81, 118, 100, 71, 86, 52, 100, 72, 86, 121, 90, 83, 56, 48, 79, 68, 107, - 120, 89, 84, 107, 50, 89, 84, 74, 107, 77, 84, 103, 120, 78, 84, 69, 49, 79, 68, - 107, 52, 78, 68, 89, 119, 77, 68, 82, 106, 77, 106, 100, 104, 78, 50, 86, 106, 77, - 106, 85, 53, 77, 87, 77, 120, 79, 68, 66, 108, 77, 84, 70, 109, 77, 122, 104, 107, - 89, 122, 69, 52, 77, 84, 74, 109, 77, 106, 100, 104, 77, 71, 82, 108, 78, 50, 69, - 120, 77, 87, 85, 120, 73, 103, 111, 103, 73, 67, 65, 103, 102, 81, 111, 103, 73, - 72, 48, 75, 102, 81, 61, 61, 1, 172, 5, 117, 69, 67, 88, 54, 83, 104, 55, 67, 100, - 87, 49, 77, 99, 78, 88, 122, 72, 73, 105, 90, 86, 43, 103, 111, 121, 47, 120, 53, - 102, 51, 65, 113, 119, 50, 115, 102, 114, 104, 106, 67, 118, 67, 102, 97, 54, 67, - 112, 55, 88, 116, 109, 103, 118, 113, 73, 114, 122, 100, 85, 72, 90, 102, 79, 100, - 100, 112, 109, 87, 70, 110, 70, 119, 97, 85, 109, 97, 76, 106, 86, 102, 121, 88, - 119, 115, 76, 48, 78, 108, 118, 98, 56, 78, 104, 121, 115, 113, 87, 47, 104, 75, - 120, 101, 86, 117, 90, 68, 71, 43, 102, 54, 98, 99, 98, 81, 113, 76, 79, 54, 83, - 66, 88, 111, 81, 74, 85, 104, 74, 66, 90, 102, 88, 78, 53, 51, 100, 102, 80, 98, - 75, 89, 81, 54, 68, 77, 57, 87, 102, 113, 81, 76, 100, 55, 121, 117, 119, 90, 81, - 68, 55, 120, 48, 54, 118, 102, 105, 72, 121, 48, 110, 87, 50, 99, 68, 111, 72, 101, - 71, 102, 72, 67, 53, 104, 52, 112, 84, 109, 65, 101, 100, 101, 109, 116, 48, 67, - 72, 113, 86, 54, 76, 67, 77, 89, 118, 101, 110, 84, 88, 68, 83, 81, 107, 82, 43, - 50, 53, 74, 76, 120, 101, 98, 74, 105, 98, 108, 54, 88, 106, 73, 118, 88, 120, 105, - 87, 68, 121, 85, 49, 65, 43, 121, 48, 79, 104, 53, 89, 115, 116, 121, 86, 116, 106, - 107, 76, 113, 67, 56, 85, 57, 118, 86, 110, 87, 65, 102, 111, 43, 52, 104, 78, 43, - 79, 51, 122, 108, 72, 117, 84, 50, 87, 76, 86, 121, 98, 43, 88, 72, 100, 67, 111, - 111, 88, 75, 82, 75, 83, 86, 71, 101, 122, 103, 75, 78, 47, 53, 65, 53, 67, 119, - 78, 112, 82, 87, 98, 81, 55, 109, 90, 47, 108, 51, 57, 84, 114, 100, 84, 99, 54, - 121, 79, 88, 73, 48, 56, 83, 101, 73, 54, 68, 118, 118, 50, 55, 78, 66, 112, 107, - 47, 97, 72, 119, 65, 49, 116, 105, 78, 108, 55, 122, 49, 103, 97, 79, 107, 113, - 107, 116, 54, 120, 85, 116, 70, 84, 85, 122, 72, 71, 97, 107, 69, 118, 105, 76, 72, - 120, 67, 99, 106, 98, 121, 88, 111, 76, 71, 101, 101, 50, 57, 81, 84, 73, 102, 99, - 97, 69, 56, 104, 108, 110, 73, 97, 74, 111, 115, 72, 117, 57, 116, 100, 54, 52, - 119, 74, 88, 74, 115, 69, 78, 114, 121, 69, 56, 70, 53, 52, 52, 116, 114, 84, 54, - 105, 112, 122, 73, 119, 43, 118, 120, 112, 76, 121, 88, 65, 87, 116, 103, 83, 113, - 76, 108, 107, 121, 78, 50, 77, 115, 57, 74, 89, 110, 100, 79, 111, 90, 57, 77, 53, - 84, 49, 87, 112, 75, 70, 97, 52, 55, 114, 112, 80, 106, 75, 114, 79, 107, 114, 110, - 100, 50, 97, 83, 51, 90, 86, 77, 120, 118, 79, 49, 111, 78, 47, 100, 84, 55, 116, - 77, 119, 82, 52, 109, 97, 55, 85, 73, 68, 50, 48, 84, 113, 105, 83, 75, 56, 108, - 76, 85, 100, 53, 48, 86, 119, 108, 112, 67, 116, 98, 76, 99, 71, 86, 82, 98, 78, - 84, 97, 108, 90, 83, 66, 56, 88, 65, 72, 72, 78, 100, 116, 88, 86, 50, 49, 111, 68, - 77, 116, 77, 122, 79, 104, 82, 109, 43, 57, 88, 81, 90, 79, 50, 55, 66, 69, 71, 65, - 47, 119, 117, 104, 113, 71, 108, 106, 82, 111, 76, 72, 111, 102, 98, 71, 48, 52, - 82, 55, 84, 43, 80, 99, 112, 77, 116, 65, 69, 105, 49, 100, 57, 99, 66, 90, 115, - 119, 84, 105, 107, 113, 114, 89, 49, 86, 49, 48, 106, 104, 77, 76, 118, 99, 99, 78, - 50, 109, 70, 43, 89, 86, 81, 101, 48, 90, 55, 43, 78, 100, 119, 119, 104, 121, 47, - 108, 79, 72, 81, 54, 71, 108, 122, 74, 110, 87, 122, 103, 50, 107, 61, 0, 255, 255, - 255, 255, 15, 1, 255, 255, 255, 255, 15, 1, 10, 8, 0, 4, 116, 101, 120, 116, 0, 0, - 0, - ][..], - ); - let _packet = ClientboundPlayerInfoUpdatePacket::read_from(&mut bytes).unwrap(); - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_player_look_at_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_look_at_packet.rs deleted file mode 100755 index 47c63d1f..00000000 --- a/azalea-protocol/src/packets/game/clientbound_player_look_at_packet.rs +++ /dev/null @@ -1,24 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerLookAtPacket { - pub from_anchor: Anchor, - pub x: f64, - pub y: f64, - pub z: f64, - pub entity: Option, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum Anchor { - Feet = 0, - Eyes = 1, -} - -#[derive(McBuf, Clone, Debug)] -pub struct AtEntity { - #[var] - pub entity: u32, - pub to_anchor: Anchor, -} diff --git a/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs deleted file mode 100755 index 2a9cebc6..00000000 --- a/azalea-protocol/src/packets/game/clientbound_player_position_packet.rs +++ /dev/null @@ -1,61 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable}; -use azalea_core::{bitset::FixedBitSet, position::Vec3}; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerPositionPacket { - #[var] - pub id: u32, - pub pos: Vec3, - pub delta_movement: Vec3, - pub y_rot: f32, - pub x_rot: f32, - pub relative_arguments: RelativeMovements, -} - -#[derive(Debug, Clone)] -pub struct RelativeMovements { - pub x: bool, - pub y: bool, - pub z: bool, - pub y_rot: bool, - pub x_rot: bool, -} - -impl McBufReadable for RelativeMovements { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - // yes minecraft seriously wastes that many bits, smh - let set = FixedBitSet::<32>::read_from(buf)?; - Ok(RelativeMovements { - x: set.index(0), - y: set.index(1), - z: set.index(2), - y_rot: set.index(3), - x_rot: set.index(4), - }) - } -} - -impl McBufWritable for RelativeMovements { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - let mut set = FixedBitSet::<5>::new(); - if self.x { - set.set(0); - } - if self.y { - set.set(1); - } - if self.z { - set.set(2); - } - if self.y_rot { - set.set(3); - } - if self.x_rot { - set.set(4); - } - set.write_into(buf) - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_player_rotation_packet.rs b/azalea-protocol/src/packets/game/clientbound_player_rotation_packet.rs deleted file mode 100755 index a1ad9bbe..00000000 --- a/azalea-protocol/src/packets/game/clientbound_player_rotation_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerRotationPacket { - pub y_rot: f32, - pub x_rot: f32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_pong_response_packet.rs b/azalea-protocol/src/packets/game/clientbound_pong_response_packet.rs deleted file mode 100755 index 0b48198e..00000000 --- a/azalea-protocol/src/packets/game/clientbound_pong_response_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundPongResponsePacket { - pub time: u64, -} diff --git a/azalea-protocol/src/packets/game/clientbound_projectile_power_packet.rs b/azalea-protocol/src/packets/game/clientbound_projectile_power_packet.rs deleted file mode 100644 index a665a2aa..00000000 --- a/azalea-protocol/src/packets/game/clientbound_projectile_power_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundProjectilePowerPacket { - pub id: u32, - pub acceleration_power: f64, -} diff --git a/azalea-protocol/src/packets/game/clientbound_recipe_book_add_packet.rs b/azalea-protocol/src/packets/game/clientbound_recipe_book_add_packet.rs deleted file mode 100755 index e025da7d..00000000 --- a/azalea-protocol/src/packets/game/clientbound_recipe_book_add_packet.rs +++ /dev/null @@ -1,79 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -use super::clientbound_update_recipes_packet::{Ingredient, SlotDisplayData}; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundRecipeBookAddPacket { - pub entries: Vec, - pub replace: bool, -} - -#[derive(Clone, Debug, McBuf)] -pub struct Entry { - pub contents: RecipeDisplayEntry, - pub flags: u8, -} - -#[derive(Clone, Debug, McBuf)] -pub struct RecipeDisplayEntry { - #[var] - pub id: u32, - pub display: RecipeDisplayData, - // ByteBufCodecs.OPTIONAL_VAR_INT - #[var] - pub group: u32, - pub category: azalea_registry::RecipeBookCategory, - pub crafting_requirements: Option>, -} - -/// [`azalea_registry::RecipeDisplay`] -#[derive(Clone, Debug, McBuf)] -pub enum RecipeDisplayData { - Shapeless(ShapelessCraftingRecipeDisplay), - Shaped(ShapedCraftingRecipeDisplay), - Furnace(FurnaceRecipeDisplay), - Stonecutter(StonecutterRecipeDisplay), - Smithing(SmithingRecipeDisplay), -} - -#[derive(Clone, Debug, McBuf)] -pub struct ShapelessCraftingRecipeDisplay { - pub ingredients: Vec, - pub result: SlotDisplayData, - pub crafting_station: SlotDisplayData, -} -#[derive(Clone, Debug, McBuf)] -pub struct ShapedCraftingRecipeDisplay { - #[var] - pub width: u32, - #[var] - pub height: u32, - pub ingredients: Vec, - pub result: SlotDisplayData, - pub crafting_station: SlotDisplayData, -} -#[derive(Clone, Debug, McBuf)] -pub struct FurnaceRecipeDisplay { - pub ingredient: SlotDisplayData, - pub fuel: SlotDisplayData, - pub result: SlotDisplayData, - pub crafting_station: SlotDisplayData, - #[var] - pub duration: u32, - pub experience: f32, -} -#[derive(Clone, Debug, McBuf)] -pub struct StonecutterRecipeDisplay { - pub input: SlotDisplayData, - pub result: SlotDisplayData, - pub crafting_station: SlotDisplayData, -} -#[derive(Clone, Debug, McBuf)] -pub struct SmithingRecipeDisplay { - pub template: SlotDisplayData, - pub base: SlotDisplayData, - pub addition: SlotDisplayData, - pub result: SlotDisplayData, - pub crafting_station: SlotDisplayData, -} diff --git a/azalea-protocol/src/packets/game/clientbound_recipe_book_remove_packet.rs b/azalea-protocol/src/packets/game/clientbound_recipe_book_remove_packet.rs deleted file mode 100755 index 678537ca..00000000 --- a/azalea-protocol/src/packets/game/clientbound_recipe_book_remove_packet.rs +++ /dev/null @@ -1,15 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -use super::{ - clientbound_entity_position_sync_packet::PositionMoveRotation, - clientbound_player_position_packet::RelativeMovements, -}; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundRecipeBookRemovePacket { - #[var] - pub id: u32, - pub change: PositionMoveRotation, - pub relatives: RelativeMovements, -} diff --git a/azalea-protocol/src/packets/game/clientbound_recipe_book_settings_packet.rs b/azalea-protocol/src/packets/game/clientbound_recipe_book_settings_packet.rs deleted file mode 100755 index 1180bd26..00000000 --- a/azalea-protocol/src/packets/game/clientbound_recipe_book_settings_packet.rs +++ /dev/null @@ -1,22 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundRecipeBookSettingsPacket { - pub book_settings: RecipeBookSettings, -} - -#[derive(Clone, Debug, McBuf)] -pub struct RecipeBookSettings { - pub gui_open: bool, - pub filtering_craftable: bool, - - pub furnace_gui_open: bool, - pub furnace_filtering_craftable: bool, - - pub blast_furnace_gui_open: bool, - pub blast_furnace_filtering_craftable: bool, - - pub smoker_gui_open: bool, - pub smoker_filtering_craftable: bool, -} diff --git a/azalea-protocol/src/packets/game/clientbound_remove_entities_packet.rs b/azalea-protocol/src/packets/game/clientbound_remove_entities_packet.rs deleted file mode 100755 index 7b192333..00000000 --- a/azalea-protocol/src/packets/game/clientbound_remove_entities_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundRemoveEntitiesPacket { - #[var] - pub entity_ids: Vec, -} diff --git a/azalea-protocol/src/packets/game/clientbound_remove_mob_effect_packet.rs b/azalea-protocol/src/packets/game/clientbound_remove_mob_effect_packet.rs deleted file mode 100755 index 87bf81bd..00000000 --- a/azalea-protocol/src/packets/game/clientbound_remove_mob_effect_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundRemoveMobEffectPacket { - #[var] - pub entity_id: u32, - pub effect: azalea_registry::MobEffect, -} diff --git a/azalea-protocol/src/packets/game/clientbound_reset_score_packet.rs b/azalea-protocol/src/packets/game/clientbound_reset_score_packet.rs deleted file mode 100644 index 8b24bbdf..00000000 --- a/azalea-protocol/src/packets/game/clientbound_reset_score_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundResetScorePacket { - pub owner: String, - pub objective_name: Option, -} diff --git a/azalea-protocol/src/packets/game/clientbound_resource_pack_pop_packet.rs b/azalea-protocol/src/packets/game/clientbound_resource_pack_pop_packet.rs deleted file mode 100644 index 34836c85..00000000 --- a/azalea-protocol/src/packets/game/clientbound_resource_pack_pop_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; -use uuid::Uuid; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundResourcePackPopPacket { - pub id: Option, -} diff --git a/azalea-protocol/src/packets/game/clientbound_resource_pack_push_packet.rs b/azalea-protocol/src/packets/game/clientbound_resource_pack_push_packet.rs deleted file mode 100644 index 1d5e00b1..00000000 --- a/azalea-protocol/src/packets/game/clientbound_resource_pack_push_packet.rs +++ /dev/null @@ -1,13 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; -use uuid::Uuid; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundResourcePackPushPacket { - pub id: Uuid, - pub url: String, - pub hash: String, - pub required: bool, - pub prompt: Option, -} diff --git a/azalea-protocol/src/packets/game/clientbound_respawn_packet.rs b/azalea-protocol/src/packets/game/clientbound_respawn_packet.rs deleted file mode 100755 index 7e20a843..00000000 --- a/azalea-protocol/src/packets/game/clientbound_respawn_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -use crate::packets::common::CommonPlayerSpawnInfo; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundRespawnPacket { - pub common: CommonPlayerSpawnInfo, - pub data_to_keep: u8, -} diff --git a/azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs b/azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs deleted file mode 100755 index 2bc77540..00000000 --- a/azalea-protocol/src/packets/game/clientbound_rotate_head_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundRotateHeadPacket { - #[var] - pub entity_id: u32, - pub y_head_rot: i8, -} diff --git a/azalea-protocol/src/packets/game/clientbound_section_blocks_update_packet.rs b/azalea-protocol/src/packets/game/clientbound_section_blocks_update_packet.rs deleted file mode 100755 index e92ca422..00000000 --- a/azalea-protocol/src/packets/game/clientbound_section_blocks_update_packet.rs +++ /dev/null @@ -1,45 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_block::BlockState; -use azalea_buf::{ - BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, -}; -use azalea_core::position::{ChunkSectionBlockPos, ChunkSectionPos}; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSectionBlocksUpdatePacket { - pub section_pos: ChunkSectionPos, - pub states: Vec, -} - -#[derive(Clone, Debug)] -pub struct BlockStateWithPosition { - pub pos: ChunkSectionBlockPos, - pub state: BlockState, -} - -impl McBufReadable for BlockStateWithPosition { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let data = u64::var_read_from(buf)?; - let position_part = data & 4095; - let state = (data >> 12) as u32; - let state = BlockState::try_from(state) - .map_err(|_| BufReadError::UnexpectedEnumVariant { id: state as i32 })?; - let pos = ChunkSectionBlockPos { - x: (position_part >> 8 & 15) as u8, - y: (position_part & 15) as u8, - z: (position_part >> 4 & 15) as u8, - }; - Ok(BlockStateWithPosition { pos, state }) - } -} - -impl McBufWritable for BlockStateWithPosition { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - let data = (self.state.id as u64) << 12 - | (u64::from(self.pos.x) << 8 | u64::from(self.pos.z) << 4 | u64::from(self.pos.y)); - u64::var_write_into(&data, buf)?; - Ok(()) - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_select_advancements_tab_packet.rs b/azalea-protocol/src/packets/game/clientbound_select_advancements_tab_packet.rs deleted file mode 100755 index c0d5f2ee..00000000 --- a/azalea-protocol/src/packets/game/clientbound_select_advancements_tab_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSelectAdvancementsTabPacket { - pub tab: Option, -} diff --git a/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs b/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs deleted file mode 100755 index a70a0aec..00000000 --- a/azalea-protocol/src/packets/game/clientbound_server_data_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundServerDataPacket { - pub motd: FormattedText, - pub icon_bytes: Option>, -} diff --git a/azalea-protocol/src/packets/game/clientbound_server_links_packet.rs b/azalea-protocol/src/packets/game/clientbound_server_links_packet.rs deleted file mode 100644 index 4b24a519..00000000 --- a/azalea-protocol/src/packets/game/clientbound_server_links_packet.rs +++ /dev/null @@ -1,34 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundServerLinksPacket { - pub links: Vec, -} - -#[derive(Clone, Debug, McBuf)] -pub struct ServerLinkEntry { - pub kind: ServerLinkKind, - pub link: String, -} - -#[derive(Clone, Debug, McBuf)] -pub enum ServerLinkKind { - Known(KnownLinkKind), - Component(FormattedText), -} - -#[derive(Clone, Copy, Debug, McBuf)] -pub enum KnownLinkKind { - BugReport, - CommunityGuidelines, - Support, - Status, - Feedback, - Community, - Website, - Forums, - News, - Announcements, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_action_bar_text_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_action_bar_text_packet.rs deleted file mode 100755 index 60b80fe9..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_action_bar_text_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetActionBarTextPacket { - pub text: FormattedText, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_border_center_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_border_center_packet.rs deleted file mode 100755 index d210b0ce..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_border_center_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetBorderCenterPacket { - pub new_center_x: f64, - pub new_center_z: f64, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_border_lerp_size_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_border_lerp_size_packet.rs deleted file mode 100755 index 5c80e897..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_border_lerp_size_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetBorderLerpSizePacket { - pub old_size: f64, - pub new_size: f64, - #[var] - pub lerp_time: u64, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_border_size_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_border_size_packet.rs deleted file mode 100755 index 3a86a720..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_border_size_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetBorderSizePacket { - pub size: f64, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_border_warning_delay_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_border_warning_delay_packet.rs deleted file mode 100755 index 4bf794ac..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_border_warning_delay_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetBorderWarningDelayPacket { - #[var] - pub warning_delay: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_border_warning_distance_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_border_warning_distance_packet.rs deleted file mode 100755 index ef1b6e17..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_border_warning_distance_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetBorderWarningDistancePacket { - #[var] - pub warning_blocks: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_camera_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_camera_packet.rs deleted file mode 100755 index 9da75dc7..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_camera_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetCameraPacket { - #[var] - pub camera_id: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_center_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_center_packet.rs deleted file mode 100755 index e9aecba9..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_center_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetChunkCacheCenterPacket { - #[var] - pub x: i32, - #[var] - pub z: i32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_radius_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_radius_packet.rs deleted file mode 100755 index 9718ca56..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_chunk_cache_radius_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetChunkCacheRadiusPacket { - #[var] - pub radius: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_cursor_item_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_cursor_item_packet.rs deleted file mode 100644 index 6a67b71c..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_cursor_item_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_inventory::ItemSlot; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetCursorItemPacket { - pub contents: Option, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_default_spawn_position_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_default_spawn_position_packet.rs deleted file mode 100755 index b45b645d..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_default_spawn_position_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::position::BlockPos; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetDefaultSpawnPositionPacket { - pub pos: BlockPos, - pub angle: f32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_display_chat_preview_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_display_chat_preview_packet.rs deleted file mode 100755 index 5aee614e..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_display_chat_preview_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetDisplayChatPreviewPacket { - pub enabled: bool, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_display_objective_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_display_objective_packet.rs deleted file mode 100755 index 7e5ed317..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_display_objective_packet.rs +++ /dev/null @@ -1,31 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetDisplayObjectivePacket { - pub slot: DisplaySlot, - pub objective_name: String, -} - -#[derive(Clone, Debug, Copy, McBuf)] -pub enum DisplaySlot { - List = 0, - Sidebar, - BelowName, - TeamBlack, - TeamDarkBlue, - TeamDarkGreen, - TeamDarkAqua, - TeamDarkRed, - TeamDarkPurple, - TeamGold, - TeamGray, - TeamDarkGray, - TeamBlue, - TeamGreen, - TeamAqua, - TeamRed, - TeamLightPurple, - TeamYellow, - TeamWhite, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs deleted file mode 100755 index 7d869650..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_entity::EntityMetadataItems; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetEntityDataPacket { - #[var] - pub id: u32, - pub packed_items: EntityMetadataItems, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_entity_link_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_entity_link_packet.rs deleted file mode 100755 index ac9dd944..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_entity_link_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetEntityLinkPacket { - pub source_id: u32, - pub dest_id: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_entity_motion_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_entity_motion_packet.rs deleted file mode 100755 index 4dcd807d..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_entity_motion_packet.rs +++ /dev/null @@ -1,11 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetEntityMotionPacket { - #[var] - pub id: u32, - pub xa: i16, - pub ya: i16, - pub za: i16, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs deleted file mode 100755 index 165d05db..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_equipment_packet.rs +++ /dev/null @@ -1,81 +0,0 @@ -use std::io::Cursor; - -use azalea_buf::{BufReadError, McBuf}; -use azalea_buf::{McBufReadable, McBufWritable}; -use azalea_inventory::ItemSlot; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetEquipmentPacket { - #[var] - pub entity_id: u32, - pub slots: EquipmentSlots, -} - -#[derive(Clone, Debug)] -pub struct EquipmentSlots { - pub slots: Vec<(EquipmentSlot, ItemSlot)>, -} - -impl McBufReadable for EquipmentSlots { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let mut slots = vec![]; - - loop { - let equipment_byte = u8::read_from(buf)?; - let equipment_slot = - EquipmentSlot::from_byte(equipment_byte & 127).ok_or_else(|| { - BufReadError::UnexpectedEnumVariant { - id: equipment_byte.into(), - } - })?; - let item = ItemSlot::read_from(buf)?; - slots.push((equipment_slot, item)); - if equipment_byte & 128 == 0 { - break; - }; - } - - Ok(EquipmentSlots { slots }) - } -} -impl McBufWritable for EquipmentSlots { - fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { - for i in 0..self.slots.len() { - let (equipment_slot, item) = &self.slots[i]; - let mut equipment_byte = *equipment_slot as u8; - if i != self.slots.len() - 1 { - equipment_byte |= 128; - } - equipment_byte.write_into(buf)?; - item.write_into(buf)?; - } - - Ok(()) - } -} - -#[derive(Clone, Debug, Copy, McBuf)] -pub enum EquipmentSlot { - MainHand = 0, - OffHand = 1, - Feet = 2, - Legs = 3, - Chest = 4, - Head = 5, -} - -impl EquipmentSlot { - #[must_use] - pub fn from_byte(byte: u8) -> Option { - match byte { - 0 => Some(EquipmentSlot::MainHand), - 1 => Some(EquipmentSlot::OffHand), - 2 => Some(EquipmentSlot::Feet), - 3 => Some(EquipmentSlot::Legs), - 4 => Some(EquipmentSlot::Chest), - 5 => Some(EquipmentSlot::Head), - _ => None, - } - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_experience_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_experience_packet.rs deleted file mode 100755 index f9590e26..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_experience_packet.rs +++ /dev/null @@ -1,11 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetExperiencePacket { - pub experience_progress: f32, - #[var] - pub experience_level: u32, - #[var] - pub total_experience: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_health_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_health_packet.rs deleted file mode 100755 index 72b7554d..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_health_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetHealthPacket { - pub health: f32, - #[var] - pub food: u32, - pub saturation: f32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_held_slot_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_held_slot_packet.rs deleted file mode 100644 index a83ae3cb..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_held_slot_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetHeldSlotPacket { - pub slot: u8, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_objective_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_objective_packet.rs deleted file mode 100755 index a9481ad1..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_objective_packet.rs +++ /dev/null @@ -1,82 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::{McBuf, McBufReadable, McBufWritable}; -use azalea_chat::{numbers::NumberFormat, FormattedText}; -use azalea_core::objectives::ObjectiveCriteria; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetObjectivePacket { - pub objective_name: String, - pub method: Method, -} - -#[derive(Clone, Copy, Debug, McBuf)] -pub enum MethodKind { - Add, - Remove, - Change, -} - -#[derive(Clone, Debug)] -pub enum Method { - Add { - display_name: FormattedText, - render_type: ObjectiveCriteria, - number_format: NumberFormat, - }, - Remove, - Change { - display_name: FormattedText, - render_type: ObjectiveCriteria, - number_format: NumberFormat, - }, -} - -impl McBufReadable for Method { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let kind = MethodKind::read_from(buf)?; - match kind { - MethodKind::Add => Ok(Method::Add { - display_name: FormattedText::read_from(buf)?, - render_type: ObjectiveCriteria::read_from(buf)?, - number_format: NumberFormat::read_from(buf)?, - }), - MethodKind::Remove => Ok(Method::Remove), - MethodKind::Change => Ok(Method::Change { - display_name: FormattedText::read_from(buf)?, - render_type: ObjectiveCriteria::read_from(buf)?, - number_format: NumberFormat::read_from(buf)?, - }), - } - } -} - -impl McBufWritable for Method { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - match self { - Method::Add { - display_name, - render_type, - number_format, - } => { - MethodKind::Add.write_into(buf)?; - display_name.write_into(buf)?; - render_type.write_into(buf)?; - number_format.write_into(buf)?; - } - Method::Remove => MethodKind::Remove.write_into(buf)?, - Method::Change { - display_name, - render_type, - number_format, - } => { - MethodKind::Change.write_into(buf)?; - display_name.write_into(buf)?; - render_type.write_into(buf)?; - number_format.write_into(buf)?; - } - } - Ok(()) - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_passengers_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_passengers_packet.rs deleted file mode 100755 index ac337d6e..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_passengers_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetPassengersPacket { - #[var] - pub vehicle: u32, - #[var] - pub passengers: Vec, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_player_inventory_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_player_inventory_packet.rs deleted file mode 100644 index c17fd310..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_player_inventory_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_inventory::ItemSlot; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetPlayerInventoryPacket { - #[var] - pub slot: i32, - pub contents: Option, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_player_team_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_player_team_packet.rs deleted file mode 100755 index 724b86aa..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_player_team_packet.rs +++ /dev/null @@ -1,74 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable}; -use azalea_chat::{style::ChatFormatting, FormattedText}; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetPlayerTeamPacket { - pub name: String, - pub method: Method, -} - -#[derive(Clone, Debug)] -pub enum Method { - Add((Parameters, PlayerList)), - Remove, - Change(Parameters), - Join(PlayerList), - Leave(PlayerList), -} - -impl McBufReadable for Method { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - Ok(match u8::read_from(buf)? { - 0 => Method::Add((Parameters::read_from(buf)?, PlayerList::read_from(buf)?)), - 1 => Method::Remove, - 2 => Method::Change(Parameters::read_from(buf)?), - 3 => Method::Join(PlayerList::read_from(buf)?), - 4 => Method::Leave(PlayerList::read_from(buf)?), - id => return Err(BufReadError::UnexpectedEnumVariant { id: i32::from(id) }), - }) - } -} - -impl McBufWritable for Method { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - match self { - Method::Add((parameters, playerlist)) => { - 0u8.write_into(buf)?; - parameters.write_into(buf)?; - playerlist.write_into(buf)?; - } - Method::Remove => { - 1u8.write_into(buf)?; - } - Method::Change(parameters) => { - 2u8.write_into(buf)?; - parameters.write_into(buf)?; - } - Method::Join(playerlist) => { - 3u8.write_into(buf)?; - playerlist.write_into(buf)?; - } - Method::Leave(playerlist) => { - 4u8.write_into(buf)?; - playerlist.write_into(buf)?; - } - } - Ok(()) - } -} - -#[derive(McBuf, Clone, Debug)] -pub struct Parameters { - pub display_name: FormattedText, - pub options: u8, - pub nametag_visibility: String, - pub collision_rule: String, - pub color: ChatFormatting, - pub player_prefix: FormattedText, - pub player_suffix: FormattedText, -} - -type PlayerList = Vec; diff --git a/azalea-protocol/src/packets/game/clientbound_set_score_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_score_packet.rs deleted file mode 100755 index 6de53f74..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_score_packet.rs +++ /dev/null @@ -1,13 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::{numbers::NumberFormat, FormattedText}; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetScorePacket { - pub owner: String, - pub objective_name: String, - #[var] - pub score: u32, - pub display: Option, - pub number_format: Option, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_simulation_distance_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_simulation_distance_packet.rs deleted file mode 100755 index 3efd1fa6..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_simulation_distance_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetSimulationDistancePacket { - #[var] - pub simulation_distance: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_subtitle_text_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_subtitle_text_packet.rs deleted file mode 100755 index 9b25ac05..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_subtitle_text_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetSubtitleTextPacket { - pub text: FormattedText, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_time_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_time_packet.rs deleted file mode 100755 index b73f082d..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_time_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetTimePacket { - pub game_time: u64, - pub day_time: u64, - pub tick_day_time: bool, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_title_text_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_title_text_packet.rs deleted file mode 100755 index fb00a4e5..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_title_text_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetTitleTextPacket { - pub text: FormattedText, -} diff --git a/azalea-protocol/src/packets/game/clientbound_set_titles_animation_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_titles_animation_packet.rs deleted file mode 100755 index 06faeb3c..00000000 --- a/azalea-protocol/src/packets/game/clientbound_set_titles_animation_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSetTitlesAnimationPacket { - pub fade_in: u32, - pub stay: u32, - pub fade_out: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_sound_entity_packet.rs b/azalea-protocol/src/packets/game/clientbound_sound_entity_packet.rs deleted file mode 100755 index 2e9252ae..00000000 --- a/azalea-protocol/src/packets/game/clientbound_sound_entity_packet.rs +++ /dev/null @@ -1,27 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSoundEntityPacket { - pub source: SoundSource, - #[var] - pub id: u32, - pub volume: f32, - pub pitch: f32, - #[var] - pub seed: u64, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum SoundSource { - Master = 0, - Music = 1, - Records = 2, - Weather = 3, - Blocks = 4, - Hostile = 5, - Neutral = 6, - Players = 7, - Ambient = 8, - Voice = 9, -} diff --git a/azalea-protocol/src/packets/game/clientbound_sound_packet.rs b/azalea-protocol/src/packets/game/clientbound_sound_packet.rs deleted file mode 100755 index 4d2493ed..00000000 --- a/azalea-protocol/src/packets/game/clientbound_sound_packet.rs +++ /dev/null @@ -1,29 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; -use azalea_registry::SoundEvent; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundSoundPacket { - pub sound: SoundEvent, - pub source: SoundSource, - pub x: i32, - pub y: i32, - pub z: i32, - pub volume: f32, - pub pitch: f32, - pub seed: u64, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum SoundSource { - Master = 0, - Music = 1, - Records = 2, - Weather = 3, - Blocks = 4, - Hostile = 5, - Neutral = 6, - Players = 7, - Ambient = 8, - Voice = 9, -} diff --git a/azalea-protocol/src/packets/game/clientbound_start_configuration_packet.rs b/azalea-protocol/src/packets/game/clientbound_start_configuration_packet.rs deleted file mode 100644 index b6ad9615..00000000 --- a/azalea-protocol/src/packets/game/clientbound_start_configuration_packet.rs +++ /dev/null @@ -1,5 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundStartConfigurationPacket {} diff --git a/azalea-protocol/src/packets/game/clientbound_stop_sound_packet.rs b/azalea-protocol/src/packets/game/clientbound_stop_sound_packet.rs deleted file mode 100755 index 48c80237..00000000 --- a/azalea-protocol/src/packets/game/clientbound_stop_sound_packet.rs +++ /dev/null @@ -1,51 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::{BufReadError, McBufReadable, McBufWritable}; -use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation}; -use azalea_protocol_macros::ClientboundGamePacket; - -use super::clientbound_sound_packet::SoundSource; - -#[derive(Clone, Debug, ClientboundGamePacket)] -pub struct ClientboundStopSoundPacket { - pub source: Option, - pub name: Option, -} - -impl McBufReadable for ClientboundStopSoundPacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let set = FixedBitSet::<2>::read_from(buf)?; - let source = if set.index(0) { - Some(SoundSource::read_from(buf)?) - } else { - None - }; - let name = if set.index(1) { - Some(ResourceLocation::read_from(buf)?) - } else { - None - }; - - Ok(Self { source, name }) - } -} - -impl McBufWritable for ClientboundStopSoundPacket { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - let mut set = FixedBitSet::<2>::new(); - if self.source.is_some() { - set.set(0); - } - if self.name.is_some() { - set.set(1); - } - set.write_into(buf)?; - if let Some(source) = &self.source { - source.write_into(buf)?; - } - if let Some(name) = &self.name { - name.write_into(buf)?; - } - Ok(()) - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_store_cookie_packet.rs b/azalea-protocol/src/packets/game/clientbound_store_cookie_packet.rs deleted file mode 100644 index 1c8ada28..00000000 --- a/azalea-protocol/src/packets/game/clientbound_store_cookie_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundStoreCookiePacket { - pub key: ResourceLocation, - pub payload: Vec, -} diff --git a/azalea-protocol/src/packets/game/clientbound_system_chat_packet.rs b/azalea-protocol/src/packets/game/clientbound_system_chat_packet.rs deleted file mode 100755 index 691a62a1..00000000 --- a/azalea-protocol/src/packets/game/clientbound_system_chat_packet.rs +++ /dev/null @@ -1,45 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket, PartialEq)] -pub struct ClientboundSystemChatPacket { - pub content: FormattedText, - pub overlay: bool, -} - -#[cfg(test)] -mod tests { - use std::io::Cursor; - - use azalea_buf::McBufReadable; - - use super::*; - - #[test] - fn test_clientbound_system_chat_packet() { - #[rustfmt::skip] - let bytes = [ - 10, 9, 0, 4, 119, 105, 116, 104, 10, 0, 0, 0, 2, 10, 0, 10, 104, 111, 118, 101, 114, 69, 118, 101, 110, 116, 10, 0, 8, 99, 111, 110, 116, 101, 110, 116, 115, 8, 0, 4, 110, 97, 109, 101, 0, 3, 112, 121, 53, 11, 0, 2, 105, 100, 0, 0, 0, 4, 101, 54, 191, 237, 134, 149, 72, 253, 131, 161, 236, 210, 76, 242, 160, 253, 8, 0, 4, 116, 121, 112, 101, 0, 16, 109, 105, 110, 101, 99, 114, 97, 102, 116, 58, 112, 108, 97, 121, 101, 114, 0, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 11, 115, 104, 111, 119, 95, 101, 110, 116, 105, 116, 121, 0, 10, 0, 10, 99, 108, 105, 99, 107, 69, 118, 101, 110, 116, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 15, 115, 117, 103, 103, 101, 115, 116, 95, 99, 111, 109, 109, 97, 110, 100, 8, 0, 5, 118, 97, 108, 117, 101, 0, 10, 47, 116, 101, 108, 108, 32, 112, 121, 53, 32, 0, 8, 0, 9, 105, 110, 115, 101, 114, 116, 105, 111, 110, 0, 3, 112, 121, 53, 8, 0, 4, 116, 101, 120, 116, 0, 3, 112, 121, 53, 0, 9, 0, 4, 119, 105, 116, 104, 10, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 1, 0, 10, 0, 10, 104, 111, 118, 101, 114, 69, 118, 101, 110, 116, 10, 0, 8, 99, 111, 110, 116, 101, 110, 116, 115, 8, 0, 2, 105, 100, 0, 25, 109, 105, 110, 101, 99, 114, 97, 102, 116, 58, 100, 105, 97, 109, 111, 110, 100, 95, 112, 105, 99, 107, 97, 120, 101, 8, 0, 3, 116, 97, 103, 0, 10, 123, 68, 97, 109, 97, 103, 101, 58, 48, 125, 0, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 9, 115, 104, 111, 119, 95, 105, 116, 101, 109, 0, 9, 0, 4, 119, 105, 116, 104, 10, 0, 0, 0, 1, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 8, 0, 9, 116, 114, 97, 110, 115, 108, 97, 116, 101, 0, 30, 105, 116, 101, 109, 46, 109, 105, 110, 101, 99, 114, 97, 102, 116, 46, 100, 105, 97, 109, 111, 110, 100, 95, 112, 105, 99, 107, 97, 120, 101, 0, 8, 0, 4, 116, 101, 120, 116, 0, 0, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 5, 119, 104, 105, 116, 101, 8, 0, 9, 116, 114, 97, 110, 115, 108, 97, 116, 101, 0, 20, 99, 104, 97, 116, 46, 115, 113, 117, 97, 114, 101, 95, 98, 114, 97, 99, 107, 101, 116, 115, 0, 10, 0, 10, 104, 111, 118, 101, 114, 69, 118, 101, 110, 116, 10, 0, 8, 99, 111, 110, 116, 101, 110, 116, 115, 8, 0, 4, 110, 97, 109, 101, 0, 3, 112, 121, 53, 11, 0, 2, 105, 100, 0, 0, 0, 4, 101, 54, 191, 237, 134, 149, 72, 253, 131, 161, 236, 210, 76, 242, 160, 253, 8, 0, 4, 116, 121, 112, 101, 0, 16, 109, 105, 110, 101, 99, 114, 97, 102, 116, 58, 112, 108, 97, 121, 101, 114, 0, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 11, 115, 104, 111, 119, 95, 101, 110, 116, 105, 116, 121, 0, 10, 0, 10, 99, 108, 105, 99, 107, 69, 118, 101, 110, 116, 8, 0, 6, 97, 99, 116, 105, 111, 110, 0, 15, 115, 117, 103, 103, 101, 115, 116, 95, 99, 111, 109, 109, 97, 110, 100, 8, 0, 5, 118, 97, 108, 117, 101, 0, 10, 47, 116, 101, 108, 108, 32, 112, 121, 53, 32, 0, 8, 0, 9, 105, 110, 115, 101, 114, 116, 105, 111, 110, 0, 3, 112, 121, 53, 8, 0, 4, 116, 101, 120, 116, 0, 3, 112, 121, 53, 0, 8, 0, 9, 116, 114, 97, 110, 115, 108, 97, 116, 101, 0, 28, 99, 111, 109, 109, 97, 110, 100, 115, 46, 103, 105, 118, 101, 46, 115, 117, 99, 99, 101, 115, 115, 46, 115, 105, 110, 103, 108, 101, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 114, 97, 121, 1, 0, 6, 105, 116, 97, 108, 105, 99, 1, 8, 0, 9, 116, 114, 97, 110, 115, 108, 97, 116, 101, 0, 15, 99, 104, 97, 116, 46, 116, 121, 112, 101, 46, 97, 100, 109, 105, 110, 0, 0 - ]; - - let packet = ClientboundSystemChatPacket::read_from(&mut Cursor::new(&bytes)).unwrap(); - assert_eq!( - packet.content.to_string(), - "[py5: Gave 1 [Diamond Pickaxe] to py5]".to_string() - ); - } - - #[test] - fn test_translate_with_string_array_clientbound_system_chat_packet() { - #[rustfmt::skip] - let bytes = [ - 10, 9, 0, 4, 119, 105, 116, 104, 8, 0, 0, 0, 1, 0, 14, 109, 105, 110, 101, 99, 114, 97, 102, 116, 58, 100, 117, 115, 116, 8, 0, 9, 116, 114, 97, 110, 115, 108, 97, 116, 101, 0, 25, 99, 111, 109, 109, 97, 110, 100, 115, 46, 112, 97, 114, 116, 105, 99, 108, 101, 46, 115, 117, 99, 99, 101, 115, 115, 0, 0 - ]; - let packet = ClientboundSystemChatPacket::read_from(&mut Cursor::new(&bytes)).unwrap(); - assert_eq!( - packet.content.to_string(), - "Displaying particle minecraft:dust".to_string() - ); - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_tab_list_packet.rs b/azalea-protocol/src/packets/game/clientbound_tab_list_packet.rs deleted file mode 100755 index 03557f5a..00000000 --- a/azalea-protocol/src/packets/game/clientbound_tab_list_packet.rs +++ /dev/null @@ -1,28 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundTabListPacket { - pub header: FormattedText, - pub footer: FormattedText, -} - -#[cfg(test)] -mod tests { - use std::io::Cursor; - - use azalea_buf::McBufReadable; - - use super::*; - - #[test] - fn test_packet_from_viaversion() { - #[rustfmt::skip] - let mut bytes = Cursor::new(&[ - 10, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 3, 1, 0, 4, 98, 111, 108, 100, 1, 8, 0, 4, 116, 101, 120, 116, 0, 16, 50, 66, 85, 73, 76, 68, 69, 82, 83, 50, 84, 79, 79, 76, 83, 10, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 114, 97, 121, 0, 8, 0, 0, 0, 1, 10, 0, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 111, 108, 100, 8, 0, 4, 116, 101, 120, 116, 0, 27, 80, 101, 110, 100, 105, 110, 103, 32, 99, 111, 110, 110, 101, 99, 116, 105, 111, 110, 32, 116, 111, 32, 50, 98, 50, 116, 10, 0, 8, 0, 4, 116, 101, 120, 116, 0, 1, 10, 0, 10, 9, 0, 5, 101, 120, 116, 114, 97, 10, 0, 0, 0, 1, 8, 0, 5, 99, 111, 108, 111, 114, 0, 4, 103, 111, 108, 100, 8, 0, 4, 116, 101, 120, 116, 0, 72, 84, 104, 105, 115, 32, 97, 99, 99, 111, 117, 110, 116, 32, 104, 97, 115, 32, 112, 114, 105, 111, 114, 105, 116, 121, 32, 115, 116, 97, 116, 117, 115, 32, 97, 110, 100, 32, 119, 105, 108, 108, 32, 98, 101, 32, 112, 108, 97, 99, 101, 100, 32, 105, 110, 32, 97, 32, 115, 104, 111, 114, 116, 101, 114, 32, 113, 117, 101, 117, 101, 46, 10, 0, 8, 0, 4, 116, 101, 120, 116, 0, 1, 10, 0 - ][..]); - let _packet = ClientboundTabListPacket::read_from(&mut bytes).unwrap(); - assert!(bytes.get_ref()[bytes.position() as usize..].is_empty()); - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_tag_query_packet.rs b/azalea-protocol/src/packets/game/clientbound_tag_query_packet.rs deleted file mode 100755 index d1073cd5..00000000 --- a/azalea-protocol/src/packets/game/clientbound_tag_query_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; -use simdnbt::owned::NbtTag; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundTagQueryPacket { - #[var] - pub transaction_id: u32, - pub tag: NbtTag, -} diff --git a/azalea-protocol/src/packets/game/clientbound_take_item_entity_packet.rs b/azalea-protocol/src/packets/game/clientbound_take_item_entity_packet.rs deleted file mode 100755 index 9e29a0fe..00000000 --- a/azalea-protocol/src/packets/game/clientbound_take_item_entity_packet.rs +++ /dev/null @@ -1,12 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundTakeItemEntityPacket { - #[var] - pub item_id: u32, - #[var] - pub player_id: u32, - #[var] - pub amount: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_teleport_entity_packet.rs b/azalea-protocol/src/packets/game/clientbound_teleport_entity_packet.rs deleted file mode 100755 index c8fbc718..00000000 --- a/azalea-protocol/src/packets/game/clientbound_teleport_entity_packet.rs +++ /dev/null @@ -1,13 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::position::Vec3; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundTeleportEntityPacket { - #[var] - pub id: u32, - pub position: Vec3, - pub y_rot: i8, - pub x_rot: i8, - pub on_ground: bool, -} diff --git a/azalea-protocol/src/packets/game/clientbound_ticking_state_packet.rs b/azalea-protocol/src/packets/game/clientbound_ticking_state_packet.rs deleted file mode 100644 index a85429a2..00000000 --- a/azalea-protocol/src/packets/game/clientbound_ticking_state_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundTickingStatePacket { - pub tick_rate: f32, - pub is_frozen: bool, -} diff --git a/azalea-protocol/src/packets/game/clientbound_ticking_step_packet.rs b/azalea-protocol/src/packets/game/clientbound_ticking_step_packet.rs deleted file mode 100644 index 5a5e6440..00000000 --- a/azalea-protocol/src/packets/game/clientbound_ticking_step_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundTickingStepPacket { - #[var] - pub tick_steps: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_transfer_packet.rs b/azalea-protocol/src/packets/game/clientbound_transfer_packet.rs deleted file mode 100644 index dbce36e0..00000000 --- a/azalea-protocol/src/packets/game/clientbound_transfer_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundTransferPacket { - pub host: String, - #[var] - pub port: u32, -} diff --git a/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs deleted file mode 100755 index 5934b443..00000000 --- a/azalea-protocol/src/packets/game/clientbound_update_advancements_packet.rs +++ /dev/null @@ -1,205 +0,0 @@ -use std::collections::HashMap; -use std::io::Cursor; - -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_core::resource_location::ResourceLocation; -use azalea_inventory::ItemSlot; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundUpdateAdvancementsPacket { - pub reset: bool, - pub added: Vec, - pub removed: Vec, - pub progress: HashMap, -} - -#[derive(Clone, Debug, McBuf)] -pub struct Advancement { - pub parent_id: Option, - pub display: Option, - pub requirements: Vec>, - pub sends_telemetry_event: bool, -} - -#[derive(Clone, Debug)] -pub struct DisplayInfo { - pub title: FormattedText, - pub description: FormattedText, - pub icon: ItemSlot, - pub frame: FrameType, - pub show_toast: bool, - pub hidden: bool, - pub background: Option, - pub x: f32, - pub y: f32, -} - -impl azalea_buf::McBufWritable for DisplayInfo { - fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { - self.title.write_into(buf)?; - self.description.write_into(buf)?; - self.icon.write_into(buf)?; - self.frame.write_into(buf)?; - - let mut data: u32 = 0; - if self.background.is_some() { - data |= 0b001; - } - if self.show_toast { - data |= 0b010; - } - if self.hidden { - data |= 0b100; - } - data.write_into(buf)?; - - if let Some(background) = &self.background { - background.write_into(buf)?; - } - self.x.write_into(buf)?; - self.y.write_into(buf)?; - Ok(()) - } -} -impl azalea_buf::McBufReadable for DisplayInfo { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let title = azalea_buf::McBufReadable::read_from(buf)?; - let description = azalea_buf::McBufReadable::read_from(buf)?; - let icon = azalea_buf::McBufReadable::read_from(buf)?; - let frame = azalea_buf::McBufReadable::read_from(buf)?; - - let data = u32::read_from(buf)?; - let has_background = (data & 0b1) != 0; - let show_toast = (data & 0b10) != 0; - let hidden = (data & 0b100) != 0; - - let background = if has_background { - Some(ResourceLocation::read_from(buf)?) - } else { - None - }; - let x = azalea_buf::McBufReadable::read_from(buf)?; - let y = azalea_buf::McBufReadable::read_from(buf)?; - Ok(DisplayInfo { - title, - description, - icon, - frame, - show_toast, - hidden, - background, - x, - y, - }) - } -} - -#[derive(Clone, Debug, Copy, McBuf)] -pub enum FrameType { - Task = 0, - Challenge = 1, - Goal = 2, -} - -pub type AdvancementProgress = HashMap; - -#[derive(Clone, Debug, McBuf)] -pub struct CriterionProgress { - pub date: Option, -} - -#[derive(Clone, Debug, McBuf)] -pub struct AdvancementHolder { - pub id: ResourceLocation, - pub value: Advancement, -} - -#[cfg(test)] -mod tests { - use azalea_buf::{McBufReadable, McBufWritable}; - - use super::*; - - #[test] - fn test() { - let packet = ClientboundUpdateAdvancementsPacket { - reset: true, - added: [AdvancementHolder { - id: ResourceLocation::new("minecraft:test"), - value: Advancement { - parent_id: None, - display: Some(DisplayInfo { - title: FormattedText::from("title".to_string()), - description: FormattedText::from("description".to_string()), - icon: ItemSlot::Empty, - frame: FrameType::Task, - show_toast: true, - hidden: false, - background: None, - x: 0.0, - y: 0.0, - }), - requirements: Vec::new(), - sends_telemetry_event: false, - }, - }] - .into_iter() - .collect(), - removed: vec![ResourceLocation::new("minecraft:test2")], - progress: [( - ResourceLocation::new("minecraft:test3"), - [( - "minecraft:test4".to_string(), - CriterionProgress { - date: Some(123456789), - }, - )] - .into_iter() - .collect(), - )] - .into_iter() - .collect(), - }; - - let mut data = Vec::new(); - packet.write_into(&mut data).unwrap(); - let mut buf: Cursor<&[u8]> = Cursor::new(&data); - - let read_packet = ClientboundUpdateAdvancementsPacket::read_from(&mut buf).unwrap(); - assert_eq!(packet.reset, read_packet.reset); - assert_eq!(packet.removed, read_packet.removed); - - let advancement = packet - .added - .into_iter() - .find_map(|a| { - if a.id == ResourceLocation::new("minecraft:test") { - Some(a.value) - } else { - None - } - }) - .unwrap() - .clone(); - let read_advancement = read_packet - .added - .into_iter() - .find_map(|a| { - if a.id == ResourceLocation::new("minecraft:test") { - Some(a.value) - } else { - None - } - }) - .unwrap() - .clone(); - assert_eq!(advancement.parent_id, read_advancement.parent_id); - - let display = advancement.display.unwrap(); - let read_display = read_advancement.display.unwrap(); - assert_eq!(display.title, read_display.title); - assert_eq!(display.description, read_display.description); - } -} diff --git a/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs deleted file mode 100755 index 19d4a715..00000000 --- a/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs +++ /dev/null @@ -1,18 +0,0 @@ -use azalea_buf::McBuf; -use azalea_entity::attributes::AttributeModifier; -use azalea_protocol_macros::ClientboundGamePacket; -use azalea_registry::Attribute; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundUpdateAttributesPacket { - #[var] - pub entity_id: u32, - pub values: Vec, -} - -#[derive(Clone, Debug, McBuf)] -pub struct AttributeSnapshot { - pub attribute: Attribute, - pub base: f64, - pub modifiers: Vec, -} diff --git a/azalea-protocol/src/packets/game/clientbound_update_enabled_features_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_enabled_features_packet.rs deleted file mode 100644 index e08358f7..00000000 --- a/azalea-protocol/src/packets/game/clientbound_update_enabled_features_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundUpdateEnabledFeaturesPacket { - pub features: Vec, -} diff --git a/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs deleted file mode 100755 index 5c7abf3a..00000000 --- a/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs +++ /dev/null @@ -1,15 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundGamePacket; -use azalea_registry::MobEffect; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundUpdateMobEffectPacket { - #[var] - pub entity_id: u32, - pub mob_effect: MobEffect, - #[var] - pub effect_amplifier: u32, - #[var] - pub effect_duration_ticks: u32, - pub flags: u8, -} diff --git a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs deleted file mode 100755 index 4c950f90..00000000 --- a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs +++ /dev/null @@ -1,74 +0,0 @@ -use std::collections::HashMap; - -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_inventory::ItemSlot; -use azalea_protocol_macros::ClientboundGamePacket; -use azalea_registry::HolderSet; - -#[derive(Clone, Debug, PartialEq, McBuf, ClientboundGamePacket)] -pub struct ClientboundUpdateRecipesPacket { - pub item_sets: HashMap, - pub stonecutter_recipes: Vec, -} - -#[derive(Clone, Debug, PartialEq, McBuf)] -pub struct SingleInputEntry { - pub input: Ingredient, - pub recipe: SelectableRecipe, -} -#[derive(Clone, Debug, PartialEq, McBuf)] -pub struct SelectableRecipe { - pub option_display: SlotDisplayData, -} - -/// [`azalea_registry::SlotDisplay`] -#[derive(Clone, Debug, PartialEq, McBuf)] -pub enum SlotDisplayData { - Empty, - AnyFuel, - Item(ItemSlotDisplay), - ItemStack(ItemStackSlotDisplay), - Tag(ResourceLocation), - SmithingTrim(Box), - WithRemainder(Box), - Composite(CompositeSlotDisplay), -} - -#[derive(Clone, Debug, PartialEq, McBuf)] -pub struct ItemSlotDisplay { - pub item: azalea_registry::Item, -} -#[derive(Clone, Debug, PartialEq, McBuf)] -pub struct ItemStackSlotDisplay { - pub stack: ItemSlot, -} -#[derive(Clone, Debug, PartialEq, McBuf)] -pub struct TagSlotDisplay { - pub tag: azalea_registry::Item, -} -#[derive(Clone, Debug, PartialEq, McBuf)] -pub struct SmithingTrimDemoSlotDisplay { - pub base: SlotDisplayData, - pub material: SlotDisplayData, - pub pattern: SlotDisplayData, -} -#[derive(Clone, Debug, PartialEq, McBuf)] -pub struct WithRemainderSlotDisplay { - pub input: SlotDisplayData, - pub remainder: SlotDisplayData, -} -#[derive(Clone, Debug, PartialEq, McBuf)] -pub struct CompositeSlotDisplay { - pub contents: Vec, -} - -#[derive(Clone, Debug, PartialEq, McBuf)] -pub struct RecipePropertySet { - pub items: Vec, -} - -#[derive(Clone, Debug, PartialEq, McBuf)] -pub struct Ingredient { - pub allowed: HolderSet, -} diff --git a/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs deleted file mode 100755 index bcdef64a..00000000 --- a/azalea-protocol/src/packets/game/clientbound_update_tags_packet.rs +++ /dev/null @@ -1,74 +0,0 @@ -use std::io::Cursor; -use std::ops::Deref; -use std::{collections::HashMap, io::Write}; - -use azalea_buf::{BufReadError, McBuf, McBufVarReadable, McBufVarWritable}; -use azalea_buf::{McBufReadable, McBufWritable}; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundGamePacket; - -#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] -pub struct ClientboundUpdateTagsPacket { - pub tags: TagMap, -} - -#[derive(Clone, Debug)] -pub struct Tags { - pub name: ResourceLocation, - pub elements: Vec, -} - -#[derive(Clone, Debug)] -pub struct TagMap(pub HashMap>); - -impl McBufReadable for TagMap { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let length = u32::var_read_from(buf)? as usize; - let mut data = HashMap::with_capacity(length); - for _ in 0..length { - let tag_type = ResourceLocation::read_from(buf)?; - let tags_count = i32::var_read_from(buf)? as usize; - let mut tags_vec = Vec::with_capacity(tags_count); - for _ in 0..tags_count { - let tags = Tags::read_from(buf)?; - tags_vec.push(tags); - } - data.insert(tag_type, tags_vec); - } - Ok(TagMap(data)) - } -} - -impl McBufWritable for TagMap { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - (self.len() as u32).var_write_into(buf)?; - for (k, v) in &self.0 { - k.write_into(buf)?; - v.write_into(buf)?; - } - Ok(()) - } -} -impl McBufReadable for Tags { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let name = ResourceLocation::read_from(buf)?; - let elements = Vec::::var_read_from(buf)?; - Ok(Tags { name, elements }) - } -} - -impl McBufWritable for Tags { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - self.name.write_into(buf)?; - self.elements.var_write_into(buf)?; - Ok(()) - } -} - -impl Deref for TagMap { - type Target = HashMap>; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} diff --git a/azalea-protocol/src/packets/game/mod.rs b/azalea-protocol/src/packets/game/mod.rs index 55d6faaf..757dd27f 100755 --- a/azalea-protocol/src/packets/game/mod.rs +++ b/azalea-protocol/src/packets/game/mod.rs @@ -1,394 +1,202 @@ -pub mod clientbound_add_entity_packet; -pub mod clientbound_add_experience_orb_packet; -pub mod clientbound_animate_packet; -pub mod clientbound_award_stats_packet; -pub mod clientbound_block_changed_ack_packet; -pub mod clientbound_block_destruction_packet; -pub mod clientbound_block_entity_data_packet; -pub mod clientbound_block_event_packet; -pub mod clientbound_block_update_packet; -pub mod clientbound_boss_event_packet; -pub mod clientbound_bundle_packet; -pub mod clientbound_change_difficulty_packet; -pub mod clientbound_chunk_batch_finished_packet; -pub mod clientbound_chunk_batch_start_packet; -pub mod clientbound_chunks_biomes_packet; -pub mod clientbound_clear_titles_packet; -pub mod clientbound_command_suggestions_packet; -pub mod clientbound_commands_packet; -pub mod clientbound_container_close_packet; -pub mod clientbound_container_set_content_packet; -pub mod clientbound_container_set_data_packet; -pub mod clientbound_container_set_slot_packet; -pub mod clientbound_cookie_request_packet; -pub mod clientbound_cooldown_packet; -pub mod clientbound_custom_chat_completions_packet; -pub mod clientbound_custom_payload_packet; -pub mod clientbound_custom_report_details_packet; -pub mod clientbound_damage_event_packet; -pub mod clientbound_debug_sample_packet; -pub mod clientbound_delete_chat_packet; -pub mod clientbound_disconnect_packet; -pub mod clientbound_disguised_chat_packet; -pub mod clientbound_entity_event_packet; -pub mod clientbound_entity_position_sync_packet; -pub mod clientbound_explode_packet; -pub mod clientbound_forget_level_chunk_packet; -pub mod clientbound_game_event_packet; -pub mod clientbound_horse_screen_open_packet; -pub mod clientbound_hurt_animation_packet; -pub mod clientbound_initialize_border_packet; -pub mod clientbound_keep_alive_packet; -pub mod clientbound_level_chunk_with_light_packet; -pub mod clientbound_level_event_packet; -pub mod clientbound_level_particles_packet; -pub mod clientbound_light_update_packet; -pub mod clientbound_login_packet; -pub mod clientbound_map_item_data_packet; -pub mod clientbound_merchant_offers_packet; -pub mod clientbound_move_entity_pos_packet; -pub mod clientbound_move_entity_pos_rot_packet; -pub mod clientbound_move_entity_rot_packet; -pub mod clientbound_move_minecart_packet; -pub mod clientbound_move_vehicle_packet; -pub mod clientbound_open_book_packet; -pub mod clientbound_open_screen_packet; -pub mod clientbound_open_sign_editor_packet; -pub mod clientbound_ping_packet; -pub mod clientbound_place_ghost_recipe_packet; -pub mod clientbound_player_abilities_packet; -pub mod clientbound_player_chat_packet; -pub mod clientbound_player_combat_end_packet; -pub mod clientbound_player_combat_enter_packet; -pub mod clientbound_player_combat_kill_packet; -pub mod clientbound_player_info_remove_packet; -pub mod clientbound_player_info_update_packet; -pub mod clientbound_player_look_at_packet; -pub mod clientbound_player_position_packet; -pub mod clientbound_player_rotation_packet; -pub mod clientbound_pong_response_packet; -pub mod clientbound_projectile_power_packet; -pub mod clientbound_recipe_book_add_packet; -pub mod clientbound_recipe_book_remove_packet; -pub mod clientbound_recipe_book_settings_packet; -pub mod clientbound_remove_entities_packet; -pub mod clientbound_remove_mob_effect_packet; -pub mod clientbound_reset_score_packet; -pub mod clientbound_resource_pack_pop_packet; -pub mod clientbound_resource_pack_push_packet; -pub mod clientbound_respawn_packet; -pub mod clientbound_rotate_head_packet; -pub mod clientbound_section_blocks_update_packet; -pub mod clientbound_select_advancements_tab_packet; -pub mod clientbound_server_data_packet; -pub mod clientbound_server_links_packet; -pub mod clientbound_set_action_bar_text_packet; -pub mod clientbound_set_border_center_packet; -pub mod clientbound_set_border_lerp_size_packet; -pub mod clientbound_set_border_size_packet; -pub mod clientbound_set_border_warning_delay_packet; -pub mod clientbound_set_border_warning_distance_packet; -pub mod clientbound_set_camera_packet; -pub mod clientbound_set_chunk_cache_center_packet; -pub mod clientbound_set_chunk_cache_radius_packet; -pub mod clientbound_set_cursor_item_packet; -pub mod clientbound_set_default_spawn_position_packet; -pub mod clientbound_set_display_objective_packet; -pub mod clientbound_set_entity_data_packet; -pub mod clientbound_set_entity_link_packet; -pub mod clientbound_set_entity_motion_packet; -pub mod clientbound_set_equipment_packet; -pub mod clientbound_set_experience_packet; -pub mod clientbound_set_health_packet; -pub mod clientbound_set_held_slot_packet; -pub mod clientbound_set_objective_packet; -pub mod clientbound_set_passengers_packet; -pub mod clientbound_set_player_inventory_packet; -pub mod clientbound_set_player_team_packet; -pub mod clientbound_set_score_packet; -pub mod clientbound_set_simulation_distance_packet; -pub mod clientbound_set_subtitle_text_packet; -pub mod clientbound_set_time_packet; -pub mod clientbound_set_title_text_packet; -pub mod clientbound_set_titles_animation_packet; -pub mod clientbound_sound_entity_packet; -pub mod clientbound_sound_packet; -pub mod clientbound_start_configuration_packet; -pub mod clientbound_stop_sound_packet; -pub mod clientbound_store_cookie_packet; -pub mod clientbound_system_chat_packet; -pub mod clientbound_tab_list_packet; -pub mod clientbound_tag_query_packet; -pub mod clientbound_take_item_entity_packet; -pub mod clientbound_teleport_entity_packet; -pub mod clientbound_ticking_state_packet; -pub mod clientbound_ticking_step_packet; -pub mod clientbound_transfer_packet; -pub mod clientbound_update_advancements_packet; -pub mod clientbound_update_attributes_packet; -pub mod clientbound_update_mob_effect_packet; -pub mod clientbound_update_recipes_packet; -pub mod clientbound_update_tags_packet; -pub mod serverbound_accept_teleportation_packet; -pub mod serverbound_block_entity_tag_query_packet; -pub mod serverbound_change_difficulty_packet; -pub mod serverbound_chat_ack_packet; -pub mod serverbound_chat_command_packet; -pub mod serverbound_chat_command_signed_packet; -pub mod serverbound_chat_packet; -pub mod serverbound_chat_session_update_packet; -pub mod serverbound_chunk_batch_received_packet; -pub mod serverbound_client_command_packet; -pub mod serverbound_client_information_packet; -pub mod serverbound_client_tick_end_packet; -pub mod serverbound_command_suggestion_packet; -pub mod serverbound_configuration_acknowledged_packet; -pub mod serverbound_container_button_click_packet; -pub mod serverbound_container_click_packet; -pub mod serverbound_container_close_packet; -pub mod serverbound_container_slot_state_changed_packet; -pub mod serverbound_cookie_response_packet; -pub mod serverbound_custom_payload_packet; -pub mod serverbound_debug_sample_subscription; -pub mod serverbound_edit_book_packet; -pub mod serverbound_entity_tag_query_packet; -pub mod serverbound_interact_packet; -pub mod serverbound_jigsaw_generate_packet; -pub mod serverbound_keep_alive_packet; -pub mod serverbound_lock_difficulty_packet; -pub mod serverbound_move_player_pos_packet; -pub mod serverbound_move_player_pos_rot_packet; -pub mod serverbound_move_player_rot_packet; -pub mod serverbound_move_player_status_only_packet; -pub mod serverbound_move_vehicle_packet; -pub mod serverbound_paddle_boat_packet; -pub mod serverbound_pick_item_packet; -pub mod serverbound_ping_request_packet; -pub mod serverbound_place_recipe_packet; -pub mod serverbound_player_abilities_packet; -pub mod serverbound_player_action_packet; -pub mod serverbound_player_command_packet; -pub mod serverbound_player_input_packet; -pub mod serverbound_pong_packet; -pub mod serverbound_recipe_book_change_settings_packet; -pub mod serverbound_recipe_book_seen_recipe_packet; -pub mod serverbound_rename_item_packet; -pub mod serverbound_resource_pack_packet; -pub mod serverbound_seen_advancements_packet; -pub mod serverbound_select_bundle_item_packet; -pub mod serverbound_select_trade_packet; -pub mod serverbound_set_beacon_packet; -pub mod serverbound_set_carried_item_packet; -pub mod serverbound_set_command_block_packet; -pub mod serverbound_set_command_minecart_packet; -pub mod serverbound_set_creative_mode_slot_packet; -pub mod serverbound_set_jigsaw_block_packet; -pub mod serverbound_set_structure_block_packet; -pub mod serverbound_sign_update_packet; -pub mod serverbound_swing_packet; -pub mod serverbound_teleport_to_entity_packet; -pub mod serverbound_use_item_on_packet; -pub mod serverbound_use_item_packet; +// NOTE: This file is generated automatically by codegen/packet.py. +// Don't edit it directly! use azalea_protocol_macros::declare_state_packets; -// see GameProtocols.java in the decompiled vanilla source - -declare_state_packets!( - GamePacket, - Serverbound => { - 0x00: serverbound_accept_teleportation_packet::ServerboundAcceptTeleportationPacket, - 0x01: serverbound_block_entity_tag_query_packet::ServerboundBlockEntityTagQueryPacket, - 0x02: serverbound_select_bundle_item_packet::ServerboundSelectBundleItemPacket, - 0x03: serverbound_change_difficulty_packet::ServerboundChangeDifficultyPacket, - 0x04: serverbound_chat_ack_packet::ServerboundChatAckPacket, - 0x05: serverbound_chat_command_packet::ServerboundChatCommandPacket, - 0x06: serverbound_chat_command_signed_packet::ServerboundChatCommandSignedPacket, - 0x07: serverbound_chat_packet::ServerboundChatPacket, - 0x08: serverbound_chat_session_update_packet::ServerboundChatSessionUpdatePacket, - 0x09: serverbound_chunk_batch_received_packet::ServerboundChunkBatchReceivedPacket, - 0x0a: serverbound_client_command_packet::ServerboundClientCommandPacket, - 0x0b: serverbound_client_tick_end_packet::ServerboundTickEndPacket, - 0x0c: serverbound_client_information_packet::ServerboundClientInformationPacket, - 0x0d: serverbound_command_suggestion_packet::ServerboundCommandSuggestionPacket, - 0x0e: serverbound_configuration_acknowledged_packet::ServerboundConfigurationAcknowledgedPacket, - 0x0f: serverbound_container_button_click_packet::ServerboundContainerButtonClickPacket, - 0x10: serverbound_container_click_packet::ServerboundContainerClickPacket, - 0x11: serverbound_container_close_packet::ServerboundContainerClosePacket, - 0x12: serverbound_container_slot_state_changed_packet::ServerboundContainerSlotStateChangedPacket, - 0x13: serverbound_cookie_response_packet::ServerboundCookieResponsePacket, - 0x14: serverbound_custom_payload_packet::ServerboundCustomPayloadPacket, - 0x15: serverbound_debug_sample_subscription::ServerboundDebugSampleSubscription, - 0x16: serverbound_edit_book_packet::ServerboundEditBookPacket, - 0x17: serverbound_entity_tag_query_packet::ServerboundEntityTagQueryPacket, - 0x18: serverbound_interact_packet::ServerboundInteractPacket, - 0x19: serverbound_jigsaw_generate_packet::ServerboundJigsawGeneratePacket, - 0x1a: serverbound_keep_alive_packet::ServerboundKeepAlivePacket, - 0x1b: serverbound_lock_difficulty_packet::ServerboundLockDifficultyPacket, - 0x1c: serverbound_move_player_pos_packet::ServerboundMovePlayerPosPacket, - 0x1d: serverbound_move_player_pos_rot_packet::ServerboundMovePlayerPosRotPacket, - 0x1e: serverbound_move_player_rot_packet::ServerboundMovePlayerRotPacket, - 0x1f: serverbound_move_player_status_only_packet::ServerboundMovePlayerStatusOnlyPacket, - 0x20: serverbound_move_vehicle_packet::ServerboundMoveVehiclePacket, - 0x21: serverbound_paddle_boat_packet::ServerboundPaddleBoatPacket, - 0x22: serverbound_pick_item_packet::ServerboundPickItemPacket, - 0x23: serverbound_ping_request_packet::ServerboundPingRequestPacket, - 0x24: serverbound_place_recipe_packet::ServerboundPlaceRecipePacket, - 0x25: serverbound_player_abilities_packet::ServerboundPlayerAbilitiesPacket, - 0x26: serverbound_player_action_packet::ServerboundPlayerActionPacket, - 0x27: serverbound_player_command_packet::ServerboundPlayerCommandPacket, - 0x28: serverbound_player_input_packet::ServerboundPlayerInputPacket, - 0x29: serverbound_pong_packet::ServerboundPongPacket, - 0x2a: serverbound_recipe_book_change_settings_packet::ServerboundRecipeBookChangeSettingsPacket, - 0x2b: serverbound_recipe_book_seen_recipe_packet::ServerboundRecipeBookSeenRecipePacket, - 0x2c: serverbound_rename_item_packet::ServerboundRenameItemPacket, - 0x2d: serverbound_resource_pack_packet::ServerboundResourcePackPacket, - 0x2e: serverbound_seen_advancements_packet::ServerboundSeenAdvancementsPacket, - 0x2f: serverbound_select_trade_packet::ServerboundSelectTradePacket, - 0x30: serverbound_set_beacon_packet::ServerboundSetBeaconPacket, - 0x31: serverbound_set_carried_item_packet::ServerboundSetCarriedItemPacket, - 0x32: serverbound_set_command_block_packet::ServerboundSetCommandBlockPacket, - 0x33: serverbound_set_command_minecart_packet::ServerboundSetCommandMinecartPacket, - 0x34: serverbound_set_creative_mode_slot_packet::ServerboundSetCreativeModeSlotPacket, - 0x35: serverbound_set_jigsaw_block_packet::ServerboundSetJigsawBlockPacket, - 0x36: serverbound_set_structure_block_packet::ServerboundSetStructureBlockPacket, - 0x37: serverbound_sign_update_packet::ServerboundSignUpdatePacket, - 0x38: serverbound_swing_packet::ServerboundSwingPacket, - 0x39: serverbound_teleport_to_entity_packet::ServerboundTeleportToEntityPacket, - 0x3a: serverbound_use_item_on_packet::ServerboundUseItemOnPacket, - 0x3b: serverbound_use_item_packet::ServerboundUseItemPacket, - }, - Clientbound => { - 0x00: clientbound_bundle_packet::ClientboundBundlePacket, - 0x01: clientbound_add_entity_packet::ClientboundAddEntityPacket, - 0x02: clientbound_add_experience_orb_packet::ClientboundAddExperienceOrbPacket, - 0x03: clientbound_animate_packet::ClientboundAnimatePacket, - 0x04: clientbound_award_stats_packet::ClientboundAwardStatsPacket, - 0x05: clientbound_block_changed_ack_packet::ClientboundBlockChangedAckPacket, - 0x06: clientbound_block_destruction_packet::ClientboundBlockDestructionPacket, - 0x07: clientbound_block_entity_data_packet::ClientboundBlockEntityDataPacket, - 0x08: clientbound_block_event_packet::ClientboundBlockEventPacket, - 0x09: clientbound_block_update_packet::ClientboundBlockUpdatePacket, - 0x0a: clientbound_boss_event_packet::ClientboundBossEventPacket, - 0x0b: clientbound_change_difficulty_packet::ClientboundChangeDifficultyPacket, - 0x0c: clientbound_chunk_batch_finished_packet::ClientboundChunkBatchFinishedPacket, - 0x0d: clientbound_chunk_batch_start_packet::ClientboundChunkBatchStartPacket, - 0x0e: clientbound_chunks_biomes_packet::ClientboundChunksBiomesPacket, - 0x0f: clientbound_clear_titles_packet::ClientboundClearTitlesPacket, - 0x10: clientbound_command_suggestions_packet::ClientboundCommandSuggestionsPacket, - 0x11: clientbound_commands_packet::ClientboundCommandsPacket, - 0x12: clientbound_container_close_packet::ClientboundContainerClosePacket, - 0x13: clientbound_container_set_content_packet::ClientboundContainerSetContentPacket, - 0x14: clientbound_container_set_data_packet::ClientboundContainerSetDataPacket, - 0x15: clientbound_container_set_slot_packet::ClientboundContainerSetSlotPacket, - 0x16: clientbound_cookie_request_packet::ClientboundCookieRequestPacket, - 0x17: clientbound_cooldown_packet::ClientboundCooldownPacket, - 0x18: clientbound_custom_chat_completions_packet::ClientboundCustomChatCompletionsPacket, - 0x19: clientbound_custom_payload_packet::ClientboundCustomPayloadPacket, - 0x1a: clientbound_damage_event_packet::ClientboundDamageEventPacket, - 0x1b: clientbound_debug_sample_packet::ClientboundDebugSamplePacket, - 0x1c: clientbound_delete_chat_packet::ClientboundDeleteChatPacket, - 0x1d: clientbound_disconnect_packet::ClientboundDisconnectPacket, - 0x1e: clientbound_disguised_chat_packet::ClientboundDisguisedChatPacket, - 0x1f: clientbound_entity_event_packet::ClientboundEntityEventPacket, - 0x20: clientbound_entity_position_sync_packet::ClientboundEntityPositionSyncPacket, - 0x21: clientbound_explode_packet::ClientboundExplodePacket, - 0x22: clientbound_forget_level_chunk_packet::ClientboundForgetLevelChunkPacket, - 0x23: clientbound_game_event_packet::ClientboundGameEventPacket, - 0x24: clientbound_horse_screen_open_packet::ClientboundHorseScreenOpenPacket, - 0x25: clientbound_hurt_animation_packet::ClientboundHurtAnimationPacket, - 0x26: clientbound_initialize_border_packet::ClientboundInitializeBorderPacket, - 0x27: clientbound_keep_alive_packet::ClientboundKeepAlivePacket, - 0x28: clientbound_level_chunk_with_light_packet::ClientboundLevelChunkWithLightPacket, - 0x29: clientbound_level_event_packet::ClientboundLevelEventPacket, - 0x2a: clientbound_level_particles_packet::ClientboundLevelParticlesPacket, - 0x2b: clientbound_light_update_packet::ClientboundLightUpdatePacket, - 0x2c: clientbound_login_packet::ClientboundLoginPacket, - 0x2d: clientbound_map_item_data_packet::ClientboundMapItemDataPacket, - 0x2e: clientbound_merchant_offers_packet::ClientboundMerchantOffersPacket, - 0x2f: clientbound_move_entity_pos_packet::ClientboundMoveEntityPosPacket, - 0x30: clientbound_move_entity_pos_rot_packet::ClientboundMoveEntityPosRotPacket, - 0x31: clientbound_move_minecart_packet::ClientboundMoveMinecartPacket, - 0x32: clientbound_move_entity_rot_packet::ClientboundMoveEntityRotPacket, - 0x33: clientbound_move_vehicle_packet::ClientboundMoveVehiclePacket, - 0x34: clientbound_open_book_packet::ClientboundOpenBookPacket, - 0x35: clientbound_open_screen_packet::ClientboundOpenScreenPacket, - 0x36: clientbound_open_sign_editor_packet::ClientboundOpenSignEditorPacket, - 0x37: clientbound_ping_packet::ClientboundPingPacket, - 0x38: clientbound_pong_response_packet::ClientboundPongResponsePacket, - 0x39: clientbound_place_ghost_recipe_packet::ClientboundPlaceGhostRecipePacket, - 0x3a: clientbound_player_abilities_packet::ClientboundPlayerAbilitiesPacket, - 0x3b: clientbound_player_chat_packet::ClientboundPlayerChatPacket, - 0x3c: clientbound_player_combat_end_packet::ClientboundPlayerCombatEndPacket, - 0x3d: clientbound_player_combat_enter_packet::ClientboundPlayerCombatEnterPacket, - 0x3e: clientbound_player_combat_kill_packet::ClientboundPlayerCombatKillPacket, - 0x3f: clientbound_player_info_remove_packet::ClientboundPlayerInfoRemovePacket, - 0x40: clientbound_player_info_update_packet::ClientboundPlayerInfoUpdatePacket, - 0x41: clientbound_player_look_at_packet::ClientboundPlayerLookAtPacket, - 0x42: clientbound_player_position_packet::ClientboundPlayerPositionPacket, - 0x43: clientbound_player_rotation_packet::ClientboundPlayerRotationPacket, - 0x44: clientbound_recipe_book_add_packet::ClientboundRecipeBookAddPacket, - 0x45: clientbound_recipe_book_remove_packet::ClientboundRecipeBookRemovePacket, - 0x46: clientbound_recipe_book_settings_packet::ClientboundRecipeBookSettingsPacket, - 0x47: clientbound_remove_entities_packet::ClientboundRemoveEntitiesPacket, - 0x48: clientbound_remove_mob_effect_packet::ClientboundRemoveMobEffectPacket, - 0x49: clientbound_reset_score_packet::ClientboundResetScorePacket, - 0x4a: clientbound_resource_pack_pop_packet::ClientboundResourcePackPopPacket, - 0x4b: clientbound_resource_pack_push_packet::ClientboundResourcePackPushPacket, - 0x4c: clientbound_respawn_packet::ClientboundRespawnPacket, - 0x4d: clientbound_rotate_head_packet::ClientboundRotateHeadPacket, - 0x4e: clientbound_section_blocks_update_packet::ClientboundSectionBlocksUpdatePacket, - 0x4f: clientbound_select_advancements_tab_packet::ClientboundSelectAdvancementsTabPacket, - 0x50: clientbound_server_data_packet::ClientboundServerDataPacket, - 0x51: clientbound_set_action_bar_text_packet::ClientboundSetActionBarTextPacket, - 0x52: clientbound_set_border_center_packet::ClientboundSetBorderCenterPacket, - 0x53: clientbound_set_border_lerp_size_packet::ClientboundSetBorderLerpSizePacket, - 0x54: clientbound_set_border_size_packet::ClientboundSetBorderSizePacket, - 0x55: clientbound_set_border_warning_delay_packet::ClientboundSetBorderWarningDelayPacket, - 0x56: clientbound_set_border_warning_distance_packet::ClientboundSetBorderWarningDistancePacket, - 0x57: clientbound_set_camera_packet::ClientboundSetCameraPacket, - 0x58: clientbound_set_chunk_cache_center_packet::ClientboundSetChunkCacheCenterPacket, - 0x59: clientbound_set_chunk_cache_radius_packet::ClientboundSetChunkCacheRadiusPacket, - 0x5a: clientbound_set_cursor_item_packet::ClientboundSetCursorItemPacket, - 0x5b: clientbound_set_default_spawn_position_packet::ClientboundSetDefaultSpawnPositionPacket, - 0x5c: clientbound_set_display_objective_packet::ClientboundSetDisplayObjectivePacket, - 0x5d: clientbound_set_entity_data_packet::ClientboundSetEntityDataPacket, - 0x5e: clientbound_set_entity_link_packet::ClientboundSetEntityLinkPacket, - 0x5f: clientbound_set_entity_motion_packet::ClientboundSetEntityMotionPacket, - 0x60: clientbound_set_equipment_packet::ClientboundSetEquipmentPacket, - 0x61: clientbound_set_experience_packet::ClientboundSetExperiencePacket, - 0x62: clientbound_set_health_packet::ClientboundSetHealthPacket, - 0x63: clientbound_set_held_slot_packet::ClientboundSetHeldSlotPacket, - 0x64: clientbound_set_objective_packet::ClientboundSetObjectivePacket, - 0x65: clientbound_set_passengers_packet::ClientboundSetPassengersPacket, - 0x66: clientbound_set_player_inventory_packet::ClientboundSetPlayerInventoryPacket, - 0x67: clientbound_set_player_team_packet::ClientboundSetPlayerTeamPacket, - 0x68: clientbound_set_score_packet::ClientboundSetScorePacket, - 0x69: clientbound_set_simulation_distance_packet::ClientboundSetSimulationDistancePacket, - 0x6a: clientbound_set_subtitle_text_packet::ClientboundSetSubtitleTextPacket, - 0x6b: clientbound_set_time_packet::ClientboundSetTimePacket, - 0x6c: clientbound_set_title_text_packet::ClientboundSetTitleTextPacket, - 0x6d: clientbound_set_titles_animation_packet::ClientboundSetTitlesAnimationPacket, - 0x6e: clientbound_sound_entity_packet::ClientboundSoundEntityPacket, - 0x6f: clientbound_sound_packet::ClientboundSoundPacket, - 0x70: clientbound_start_configuration_packet::ClientboundStartConfigurationPacket, - 0x71: clientbound_stop_sound_packet::ClientboundStopSoundPacket, - 0x72: clientbound_store_cookie_packet::ClientboundStoreCookiePacket, - 0x73: clientbound_system_chat_packet::ClientboundSystemChatPacket, - 0x74: clientbound_tab_list_packet::ClientboundTabListPacket, - 0x75: clientbound_tag_query_packet::ClientboundTagQueryPacket, - 0x76: clientbound_take_item_entity_packet::ClientboundTakeItemEntityPacket, - 0x77: clientbound_teleport_entity_packet::ClientboundTeleportEntityPacket, - 0x78: clientbound_ticking_state_packet::ClientboundTickingStatePacket, - 0x79: clientbound_ticking_step_packet::ClientboundTickingStepPacket, - 0x7a: clientbound_transfer_packet::ClientboundTransferPacket, - 0x7b: clientbound_update_advancements_packet::ClientboundUpdateAdvancementsPacket, - 0x7c: clientbound_update_attributes_packet::ClientboundUpdateAttributesPacket, - 0x7d: clientbound_update_mob_effect_packet::ClientboundUpdateMobEffectPacket, - 0x7e: clientbound_update_recipes_packet::ClientboundUpdateRecipesPacket, - 0x7f: clientbound_update_tags_packet::ClientboundUpdateTagsPacket, - 0x80: clientbound_projectile_power_packet::ClientboundProjectilePowerPacket, - 0x81: clientbound_custom_report_details_packet::ClientboundCustomReportDetailsPacket, - 0x82: clientbound_server_links_packet::ClientboundServerLinksPacket - } +declare_state_packets!(GamePacket, + Clientbound => [ + bundle_delimiter, + add_entity, + add_experience_orb, + 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, + ticking_state, + ticking_step, + transfer, + update_advancements, + update_attributes, + update_mob_effect, + update_recipes, + update_tags, + projectile_power, + custom_report_details, + server_links, + ], + Serverbound => [ + accept_teleportation, + block_entity_tag_query, + bundle_item_selected, + change_difficulty, + 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, + ping_request, + place_recipe, + player_abilities, + player_action, + player_command, + player_input, + 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, + sign_update, + swing, + teleport_to_entity, + use_item_on, + use_item, + ] ); diff --git a/azalea-protocol/src/packets/game/s_accept_teleportation.rs b/azalea-protocol/src/packets/game/s_accept_teleportation.rs new file mode 100755 index 00000000..dedc125a --- /dev/null +++ b/azalea-protocol/src/packets/game/s_accept_teleportation.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundAcceptTeleportation { + #[var] + pub id: u32, +} diff --git a/azalea-protocol/src/packets/game/s_block_entity_tag_query.rs b/azalea-protocol/src/packets/game/s_block_entity_tag_query.rs new file mode 100644 index 00000000..159f12dc --- /dev/null +++ b/azalea-protocol/src/packets/game/s_block_entity_tag_query.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_core::position::BlockPos; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundBlockEntityTagQuery { + #[var] + pub transaction_id: u32, + pub pos: BlockPos, +} diff --git a/azalea-protocol/src/packets/game/s_bundle_item_selected.rs b/azalea-protocol/src/packets/game/s_bundle_item_selected.rs new file mode 100644 index 00000000..552e51f8 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_bundle_item_selected.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundBundleItemSelected { + #[var] + pub slot_id: i32, + #[var] + pub selected_item_index: u32, +} diff --git a/azalea-protocol/src/packets/game/s_change_difficulty.rs b/azalea-protocol/src/packets/game/s_change_difficulty.rs new file mode 100755 index 00000000..7dcd3c83 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_change_difficulty.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_core::difficulty::Difficulty; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChangeDifficulty { + pub difficulty: Difficulty, +} diff --git a/azalea-protocol/src/packets/game/s_chat.rs b/azalea-protocol/src/packets/game/s_chat.rs new file mode 100755 index 00000000..03bafd11 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_chat.rs @@ -0,0 +1,20 @@ +use azalea_buf::AzBuf; +use azalea_core::bitset::FixedBitSet; +use azalea_crypto::MessageSignature; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChat { + pub message: String, + pub timestamp: u64, + pub salt: u64, + pub signature: Option, + pub last_seen_messages: LastSeenMessagesUpdate, +} + +#[derive(Clone, Debug, AzBuf, Default)] +pub struct LastSeenMessagesUpdate { + #[var] + pub messages: u32, + pub acknowledged: FixedBitSet<20>, +} diff --git a/azalea-protocol/src/packets/game/s_chat_ack.rs b/azalea-protocol/src/packets/game/s_chat_ack.rs new file mode 100755 index 00000000..d4b6efd6 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_chat_ack.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChatAck { + #[var] + pub messages: u32, +} diff --git a/azalea-protocol/src/packets/game/s_chat_command.rs b/azalea-protocol/src/packets/game/s_chat_command.rs new file mode 100755 index 00000000..4fdab9f9 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_chat_command.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChatCommand { + pub command: String, +} diff --git a/azalea-protocol/src/packets/game/s_chat_command_signed.rs b/azalea-protocol/src/packets/game/s_chat_command_signed.rs new file mode 100755 index 00000000..c20f3c6d --- /dev/null +++ b/azalea-protocol/src/packets/game/s_chat_command_signed.rs @@ -0,0 +1,20 @@ +use azalea_buf::AzBuf; +use azalea_crypto::MessageSignature; +use azalea_protocol_macros::ServerboundGamePacket; + +use super::s_chat::LastSeenMessagesUpdate; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChatCommandSigned { + pub command: String, + pub timestamp: u64, + pub salt: u64, + pub argument_signatures: Vec, + pub last_seen_messages: LastSeenMessagesUpdate, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct ArgumentSignature { + pub name: String, + pub signature: MessageSignature, +} diff --git a/azalea-protocol/src/packets/game/s_chat_preview.rs b/azalea-protocol/src/packets/game/s_chat_preview.rs new file mode 100755 index 00000000..3d2bf34e --- /dev/null +++ b/azalea-protocol/src/packets/game/s_chat_preview.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChatPreview { + pub query_id: i32, + pub query: String, +} diff --git a/azalea-protocol/src/packets/game/s_chat_session_update.rs b/azalea-protocol/src/packets/game/s_chat_session_update.rs new file mode 100644 index 00000000..f3499983 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_chat_session_update.rs @@ -0,0 +1,21 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChatSessionUpdate { + pub chat_session: RemoteChatSessionData, +} + +#[derive(Clone, Debug, PartialEq, Eq, AzBuf)] +pub struct RemoteChatSessionData { + pub session_id: Uuid, + pub profile_public_key: ProfilePublicKeyData, +} + +#[derive(Clone, Debug, AzBuf, PartialEq, Eq)] +pub struct ProfilePublicKeyData { + pub expires_at: u64, + pub key: Vec, + pub key_signature: Vec, +} diff --git a/azalea-protocol/src/packets/game/s_chunk_batch_received.rs b/azalea-protocol/src/packets/game/s_chunk_batch_received.rs new file mode 100644 index 00000000..faa50932 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_chunk_batch_received.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundChunkBatchReceived { + pub desired_chunks_per_tick: f32, +} diff --git a/azalea-protocol/src/packets/game/s_client_command.rs b/azalea-protocol/src/packets/game/s_client_command.rs new file mode 100755 index 00000000..5742bdb4 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_client_command.rs @@ -0,0 +1,13 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundClientCommand { + pub action: Action, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum Action { + PerformRespawn = 0, + RequestStats = 1, +} diff --git a/azalea-protocol/src/packets/game/s_client_information.rs b/azalea-protocol/src/packets/game/s_client_information.rs new file mode 100755 index 00000000..5861212c --- /dev/null +++ b/azalea-protocol/src/packets/game/s_client_information.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +use crate::common::client_information::ClientInformation; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundClientInformation { + pub information: ClientInformation, +} diff --git a/azalea-protocol/src/packets/game/s_client_tick_end.rs b/azalea-protocol/src/packets/game/s_client_tick_end.rs new file mode 100644 index 00000000..d8d93049 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_client_tick_end.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundClientTickEnd {} diff --git a/azalea-protocol/src/packets/game/s_command_suggestion.rs b/azalea-protocol/src/packets/game/s_command_suggestion.rs new file mode 100755 index 00000000..2e52a969 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_command_suggestion.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundCommandSuggestion { + #[var] + pub id: u32, + pub command: String, +} diff --git a/azalea-protocol/src/packets/game/s_configuration_acknowledged.rs b/azalea-protocol/src/packets/game/s_configuration_acknowledged.rs new file mode 100644 index 00000000..58e27abb --- /dev/null +++ b/azalea-protocol/src/packets/game/s_configuration_acknowledged.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundConfigurationAcknowledged {} diff --git a/azalea-protocol/src/packets/game/s_container_button_click.rs b/azalea-protocol/src/packets/game/s_container_button_click.rs new file mode 100755 index 00000000..909772f3 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_container_button_click.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundContainerButtonClick { + pub container_id: u8, + pub button_id: u8, +} diff --git a/azalea-protocol/src/packets/game/s_container_click.rs b/azalea-protocol/src/packets/game/s_container_click.rs new file mode 100755 index 00000000..a6dee697 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_container_click.rs @@ -0,0 +1,17 @@ +use std::collections::HashMap; + +use azalea_buf::AzBuf; +use azalea_inventory::{operations::ClickType, ItemStack}; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundContainerClick { + pub container_id: u8, + #[var] + pub state_id: u32, + pub slot_num: i16, + pub button_num: u8, + pub click_type: ClickType, + pub changed_slots: HashMap, + pub carried_item: ItemStack, +} diff --git a/azalea-protocol/src/packets/game/s_container_close.rs b/azalea-protocol/src/packets/game/s_container_close.rs new file mode 100755 index 00000000..1cb88eab --- /dev/null +++ b/azalea-protocol/src/packets/game/s_container_close.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundContainerClose { + pub container_id: u8, +} diff --git a/azalea-protocol/src/packets/game/s_container_slot_state_changed.rs b/azalea-protocol/src/packets/game/s_container_slot_state_changed.rs new file mode 100644 index 00000000..73ac0280 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_container_slot_state_changed.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundContainerSlotStateChanged { + #[var] + pub slot_id: u32, + #[var] + pub container_id: u32, + pub new_state: bool, +} diff --git a/azalea-protocol/src/packets/game/s_cookie_response.rs b/azalea-protocol/src/packets/game/s_cookie_response.rs new file mode 100644 index 00000000..5159d72e --- /dev/null +++ b/azalea-protocol/src/packets/game/s_cookie_response.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 ServerboundCookieResponse { + pub key: ResourceLocation, + pub payload: Option>, +} diff --git a/azalea-protocol/src/packets/game/s_custom_payload.rs b/azalea-protocol/src/packets/game/s_custom_payload.rs new file mode 100755 index 00000000..b32f1d24 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_custom_payload.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_buf::UnsizedByteArray; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundCustomPayload { + pub identifier: ResourceLocation, + pub data: UnsizedByteArray, +} diff --git a/azalea-protocol/src/packets/game/s_debug_sample_subscription.rs b/azalea-protocol/src/packets/game/s_debug_sample_subscription.rs new file mode 100644 index 00000000..45051793 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_debug_sample_subscription.rs @@ -0,0 +1,12 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundDebugSampleSubscription { + pub sample_type: RemoteDebugSampleType, +} + +#[derive(Clone, Copy, Debug, AzBuf)] +pub enum RemoteDebugSampleType { + TickTime, +} diff --git a/azalea-protocol/src/packets/game/s_edit_book.rs b/azalea-protocol/src/packets/game/s_edit_book.rs new file mode 100755 index 00000000..af05a7cd --- /dev/null +++ b/azalea-protocol/src/packets/game/s_edit_book.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundEditBook { + #[var] + pub slot: u32, + pub pages: Vec, + pub title: Option, +} diff --git a/azalea-protocol/src/packets/game/s_entity_tag_query.rs b/azalea-protocol/src/packets/game/s_entity_tag_query.rs new file mode 100644 index 00000000..619e9e54 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_entity_tag_query.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundEntityTagQuery { + #[var] + pub transaction_id: u32, + #[var] + pub entity_id: u32, +} diff --git a/azalea-protocol/src/packets/game/s_interact.rs b/azalea-protocol/src/packets/game/s_interact.rs new file mode 100755 index 00000000..cdd9cba5 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_interact.rs @@ -0,0 +1,86 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar}; +use azalea_core::position::Vec3; +use azalea_protocol_macros::ServerboundGamePacket; + +use crate::packets::BufReadError; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundInteract { + #[var] + pub entity_id: u32, + pub action: ActionType, + /// Whether the player is sneaking + pub using_secondary_action: bool, +} + +#[derive(Clone, Copy, Debug)] +pub enum ActionType { + Interact { + hand: InteractionHand, + }, + Attack, + InteractAt { + location: Vec3, + hand: InteractionHand, + }, +} + +impl AzaleaWrite for ActionType { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + match self { + ActionType::Interact { hand } => { + 0u32.azalea_write_var(buf)?; + hand.azalea_write(buf)?; + } + ActionType::Attack => { + 1u32.azalea_write_var(buf)?; + } + ActionType::InteractAt { location, hand } => { + 2u32.azalea_write_var(buf)?; + (location.x as f32).azalea_write(buf)?; + (location.y as f32).azalea_write(buf)?; + (location.z as f32).azalea_write(buf)?; + hand.azalea_write(buf)?; + } + } + Ok(()) + } +} + +impl AzaleaRead for ActionType { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let action_type = u32::azalea_read_var(buf)?; + match action_type { + 0 => { + let hand = InteractionHand::azalea_read(buf)?; + Ok(ActionType::Interact { hand }) + } + 1 => Ok(ActionType::Attack), + 2 => { + let x = f32::azalea_read(buf)?; + let y = f32::azalea_read(buf)?; + let z = f32::azalea_read(buf)?; + let hand = InteractionHand::azalea_read(buf)?; + Ok(ActionType::InteractAt { + location: Vec3 { + x: f64::from(x), + y: f64::from(y), + z: f64::from(z), + }, + hand, + }) + } + _ => Err(BufReadError::UnexpectedEnumVariant { + id: action_type as i32, + }), + } + } +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum InteractionHand { + MainHand = 0, + OffHand = 1, +} diff --git a/azalea-protocol/src/packets/game/s_jigsaw_generate.rs b/azalea-protocol/src/packets/game/s_jigsaw_generate.rs new file mode 100755 index 00000000..4a3b58ce --- /dev/null +++ b/azalea-protocol/src/packets/game/s_jigsaw_generate.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_core::position::BlockPos; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundJigsawGenerate { + pub pos: BlockPos, + #[var] + pub levels: u32, + pub keep_jigsaws: bool, +} diff --git a/azalea-protocol/src/packets/game/s_keep_alive.rs b/azalea-protocol/src/packets/game/s_keep_alive.rs new file mode 100755 index 00000000..a6806a92 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_keep_alive.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundKeepAlive { + pub id: u64, +} diff --git a/azalea-protocol/src/packets/game/s_lock_difficulty.rs b/azalea-protocol/src/packets/game/s_lock_difficulty.rs new file mode 100755 index 00000000..72acb705 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_lock_difficulty.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundLockDifficulty { + pub locked: bool, +} diff --git a/azalea-protocol/src/packets/game/s_move_player_pos.rs b/azalea-protocol/src/packets/game/s_move_player_pos.rs new file mode 100755 index 00000000..2e2ec0c5 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_move_player_pos.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundMovePlayerPos { + pub x: f64, + pub y: f64, + pub z: f64, + pub on_ground: bool, +} diff --git a/azalea-protocol/src/packets/game/s_move_player_pos_rot.rs b/azalea-protocol/src/packets/game/s_move_player_pos_rot.rs new file mode 100755 index 00000000..cb0e0633 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_move_player_pos_rot.rs @@ -0,0 +1,12 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundMovePlayerPosRot { + pub x: f64, + pub y: f64, + pub z: f64, + pub y_rot: f32, + pub x_rot: f32, + pub on_ground: bool, +} diff --git a/azalea-protocol/src/packets/game/s_move_player_rot.rs b/azalea-protocol/src/packets/game/s_move_player_rot.rs new file mode 100755 index 00000000..c3cda3ea --- /dev/null +++ b/azalea-protocol/src/packets/game/s_move_player_rot.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundMovePlayerRot { + pub y_rot: f32, + pub x_rot: f32, + pub on_ground: bool, +} diff --git a/azalea-protocol/src/packets/game/s_move_player_status_only.rs b/azalea-protocol/src/packets/game/s_move_player_status_only.rs new file mode 100755 index 00000000..155841f0 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_move_player_status_only.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundMovePlayerStatusOnly { + pub on_ground: bool, +} diff --git a/azalea-protocol/src/packets/game/s_move_vehicle.rs b/azalea-protocol/src/packets/game/s_move_vehicle.rs new file mode 100755 index 00000000..0452c9b0 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_move_vehicle.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundMoveVehicle { + pub x: f64, + pub y: f64, + pub z: f64, + pub y_rot: f32, + pub x_rot: f32, +} diff --git a/azalea-protocol/src/packets/game/s_paddle_boat.rs b/azalea-protocol/src/packets/game/s_paddle_boat.rs new file mode 100755 index 00000000..eed7addc --- /dev/null +++ b/azalea-protocol/src/packets/game/s_paddle_boat.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPaddleBoat { + pub left: bool, + pub right: bool, +} diff --git a/azalea-protocol/src/packets/game/s_pick_item.rs b/azalea-protocol/src/packets/game/s_pick_item.rs new file mode 100755 index 00000000..289da6e7 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_pick_item.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPickItem { + #[var] + pub slot: u32, +} diff --git a/azalea-protocol/src/packets/game/s_pick_item_from_entity.rs b/azalea-protocol/src/packets/game/s_pick_item_from_entity.rs new file mode 100644 index 00000000..42032063 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_pick_item_from_entity.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPickItemFromEntity { + #[var] + pub id: u32, + pub include_data: bool, +} diff --git a/azalea-protocol/src/packets/game/s_ping_request.rs b/azalea-protocol/src/packets/game/s_ping_request.rs new file mode 100755 index 00000000..1ea7550f --- /dev/null +++ b/azalea-protocol/src/packets/game/s_ping_request.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPingRequest { + pub time: u64, +} diff --git a/azalea-protocol/src/packets/game/s_place_recipe.rs b/azalea-protocol/src/packets/game/s_place_recipe.rs new file mode 100755 index 00000000..33456948 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_place_recipe.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPlaceRecipe { + pub container_id: u8, + pub recipe: ResourceLocation, + pub shift_down: bool, +} diff --git a/azalea-protocol/src/packets/game/s_player_abilities.rs b/azalea-protocol/src/packets/game/s_player_abilities.rs new file mode 100755 index 00000000..fdf2d8a4 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_player_abilities.rs @@ -0,0 +1,31 @@ +use std::io::Cursor; + +use azalea_buf::{AzaleaRead, AzaleaWrite}; +use azalea_core::bitset::FixedBitSet; +use azalea_protocol_macros::ServerboundGamePacket; + +use crate::packets::BufReadError; + +#[derive(Clone, Debug, ServerboundGamePacket)] +pub struct ServerboundPlayerAbilities { + pub is_flying: bool, +} + +impl AzaleaRead for ServerboundPlayerAbilities { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let set = FixedBitSet::<2>::azalea_read(buf)?; + Ok(Self { + is_flying: set.index(1), + }) + } +} + +impl AzaleaWrite for ServerboundPlayerAbilities { + fn azalea_write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { + let mut set = FixedBitSet::<2>::new(); + if self.is_flying { + set.set(1); + } + set.azalea_write(buf) + } +} diff --git a/azalea-protocol/src/packets/game/s_player_action.rs b/azalea-protocol/src/packets/game/s_player_action.rs new file mode 100755 index 00000000..5b65b746 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_player_action.rs @@ -0,0 +1,24 @@ +use azalea_buf::AzBuf; +use azalea_core::direction::Direction; +use azalea_core::position::BlockPos; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPlayerAction { + pub action: Action, + pub pos: BlockPos, + pub direction: Direction, + #[var] + pub sequence: u32, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum Action { + StartDestroyBlock = 0, + AbortDestroyBlock = 1, + StopDestroyBlock = 2, + DropAllItems = 3, + DropItem = 4, + ReleaseUseItem = 5, + SwapItemWithOffhand = 6, +} diff --git a/azalea-protocol/src/packets/game/s_player_command.rs b/azalea-protocol/src/packets/game/s_player_command.rs new file mode 100755 index 00000000..72a92310 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_player_command.rs @@ -0,0 +1,24 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPlayerCommand { + #[var] + pub id: u32, + pub action: Action, + #[var] + pub data: u32, +} + +#[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, +} diff --git a/azalea-protocol/src/packets/game/s_player_input.rs b/azalea-protocol/src/packets/game/s_player_input.rs new file mode 100755 index 00000000..bd4ba970 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_player_input.rs @@ -0,0 +1,60 @@ +use std::io::Cursor; + +use azalea_buf::BufReadError; +use azalea_buf::{AzaleaRead, AzaleaWrite}; +use azalea_core::bitset::FixedBitSet; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, ServerboundGamePacket)] +pub struct ServerboundPlayerInput { + pub forward: bool, + pub backward: bool, + pub left: bool, + pub right: bool, + pub jump: bool, + pub shift: bool, + pub sprint: bool, +} + +impl AzaleaRead for ServerboundPlayerInput { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let set = FixedBitSet::<7>::azalea_read(buf)?; + Ok(Self { + forward: set.index(0), + backward: set.index(1), + left: set.index(2), + right: set.index(3), + jump: set.index(4), + shift: set.index(5), + sprint: set.index(6), + }) + } +} + +impl AzaleaWrite for ServerboundPlayerInput { + fn azalea_write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { + let mut set = FixedBitSet::<7>::new(); + if self.forward { + set.set(0); + } + if self.backward { + set.set(1); + } + if self.left { + set.set(2); + } + if self.right { + set.set(3); + } + if self.jump { + set.set(4); + } + if self.shift { + set.set(5); + } + if self.sprint { + set.set(6); + } + set.azalea_write(buf) + } +} diff --git a/azalea-protocol/src/packets/game/s_player_loaded.rs b/azalea-protocol/src/packets/game/s_player_loaded.rs new file mode 100644 index 00000000..3e809b26 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_player_loaded.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPlayerLoaded; diff --git a/azalea-protocol/src/packets/game/s_pong.rs b/azalea-protocol/src/packets/game/s_pong.rs new file mode 100755 index 00000000..10ce0fb7 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_pong.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundPong { + pub id: u32, +} diff --git a/azalea-protocol/src/packets/game/s_recipe_book_change_settings.rs b/azalea-protocol/src/packets/game/s_recipe_book_change_settings.rs new file mode 100755 index 00000000..a31ca173 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_recipe_book_change_settings.rs @@ -0,0 +1,17 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundRecipeBookChangeSettings { + pub book_type: RecipeBookType, + pub is_open: bool, + pub is_filtering: bool, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum RecipeBookType { + Crafting = 0, + Furnace = 1, + BlastFurnace = 2, + Smoker = 3, +} diff --git a/azalea-protocol/src/packets/game/s_recipe_book_seen_recipe.rs b/azalea-protocol/src/packets/game/s_recipe_book_seen_recipe.rs new file mode 100755 index 00000000..9eeffde9 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_recipe_book_seen_recipe.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundRecipeBookSeenRecipe { + pub recipe: ResourceLocation, +} diff --git a/azalea-protocol/src/packets/game/s_rename_item.rs b/azalea-protocol/src/packets/game/s_rename_item.rs new file mode 100755 index 00000000..4c913ba0 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_rename_item.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundRenameItem { + pub name: String, +} diff --git a/azalea-protocol/src/packets/game/s_resource_pack.rs b/azalea-protocol/src/packets/game/s_resource_pack.rs new file mode 100755 index 00000000..7bdb7bb4 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_resource_pack.rs @@ -0,0 +1,20 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundResourcePack { + pub id: Uuid, + pub action: Action, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum Action { + SuccessfullyLoaded = 0, + Declined = 1, + FailedDownload = 2, + Accepted = 3, + InvalidUrl = 4, + FailedReload = 5, + Discarded = 6, +} diff --git a/azalea-protocol/src/packets/game/s_seen_advancements.rs b/azalea-protocol/src/packets/game/s_seen_advancements.rs new file mode 100755 index 00000000..f46411f0 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_seen_advancements.rs @@ -0,0 +1,41 @@ +use std::io::Cursor; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite}; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ServerboundGamePacket; + +use crate::packets::BufReadError; + +#[derive(Clone, Debug, ServerboundGamePacket)] +pub struct ServerboundSeenAdvancements { + pub action: Action, + pub tab: Option, +} + +#[derive(AzBuf, Clone, Copy, Debug, Eq, PartialEq)] +pub enum Action { + OpenedTab = 0, + ClosedScreen = 1, +} + +impl AzaleaRead for ServerboundSeenAdvancements { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let action = Action::azalea_read(buf)?; + let tab = if action == Action::OpenedTab { + Some(ResourceLocation::azalea_read(buf)?) + } else { + None + }; + Ok(Self { action, tab }) + } +} + +impl AzaleaWrite for ServerboundSeenAdvancements { + fn azalea_write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { + self.action.azalea_write(buf)?; + if let Some(tab) = &self.tab { + tab.azalea_write(buf)?; + } + Ok(()) + } +} diff --git a/azalea-protocol/src/packets/game/s_select_trade.rs b/azalea-protocol/src/packets/game/s_select_trade.rs new file mode 100755 index 00000000..e0cc8aab --- /dev/null +++ b/azalea-protocol/src/packets/game/s_select_trade.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSelectTrade { + #[var] + pub item: u32, +} diff --git a/azalea-protocol/src/packets/game/s_set_beacon.rs b/azalea-protocol/src/packets/game/s_set_beacon.rs new file mode 100755 index 00000000..b0b911a1 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_set_beacon.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSetBeacon { + #[var] + pub primary: Option, + #[var] + pub secondary: Option, +} diff --git a/azalea-protocol/src/packets/game/s_set_carried_item.rs b/azalea-protocol/src/packets/game/s_set_carried_item.rs new file mode 100755 index 00000000..5efa2d44 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_set_carried_item.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSetCarriedItem { + pub slot: u16, +} diff --git a/azalea-protocol/src/packets/game/s_set_command_block.rs b/azalea-protocol/src/packets/game/s_set_command_block.rs new file mode 100755 index 00000000..dacb79de --- /dev/null +++ b/azalea-protocol/src/packets/game/s_set_command_block.rs @@ -0,0 +1,63 @@ +use std::io::Cursor; + +use azalea_buf::{AzBuf, AzaleaRead, BufReadError}; +use azalea_core::{bitset::FixedBitSet, position::BlockPos}; +use azalea_protocol_macros::ServerboundGamePacket; + +use crate::packets::AzaleaWrite; + +#[derive(Clone, Debug, ServerboundGamePacket)] +pub struct ServerboundSetCommandBlock { + pub pos: BlockPos, + pub command: String, + pub mode: Mode, + + pub track_output: bool, + pub conditional: bool, + pub automatic: bool, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum Mode { + Sequence = 0, + Auto = 1, + Redstone = 2, +} + +impl AzaleaRead for ServerboundSetCommandBlock { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let pos = BlockPos::azalea_read(buf)?; + let command = String::azalea_read(buf)?; + let mode = Mode::azalea_read(buf)?; + + let set = FixedBitSet::<3>::azalea_read(buf)?; + Ok(Self { + pos, + command, + mode, + track_output: set.index(0), + conditional: set.index(1), + automatic: set.index(2), + }) + } +} + +impl AzaleaWrite for ServerboundSetCommandBlock { + fn azalea_write(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { + self.pos.azalea_write(buf)?; + self.command.azalea_write(buf)?; + self.mode.azalea_write(buf)?; + + let mut set = FixedBitSet::<3>::new(); + if self.track_output { + set.set(0); + } + if self.conditional { + set.set(1); + } + if self.automatic { + set.set(2); + } + set.azalea_write(buf) + } +} diff --git a/azalea-protocol/src/packets/game/s_set_command_minecart.rs b/azalea-protocol/src/packets/game/s_set_command_minecart.rs new file mode 100755 index 00000000..0431a865 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_set_command_minecart.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSetCommandMinecart { + #[var] + pub entity: u32, + pub command: String, + pub track_output: bool, +} diff --git a/azalea-protocol/src/packets/game/s_set_creative_mode_slot.rs b/azalea-protocol/src/packets/game/s_set_creative_mode_slot.rs new file mode 100755 index 00000000..e4b26a64 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_set_creative_mode_slot.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_inventory::ItemStack; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSetCreativeModeSlot { + pub slot_num: u16, + pub item_stack: ItemStack, +} diff --git a/azalea-protocol/src/packets/game/s_set_jigsaw_block.rs b/azalea-protocol/src/packets/game/s_set_jigsaw_block.rs new file mode 100755 index 00000000..1d97d4c7 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_set_jigsaw_block.rs @@ -0,0 +1,51 @@ +use std::io::Cursor; +use std::io::Write; + +use azalea_buf::AzBuf; +use azalea_buf::AzaleaRead; +use azalea_core::position::BlockPos; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ServerboundGamePacket; + +use crate::packets::AzaleaWrite; +use crate::packets::BufReadError; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSetJigsawBlock { + pub pos: BlockPos, + pub name: ResourceLocation, + pub target: ResourceLocation, + pub pool: ResourceLocation, + pub final_state: String, + pub joint: String, + #[var] + pub selection_priority: i32, + #[var] + pub placement_priority: i32, +} + +pub enum JointType { + Rollable, + Aligned, +} + +impl AzaleaRead for JointType { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let name = String::azalea_read(buf)?; + match name.as_str() { + "rollable" => Ok(JointType::Rollable), + "aligned" => Ok(JointType::Aligned), + _ => Err(BufReadError::UnexpectedStringEnumVariant { id: name }), + } + } +} + +impl AzaleaWrite for JointType { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + match self { + JointType::Rollable => "rollable".to_string().azalea_write(buf)?, + JointType::Aligned => "aligned".to_string().azalea_write(buf)?, + }; + Ok(()) + } +} diff --git a/azalea-protocol/src/packets/game/s_set_structure_block.rs b/azalea-protocol/src/packets/game/s_set_structure_block.rs new file mode 100755 index 00000000..7f05a3a7 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_set_structure_block.rs @@ -0,0 +1,98 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::AzBuf; +use azalea_buf::{AzaleaRead, AzaleaWrite}; +use azalea_core::{bitset::FixedBitSet, position::BlockPos}; +use azalea_protocol_macros::ServerboundGamePacket; + +use crate::packets::BufReadError; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSetStructureBlock { + pub pos: BlockPos, + pub update_type: UpdateType, + pub mode: StructureMode, + pub name: String, + pub offset: BytePosition, + pub size: BytePosition, + pub mirror: Mirror, + pub rotation: Rotation, + pub data: String, + pub integrity: f32, + #[var] + pub seed: u64, + pub flags: Flags, +} + +#[derive(Clone, Debug, AzBuf)] +pub struct BytePosition { + pub x: u8, + pub y: u8, + pub z: u8, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum UpdateType { + UpdateData = 0, + SaveArea = 1, + LoadArea = 2, + ScanArea = 3, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum StructureMode { + Save = 0, + Load = 1, + Corner = 2, + Data = 3, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum Mirror { + None = 0, + LeftRight = 1, + FrontBack = 2, +} + +#[derive(AzBuf, Clone, Copy, Debug)] +pub enum Rotation { + None = 0, + Clockwise90 = 1, + Clockwise180 = 2, + Counterclockwise90 = 3, +} + +#[derive(Debug, Clone)] +pub struct Flags { + pub ignore_entities: bool, + pub show_air: bool, + pub show_bounding_box: bool, +} + +impl AzaleaRead for Flags { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let set = FixedBitSet::<3>::azalea_read(buf)?; + Ok(Self { + ignore_entities: set.index(0), + show_air: set.index(1), + show_bounding_box: set.index(2), + }) + } +} + +impl AzaleaWrite for Flags { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let mut set = FixedBitSet::<3>::new(); + if self.ignore_entities { + set.set(0); + } + if self.show_air { + set.set(1); + } + if self.show_bounding_box { + set.set(2); + } + set.azalea_write(buf)?; + Ok(()) + } +} diff --git a/azalea-protocol/src/packets/game/s_sign_update.rs b/azalea-protocol/src/packets/game/s_sign_update.rs new file mode 100755 index 00000000..c43a0978 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_sign_update.rs @@ -0,0 +1,10 @@ +use azalea_buf::AzBuf; +use azalea_core::position::BlockPos; +use azalea_protocol_macros::ServerboundGamePacket; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSignUpdate { + pub pos: BlockPos, + pub is_front_text: bool, + pub lines: [String; 4], +} diff --git a/azalea-protocol/src/packets/game/s_swing.rs b/azalea-protocol/src/packets/game/s_swing.rs new file mode 100755 index 00000000..68648ac6 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_swing.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +use crate::packets::game::s_interact::InteractionHand; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundSwing { + pub hand: InteractionHand, +} diff --git a/azalea-protocol/src/packets/game/s_teleport_to_entity.rs b/azalea-protocol/src/packets/game/s_teleport_to_entity.rs new file mode 100755 index 00000000..e8829530 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_teleport_to_entity.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; +use uuid::Uuid; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundTeleportToEntity { + pub uuid: Uuid, +} diff --git a/azalea-protocol/src/packets/game/s_use_item.rs b/azalea-protocol/src/packets/game/s_use_item.rs new file mode 100755 index 00000000..ac8ae217 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_use_item.rs @@ -0,0 +1,13 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundGamePacket; + +use crate::packets::game::s_interact::InteractionHand; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundUseItem { + pub hand: InteractionHand, + #[var] + pub sequence: u32, + pub yaw: f32, + pub pitch: f32, +} diff --git a/azalea-protocol/src/packets/game/s_use_item_on.rs b/azalea-protocol/src/packets/game/s_use_item_on.rs new file mode 100755 index 00000000..0ad23ad2 --- /dev/null +++ b/azalea-protocol/src/packets/game/s_use_item_on.rs @@ -0,0 +1,74 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{AzBuf, AzaleaRead, AzaleaWrite, BufReadError}; +use azalea_core::{ + direction::Direction, + position::{BlockPos, Vec3}, +}; +use azalea_protocol_macros::ServerboundGamePacket; + +use crate::packets::game::s_interact::InteractionHand; + +#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] +pub struct ServerboundUseItemOn { + pub hand: InteractionHand, + pub block_hit: BlockHit, + #[var] + pub sequence: u32, +} + +#[derive(Clone, Debug)] +pub struct BlockHit { + /// The block that we clicked. + pub block_pos: BlockPos, + /// The face of the block that was clicked. + pub direction: Direction, + /// The exact coordinates of the world where the block was clicked. In the + /// network, this is transmitted as the difference between the location and + /// block position. + pub location: Vec3, + /// Whether the player's head is inside of a block. + pub inside: bool, +} + +impl AzaleaWrite for BlockHit { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + self.block_pos.azalea_write(buf)?; + self.direction.azalea_write(buf)?; + f32::azalea_write( + &((self.location.x - f64::from(self.block_pos.x)) as f32), + buf, + )?; + f32::azalea_write( + &((self.location.y - f64::from(self.block_pos.y)) as f32), + buf, + )?; + f32::azalea_write( + &((self.location.z - f64::from(self.block_pos.z)) as f32), + buf, + )?; + self.inside.azalea_write(buf)?; + Ok(()) + } +} + +impl AzaleaRead for BlockHit { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let block_pos = BlockPos::azalea_read(buf)?; + let direction = Direction::azalea_read(buf)?; + let cursor_x = f32::azalea_read(buf)?; + let cursor_y = f32::azalea_read(buf)?; + let cursor_z = f32::azalea_read(buf)?; + let inside = bool::azalea_read(buf)?; + Ok(Self { + block_pos, + direction, + location: Vec3 { + x: f64::from(block_pos.x) + f64::from(cursor_x), + y: f64::from(block_pos.y) + f64::from(cursor_y), + z: f64::from(block_pos.z) + f64::from(cursor_z), + }, + inside, + }) + } +} diff --git a/azalea-protocol/src/packets/game/serverbound_accept_teleportation_packet.rs b/azalea-protocol/src/packets/game/serverbound_accept_teleportation_packet.rs deleted file mode 100755 index 85311e48..00000000 --- a/azalea-protocol/src/packets/game/serverbound_accept_teleportation_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundAcceptTeleportationPacket { - #[var] - pub id: u32, -} diff --git a/azalea-protocol/src/packets/game/serverbound_block_entity_tag_query.rs b/azalea-protocol/src/packets/game/serverbound_block_entity_tag_query.rs deleted file mode 100755 index 4b396a67..00000000 --- a/azalea-protocol/src/packets/game/serverbound_block_entity_tag_query.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::position::BlockPos; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundBlockEntityTagQuery { - #[var] - pub transaction_id: i32, - pub pos: BlockPos, -} diff --git a/azalea-protocol/src/packets/game/serverbound_block_entity_tag_query_packet.rs b/azalea-protocol/src/packets/game/serverbound_block_entity_tag_query_packet.rs deleted file mode 100644 index d8856647..00000000 --- a/azalea-protocol/src/packets/game/serverbound_block_entity_tag_query_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::position::BlockPos; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundBlockEntityTagQueryPacket { - #[var] - pub transaction_id: u32, - pub pos: BlockPos, -} diff --git a/azalea-protocol/src/packets/game/serverbound_change_difficulty_packet.rs b/azalea-protocol/src/packets/game/serverbound_change_difficulty_packet.rs deleted file mode 100755 index 460de5b2..00000000 --- a/azalea-protocol/src/packets/game/serverbound_change_difficulty_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::difficulty::Difficulty; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundChangeDifficultyPacket { - pub difficulty: Difficulty, -} diff --git a/azalea-protocol/src/packets/game/serverbound_chat_ack_packet.rs b/azalea-protocol/src/packets/game/serverbound_chat_ack_packet.rs deleted file mode 100755 index eaf285cb..00000000 --- a/azalea-protocol/src/packets/game/serverbound_chat_ack_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundChatAckPacket { - #[var] - pub messages: u32, -} diff --git a/azalea-protocol/src/packets/game/serverbound_chat_command_packet.rs b/azalea-protocol/src/packets/game/serverbound_chat_command_packet.rs deleted file mode 100755 index 23a796d8..00000000 --- a/azalea-protocol/src/packets/game/serverbound_chat_command_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundChatCommandPacket { - pub command: String, -} diff --git a/azalea-protocol/src/packets/game/serverbound_chat_command_signed_packet.rs b/azalea-protocol/src/packets/game/serverbound_chat_command_signed_packet.rs deleted file mode 100755 index f64b79cc..00000000 --- a/azalea-protocol/src/packets/game/serverbound_chat_command_signed_packet.rs +++ /dev/null @@ -1,20 +0,0 @@ -use azalea_buf::McBuf; -use azalea_crypto::MessageSignature; -use azalea_protocol_macros::ServerboundGamePacket; - -use super::serverbound_chat_packet::LastSeenMessagesUpdate; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundChatCommandSignedPacket { - pub command: String, - pub timestamp: u64, - pub salt: u64, - pub argument_signatures: Vec, - pub last_seen_messages: LastSeenMessagesUpdate, -} - -#[derive(Clone, Debug, McBuf)] -pub struct ArgumentSignature { - pub name: String, - pub signature: MessageSignature, -} diff --git a/azalea-protocol/src/packets/game/serverbound_chat_packet.rs b/azalea-protocol/src/packets/game/serverbound_chat_packet.rs deleted file mode 100755 index e0a1726c..00000000 --- a/azalea-protocol/src/packets/game/serverbound_chat_packet.rs +++ /dev/null @@ -1,20 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::bitset::FixedBitSet; -use azalea_crypto::MessageSignature; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundChatPacket { - pub message: String, - pub timestamp: u64, - pub salt: u64, - pub signature: Option, - pub last_seen_messages: LastSeenMessagesUpdate, -} - -#[derive(Clone, Debug, McBuf, Default)] -pub struct LastSeenMessagesUpdate { - #[var] - pub messages: u32, - pub acknowledged: FixedBitSet<20>, -} diff --git a/azalea-protocol/src/packets/game/serverbound_chat_preview_packet.rs b/azalea-protocol/src/packets/game/serverbound_chat_preview_packet.rs deleted file mode 100755 index 50b44728..00000000 --- a/azalea-protocol/src/packets/game/serverbound_chat_preview_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundChatPreviewPacket { - pub query_id: i32, - pub query: String, -} diff --git a/azalea-protocol/src/packets/game/serverbound_chat_session_update_packet.rs b/azalea-protocol/src/packets/game/serverbound_chat_session_update_packet.rs deleted file mode 100644 index e56d2bc6..00000000 --- a/azalea-protocol/src/packets/game/serverbound_chat_session_update_packet.rs +++ /dev/null @@ -1,21 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; -use uuid::Uuid; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundChatSessionUpdatePacket { - pub chat_session: RemoteChatSessionData, -} - -#[derive(Clone, Debug, PartialEq, Eq, McBuf)] -pub struct RemoteChatSessionData { - pub session_id: Uuid, - pub profile_public_key: ProfilePublicKeyData, -} - -#[derive(Clone, Debug, McBuf, PartialEq, Eq)] -pub struct ProfilePublicKeyData { - pub expires_at: u64, - pub key: Vec, - pub key_signature: Vec, -} diff --git a/azalea-protocol/src/packets/game/serverbound_chunk_batch_received_packet.rs b/azalea-protocol/src/packets/game/serverbound_chunk_batch_received_packet.rs deleted file mode 100644 index 9f18f967..00000000 --- a/azalea-protocol/src/packets/game/serverbound_chunk_batch_received_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundChunkBatchReceivedPacket { - pub desired_chunks_per_tick: f32, -} diff --git a/azalea-protocol/src/packets/game/serverbound_client_command_packet.rs b/azalea-protocol/src/packets/game/serverbound_client_command_packet.rs deleted file mode 100755 index 2f360cb9..00000000 --- a/azalea-protocol/src/packets/game/serverbound_client_command_packet.rs +++ /dev/null @@ -1,13 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundClientCommandPacket { - pub action: Action, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum Action { - PerformRespawn = 0, - RequestStats = 1, -} diff --git a/azalea-protocol/src/packets/game/serverbound_client_information_packet.rs b/azalea-protocol/src/packets/game/serverbound_client_information_packet.rs deleted file mode 100755 index 37a101f5..00000000 --- a/azalea-protocol/src/packets/game/serverbound_client_information_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -use crate::packets::configuration::serverbound_client_information_packet::ClientInformation; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundClientInformationPacket { - pub information: ClientInformation, -} diff --git a/azalea-protocol/src/packets/game/serverbound_client_tick_end_packet.rs b/azalea-protocol/src/packets/game/serverbound_client_tick_end_packet.rs deleted file mode 100644 index c843066e..00000000 --- a/azalea-protocol/src/packets/game/serverbound_client_tick_end_packet.rs +++ /dev/null @@ -1,5 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundTickEndPacket {} diff --git a/azalea-protocol/src/packets/game/serverbound_command_suggestion_packet.rs b/azalea-protocol/src/packets/game/serverbound_command_suggestion_packet.rs deleted file mode 100755 index 0cca3ceb..00000000 --- a/azalea-protocol/src/packets/game/serverbound_command_suggestion_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundCommandSuggestionPacket { - #[var] - pub id: u32, - pub command: String, -} diff --git a/azalea-protocol/src/packets/game/serverbound_configuration_acknowledged_packet.rs b/azalea-protocol/src/packets/game/serverbound_configuration_acknowledged_packet.rs deleted file mode 100644 index c790972a..00000000 --- a/azalea-protocol/src/packets/game/serverbound_configuration_acknowledged_packet.rs +++ /dev/null @@ -1,5 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundConfigurationAcknowledgedPacket {} diff --git a/azalea-protocol/src/packets/game/serverbound_container_button_click_packet.rs b/azalea-protocol/src/packets/game/serverbound_container_button_click_packet.rs deleted file mode 100755 index 739e7390..00000000 --- a/azalea-protocol/src/packets/game/serverbound_container_button_click_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundContainerButtonClickPacket { - pub container_id: u8, - pub button_id: u8, -} diff --git a/azalea-protocol/src/packets/game/serverbound_container_click_packet.rs b/azalea-protocol/src/packets/game/serverbound_container_click_packet.rs deleted file mode 100755 index e2954720..00000000 --- a/azalea-protocol/src/packets/game/serverbound_container_click_packet.rs +++ /dev/null @@ -1,17 +0,0 @@ -use std::collections::HashMap; - -use azalea_buf::McBuf; -use azalea_inventory::{operations::ClickType, ItemSlot}; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundContainerClickPacket { - pub container_id: u8, - #[var] - pub state_id: u32, - pub slot_num: i16, - pub button_num: u8, - pub click_type: ClickType, - pub changed_slots: HashMap, - pub carried_item: ItemSlot, -} diff --git a/azalea-protocol/src/packets/game/serverbound_container_close_packet.rs b/azalea-protocol/src/packets/game/serverbound_container_close_packet.rs deleted file mode 100755 index dbaf59f3..00000000 --- a/azalea-protocol/src/packets/game/serverbound_container_close_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundContainerClosePacket { - pub container_id: u8, -} diff --git a/azalea-protocol/src/packets/game/serverbound_container_slot_state_changed_packet.rs b/azalea-protocol/src/packets/game/serverbound_container_slot_state_changed_packet.rs deleted file mode 100644 index 8a83f4e2..00000000 --- a/azalea-protocol/src/packets/game/serverbound_container_slot_state_changed_packet.rs +++ /dev/null @@ -1,11 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundContainerSlotStateChangedPacket { - #[var] - pub slot_id: u32, - #[var] - pub container_id: u32, - pub new_state: bool, -} diff --git a/azalea-protocol/src/packets/game/serverbound_cookie_response_packet.rs b/azalea-protocol/src/packets/game/serverbound_cookie_response_packet.rs deleted file mode 100644 index 8ad0f07e..00000000 --- a/azalea-protocol/src/packets/game/serverbound_cookie_response_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundCookieResponsePacket { - pub key: ResourceLocation, - pub payload: Option>, -} diff --git a/azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs b/azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs deleted file mode 100755 index d5d46627..00000000 --- a/azalea-protocol/src/packets/game/serverbound_custom_payload_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_buf::UnsizedByteArray; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundCustomPayloadPacket { - pub identifier: ResourceLocation, - pub data: UnsizedByteArray, -} diff --git a/azalea-protocol/src/packets/game/serverbound_debug_sample_subscription.rs b/azalea-protocol/src/packets/game/serverbound_debug_sample_subscription.rs deleted file mode 100755 index 236972e0..00000000 --- a/azalea-protocol/src/packets/game/serverbound_debug_sample_subscription.rs +++ /dev/null @@ -1,12 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundDebugSampleSubscription { - pub sample_type: RemoteDebugSampleType, -} - -#[derive(Clone, Copy, Debug, McBuf)] -pub enum RemoteDebugSampleType { - TickTime, -} diff --git a/azalea-protocol/src/packets/game/serverbound_edit_book_packet.rs b/azalea-protocol/src/packets/game/serverbound_edit_book_packet.rs deleted file mode 100755 index 62d4b318..00000000 --- a/azalea-protocol/src/packets/game/serverbound_edit_book_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundEditBookPacket { - #[var] - pub slot: u32, - pub pages: Vec, - pub title: Option, -} diff --git a/azalea-protocol/src/packets/game/serverbound_entity_tag_query.rs b/azalea-protocol/src/packets/game/serverbound_entity_tag_query.rs deleted file mode 100755 index 5b0c7db6..00000000 --- a/azalea-protocol/src/packets/game/serverbound_entity_tag_query.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundEntityTagQuery { - #[var] - pub transaction_id: u32, - #[var] - pub entity_id: u32, -} diff --git a/azalea-protocol/src/packets/game/serverbound_entity_tag_query_packet.rs b/azalea-protocol/src/packets/game/serverbound_entity_tag_query_packet.rs deleted file mode 100644 index d40a59a6..00000000 --- a/azalea-protocol/src/packets/game/serverbound_entity_tag_query_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundEntityTagQueryPacket { - #[var] - pub transaction_id: u32, - #[var] - pub entity_id: u32, -} diff --git a/azalea-protocol/src/packets/game/serverbound_interact_packet.rs b/azalea-protocol/src/packets/game/serverbound_interact_packet.rs deleted file mode 100755 index e393920c..00000000 --- a/azalea-protocol/src/packets/game/serverbound_interact_packet.rs +++ /dev/null @@ -1,86 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::{McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable}; -use azalea_core::position::Vec3; -use azalea_protocol_macros::ServerboundGamePacket; - -use crate::packets::BufReadError; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundInteractPacket { - #[var] - pub entity_id: u32, - pub action: ActionType, - /// Whether the player is sneaking - pub using_secondary_action: bool, -} - -#[derive(Clone, Copy, Debug)] -pub enum ActionType { - Interact { - hand: InteractionHand, - }, - Attack, - InteractAt { - location: Vec3, - hand: InteractionHand, - }, -} - -impl McBufWritable for ActionType { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - match self { - ActionType::Interact { hand } => { - 0u32.var_write_into(buf)?; - hand.write_into(buf)?; - } - ActionType::Attack => { - 1u32.var_write_into(buf)?; - } - ActionType::InteractAt { location, hand } => { - 2u32.var_write_into(buf)?; - (location.x as f32).write_into(buf)?; - (location.y as f32).write_into(buf)?; - (location.z as f32).write_into(buf)?; - hand.write_into(buf)?; - } - } - Ok(()) - } -} - -impl McBufReadable for ActionType { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let action_type = u32::var_read_from(buf)?; - match action_type { - 0 => { - let hand = InteractionHand::read_from(buf)?; - Ok(ActionType::Interact { hand }) - } - 1 => Ok(ActionType::Attack), - 2 => { - let x = f32::read_from(buf)?; - let y = f32::read_from(buf)?; - let z = f32::read_from(buf)?; - let hand = InteractionHand::read_from(buf)?; - Ok(ActionType::InteractAt { - location: Vec3 { - x: f64::from(x), - y: f64::from(y), - z: f64::from(z), - }, - hand, - }) - } - _ => Err(BufReadError::UnexpectedEnumVariant { - id: action_type as i32, - }), - } - } -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum InteractionHand { - MainHand = 0, - OffHand = 1, -} diff --git a/azalea-protocol/src/packets/game/serverbound_jigsaw_generate_packet.rs b/azalea-protocol/src/packets/game/serverbound_jigsaw_generate_packet.rs deleted file mode 100755 index 34fd5985..00000000 --- a/azalea-protocol/src/packets/game/serverbound_jigsaw_generate_packet.rs +++ /dev/null @@ -1,11 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::position::BlockPos; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundJigsawGeneratePacket { - pub pos: BlockPos, - #[var] - pub levels: u32, - pub keep_jigsaws: bool, -} diff --git a/azalea-protocol/src/packets/game/serverbound_keep_alive_packet.rs b/azalea-protocol/src/packets/game/serverbound_keep_alive_packet.rs deleted file mode 100755 index 7485e11e..00000000 --- a/azalea-protocol/src/packets/game/serverbound_keep_alive_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundKeepAlivePacket { - pub id: u64, -} diff --git a/azalea-protocol/src/packets/game/serverbound_lock_difficulty_packet.rs b/azalea-protocol/src/packets/game/serverbound_lock_difficulty_packet.rs deleted file mode 100755 index 3c54a16a..00000000 --- a/azalea-protocol/src/packets/game/serverbound_lock_difficulty_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundLockDifficultyPacket { - pub locked: bool, -} diff --git a/azalea-protocol/src/packets/game/serverbound_move_player_pos_packet.rs b/azalea-protocol/src/packets/game/serverbound_move_player_pos_packet.rs deleted file mode 100755 index 4e3face4..00000000 --- a/azalea-protocol/src/packets/game/serverbound_move_player_pos_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundMovePlayerPosPacket { - pub x: f64, - pub y: f64, - pub z: f64, - pub on_ground: bool, -} diff --git a/azalea-protocol/src/packets/game/serverbound_move_player_pos_rot_packet.rs b/azalea-protocol/src/packets/game/serverbound_move_player_pos_rot_packet.rs deleted file mode 100755 index 0ab9c885..00000000 --- a/azalea-protocol/src/packets/game/serverbound_move_player_pos_rot_packet.rs +++ /dev/null @@ -1,12 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundMovePlayerPosRotPacket { - pub x: f64, - pub y: f64, - pub z: f64, - pub y_rot: f32, - pub x_rot: f32, - pub on_ground: bool, -} diff --git a/azalea-protocol/src/packets/game/serverbound_move_player_rot_packet.rs b/azalea-protocol/src/packets/game/serverbound_move_player_rot_packet.rs deleted file mode 100755 index 11a77e73..00000000 --- a/azalea-protocol/src/packets/game/serverbound_move_player_rot_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundMovePlayerRotPacket { - pub y_rot: f32, - pub x_rot: f32, - pub on_ground: bool, -} diff --git a/azalea-protocol/src/packets/game/serverbound_move_player_status_only_packet.rs b/azalea-protocol/src/packets/game/serverbound_move_player_status_only_packet.rs deleted file mode 100755 index fc91caca..00000000 --- a/azalea-protocol/src/packets/game/serverbound_move_player_status_only_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundMovePlayerStatusOnlyPacket { - pub on_ground: bool, -} diff --git a/azalea-protocol/src/packets/game/serverbound_move_vehicle_packet.rs b/azalea-protocol/src/packets/game/serverbound_move_vehicle_packet.rs deleted file mode 100755 index 929ba798..00000000 --- a/azalea-protocol/src/packets/game/serverbound_move_vehicle_packet.rs +++ /dev/null @@ -1,11 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundMoveVehiclePacket { - pub x: f64, - pub y: f64, - pub z: f64, - pub y_rot: f32, - pub x_rot: f32, -} diff --git a/azalea-protocol/src/packets/game/serverbound_paddle_boat_packet.rs b/azalea-protocol/src/packets/game/serverbound_paddle_boat_packet.rs deleted file mode 100755 index 2db9ef2e..00000000 --- a/azalea-protocol/src/packets/game/serverbound_paddle_boat_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundPaddleBoatPacket { - pub left: bool, - pub right: bool, -} diff --git a/azalea-protocol/src/packets/game/serverbound_pick_item_packet.rs b/azalea-protocol/src/packets/game/serverbound_pick_item_packet.rs deleted file mode 100755 index 508e710b..00000000 --- a/azalea-protocol/src/packets/game/serverbound_pick_item_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundPickItemPacket { - #[var] - pub slot: u32, -} diff --git a/azalea-protocol/src/packets/game/serverbound_ping_request_packet.rs b/azalea-protocol/src/packets/game/serverbound_ping_request_packet.rs deleted file mode 100755 index 0966e941..00000000 --- a/azalea-protocol/src/packets/game/serverbound_ping_request_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundPingRequestPacket { - pub time: u64, -} diff --git a/azalea-protocol/src/packets/game/serverbound_place_recipe_packet.rs b/azalea-protocol/src/packets/game/serverbound_place_recipe_packet.rs deleted file mode 100755 index 03dd833b..00000000 --- a/azalea-protocol/src/packets/game/serverbound_place_recipe_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundPlaceRecipePacket { - pub container_id: u8, - pub recipe: ResourceLocation, - pub shift_down: bool, -} diff --git a/azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs b/azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs deleted file mode 100755 index 900d1824..00000000 --- a/azalea-protocol/src/packets/game/serverbound_player_abilities_packet.rs +++ /dev/null @@ -1,31 +0,0 @@ -use std::io::Cursor; - -use azalea_buf::{McBufReadable, McBufWritable}; -use azalea_core::bitset::FixedBitSet; -use azalea_protocol_macros::ServerboundGamePacket; - -use crate::packets::BufReadError; - -#[derive(Clone, Debug, ServerboundGamePacket)] -pub struct ServerboundPlayerAbilitiesPacket { - pub is_flying: bool, -} - -impl McBufReadable for ServerboundPlayerAbilitiesPacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let set = FixedBitSet::<2>::read_from(buf)?; - Ok(Self { - is_flying: set.index(1), - }) - } -} - -impl McBufWritable for ServerboundPlayerAbilitiesPacket { - fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { - let mut set = FixedBitSet::<2>::new(); - if self.is_flying { - set.set(1); - } - set.write_into(buf) - } -} diff --git a/azalea-protocol/src/packets/game/serverbound_player_action_packet.rs b/azalea-protocol/src/packets/game/serverbound_player_action_packet.rs deleted file mode 100755 index 6719202f..00000000 --- a/azalea-protocol/src/packets/game/serverbound_player_action_packet.rs +++ /dev/null @@ -1,24 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::direction::Direction; -use azalea_core::position::BlockPos; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundPlayerActionPacket { - pub action: Action, - pub pos: BlockPos, - pub direction: Direction, - #[var] - pub sequence: u32, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum Action { - StartDestroyBlock = 0, - AbortDestroyBlock = 1, - StopDestroyBlock = 2, - DropAllItems = 3, - DropItem = 4, - ReleaseUseItem = 5, - SwapItemWithOffhand = 6, -} diff --git a/azalea-protocol/src/packets/game/serverbound_player_command_packet.rs b/azalea-protocol/src/packets/game/serverbound_player_command_packet.rs deleted file mode 100755 index d7688092..00000000 --- a/azalea-protocol/src/packets/game/serverbound_player_command_packet.rs +++ /dev/null @@ -1,24 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundPlayerCommandPacket { - #[var] - pub id: u32, - pub action: Action, - #[var] - pub data: u32, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum Action { - PressShiftKey = 0, - ReleaseShiftKey = 1, - StopSleeping = 2, - StartSprinting = 3, - StopSprinting = 4, - StartRidingJump = 5, - StopRidingJump = 6, - OpenInventory = 7, - StartFallFlying = 8, -} diff --git a/azalea-protocol/src/packets/game/serverbound_player_input_packet.rs b/azalea-protocol/src/packets/game/serverbound_player_input_packet.rs deleted file mode 100755 index a461ddf5..00000000 --- a/azalea-protocol/src/packets/game/serverbound_player_input_packet.rs +++ /dev/null @@ -1,60 +0,0 @@ -use std::io::Cursor; - -use azalea_buf::BufReadError; -use azalea_buf::{McBufReadable, McBufWritable}; -use azalea_core::bitset::FixedBitSet; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, ServerboundGamePacket)] -pub struct ServerboundPlayerInputPacket { - pub forward: bool, - pub backward: bool, - pub left: bool, - pub right: bool, - pub jump: bool, - pub shift: bool, - pub sprint: bool, -} - -impl McBufReadable for ServerboundPlayerInputPacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let set = FixedBitSet::<7>::read_from(buf)?; - Ok(Self { - forward: set.index(0), - backward: set.index(1), - left: set.index(2), - right: set.index(3), - jump: set.index(4), - shift: set.index(5), - sprint: set.index(6), - }) - } -} - -impl McBufWritable for ServerboundPlayerInputPacket { - fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { - let mut set = FixedBitSet::<7>::new(); - if self.forward { - set.set(0); - } - if self.backward { - set.set(1); - } - if self.left { - set.set(2); - } - if self.right { - set.set(3); - } - if self.jump { - set.set(4); - } - if self.shift { - set.set(5); - } - if self.sprint { - set.set(6); - } - set.write_into(buf) - } -} diff --git a/azalea-protocol/src/packets/game/serverbound_pong_packet.rs b/azalea-protocol/src/packets/game/serverbound_pong_packet.rs deleted file mode 100755 index 17f1ac81..00000000 --- a/azalea-protocol/src/packets/game/serverbound_pong_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundPongPacket { - pub id: u32, -} diff --git a/azalea-protocol/src/packets/game/serverbound_recipe_book_change_settings_packet.rs b/azalea-protocol/src/packets/game/serverbound_recipe_book_change_settings_packet.rs deleted file mode 100755 index 6b3f015b..00000000 --- a/azalea-protocol/src/packets/game/serverbound_recipe_book_change_settings_packet.rs +++ /dev/null @@ -1,17 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundRecipeBookChangeSettingsPacket { - pub book_type: RecipeBookType, - pub is_open: bool, - pub is_filtering: bool, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum RecipeBookType { - Crafting = 0, - Furnace = 1, - BlastFurnace = 2, - Smoker = 3, -} diff --git a/azalea-protocol/src/packets/game/serverbound_recipe_book_seen_recipe_packet.rs b/azalea-protocol/src/packets/game/serverbound_recipe_book_seen_recipe_packet.rs deleted file mode 100755 index 9923e3a6..00000000 --- a/azalea-protocol/src/packets/game/serverbound_recipe_book_seen_recipe_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundRecipeBookSeenRecipePacket { - pub recipe: ResourceLocation, -} diff --git a/azalea-protocol/src/packets/game/serverbound_rename_item_packet.rs b/azalea-protocol/src/packets/game/serverbound_rename_item_packet.rs deleted file mode 100755 index 8308ac31..00000000 --- a/azalea-protocol/src/packets/game/serverbound_rename_item_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundRenameItemPacket { - pub name: String, -} diff --git a/azalea-protocol/src/packets/game/serverbound_resource_pack_packet.rs b/azalea-protocol/src/packets/game/serverbound_resource_pack_packet.rs deleted file mode 100755 index f285707b..00000000 --- a/azalea-protocol/src/packets/game/serverbound_resource_pack_packet.rs +++ /dev/null @@ -1,20 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; -use uuid::Uuid; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundResourcePackPacket { - pub id: Uuid, - pub action: Action, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum Action { - SuccessfullyLoaded = 0, - Declined = 1, - FailedDownload = 2, - Accepted = 3, - InvalidUrl = 4, - FailedReload = 5, - Discarded = 6, -} diff --git a/azalea-protocol/src/packets/game/serverbound_seen_advancements_packet.rs b/azalea-protocol/src/packets/game/serverbound_seen_advancements_packet.rs deleted file mode 100755 index 54fd4cc9..00000000 --- a/azalea-protocol/src/packets/game/serverbound_seen_advancements_packet.rs +++ /dev/null @@ -1,41 +0,0 @@ -use std::io::Cursor; - -use azalea_buf::{McBuf, McBufReadable, McBufWritable}; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ServerboundGamePacket; - -use crate::packets::BufReadError; - -#[derive(Clone, Debug, ServerboundGamePacket)] -pub struct ServerboundSeenAdvancementsPacket { - pub action: Action, - pub tab: Option, -} - -#[derive(McBuf, Clone, Copy, Debug, Eq, PartialEq)] -pub enum Action { - OpenedTab = 0, - ClosedScreen = 1, -} - -impl McBufReadable for ServerboundSeenAdvancementsPacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let action = Action::read_from(buf)?; - let tab = if action == Action::OpenedTab { - Some(ResourceLocation::read_from(buf)?) - } else { - None - }; - Ok(Self { action, tab }) - } -} - -impl McBufWritable for ServerboundSeenAdvancementsPacket { - fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { - self.action.write_into(buf)?; - if let Some(tab) = &self.tab { - tab.write_into(buf)?; - } - Ok(()) - } -} diff --git a/azalea-protocol/src/packets/game/serverbound_select_bundle_item_packet.rs b/azalea-protocol/src/packets/game/serverbound_select_bundle_item_packet.rs deleted file mode 100644 index 3a315183..00000000 --- a/azalea-protocol/src/packets/game/serverbound_select_bundle_item_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSelectBundleItemPacket { - #[var] - pub slot_id: i32, - #[var] - pub selected_item_index: u32, -} diff --git a/azalea-protocol/src/packets/game/serverbound_select_trade_packet.rs b/azalea-protocol/src/packets/game/serverbound_select_trade_packet.rs deleted file mode 100755 index b13e30d5..00000000 --- a/azalea-protocol/src/packets/game/serverbound_select_trade_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSelectTradePacket { - #[var] - pub item: u32, -} diff --git a/azalea-protocol/src/packets/game/serverbound_set_beacon_packet.rs b/azalea-protocol/src/packets/game/serverbound_set_beacon_packet.rs deleted file mode 100755 index db76cb9c..00000000 --- a/azalea-protocol/src/packets/game/serverbound_set_beacon_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSetBeaconPacket { - #[var] - pub primary: Option, - #[var] - pub secondary: Option, -} diff --git a/azalea-protocol/src/packets/game/serverbound_set_carried_item_packet.rs b/azalea-protocol/src/packets/game/serverbound_set_carried_item_packet.rs deleted file mode 100755 index 044cdeb0..00000000 --- a/azalea-protocol/src/packets/game/serverbound_set_carried_item_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSetCarriedItemPacket { - pub slot: u16, -} diff --git a/azalea-protocol/src/packets/game/serverbound_set_command_block_packet.rs b/azalea-protocol/src/packets/game/serverbound_set_command_block_packet.rs deleted file mode 100755 index db6557fd..00000000 --- a/azalea-protocol/src/packets/game/serverbound_set_command_block_packet.rs +++ /dev/null @@ -1,63 +0,0 @@ -use std::io::Cursor; - -use azalea_buf::{BufReadError, McBuf, McBufReadable}; -use azalea_core::{bitset::FixedBitSet, position::BlockPos}; -use azalea_protocol_macros::ServerboundGamePacket; - -use crate::packets::McBufWritable; - -#[derive(Clone, Debug, ServerboundGamePacket)] -pub struct ServerboundSetCommandBlockPacket { - pub pos: BlockPos, - pub command: String, - pub mode: Mode, - - pub track_output: bool, - pub conditional: bool, - pub automatic: bool, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum Mode { - Sequence = 0, - Auto = 1, - Redstone = 2, -} - -impl McBufReadable for ServerboundSetCommandBlockPacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let pos = BlockPos::read_from(buf)?; - let command = String::read_from(buf)?; - let mode = Mode::read_from(buf)?; - - let set = FixedBitSet::<3>::read_from(buf)?; - Ok(Self { - pos, - command, - mode, - track_output: set.index(0), - conditional: set.index(1), - automatic: set.index(2), - }) - } -} - -impl McBufWritable for ServerboundSetCommandBlockPacket { - fn write_into(&self, buf: &mut impl std::io::Write) -> Result<(), std::io::Error> { - self.pos.write_into(buf)?; - self.command.write_into(buf)?; - self.mode.write_into(buf)?; - - let mut set = FixedBitSet::<3>::new(); - if self.track_output { - set.set(0); - } - if self.conditional { - set.set(1); - } - if self.automatic { - set.set(2); - } - set.write_into(buf) - } -} diff --git a/azalea-protocol/src/packets/game/serverbound_set_command_minecart_packet.rs b/azalea-protocol/src/packets/game/serverbound_set_command_minecart_packet.rs deleted file mode 100755 index 7756c924..00000000 --- a/azalea-protocol/src/packets/game/serverbound_set_command_minecart_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSetCommandMinecartPacket { - #[var] - pub entity: u32, - pub command: String, - pub track_output: bool, -} diff --git a/azalea-protocol/src/packets/game/serverbound_set_creative_mode_slot_packet.rs b/azalea-protocol/src/packets/game/serverbound_set_creative_mode_slot_packet.rs deleted file mode 100755 index 7730bf5a..00000000 --- a/azalea-protocol/src/packets/game/serverbound_set_creative_mode_slot_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_inventory::ItemSlot; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSetCreativeModeSlotPacket { - pub slot_num: u16, - pub item_stack: ItemSlot, -} diff --git a/azalea-protocol/src/packets/game/serverbound_set_jigsaw_block_packet.rs b/azalea-protocol/src/packets/game/serverbound_set_jigsaw_block_packet.rs deleted file mode 100755 index 33a82311..00000000 --- a/azalea-protocol/src/packets/game/serverbound_set_jigsaw_block_packet.rs +++ /dev/null @@ -1,51 +0,0 @@ -use std::io::Cursor; -use std::io::Write; - -use azalea_buf::McBuf; -use azalea_buf::McBufReadable; -use azalea_core::position::BlockPos; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ServerboundGamePacket; - -use crate::packets::BufReadError; -use crate::packets::McBufWritable; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSetJigsawBlockPacket { - pub pos: BlockPos, - pub name: ResourceLocation, - pub target: ResourceLocation, - pub pool: ResourceLocation, - pub final_state: String, - pub joint: String, - #[var] - pub selection_priority: i32, - #[var] - pub placement_priority: i32, -} - -pub enum JointType { - Rollable, - Aligned, -} - -impl McBufReadable for JointType { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let name = String::read_from(buf)?; - match name.as_str() { - "rollable" => Ok(JointType::Rollable), - "aligned" => Ok(JointType::Aligned), - _ => Err(BufReadError::UnexpectedStringEnumVariant { id: name }), - } - } -} - -impl McBufWritable for JointType { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - match self { - JointType::Rollable => "rollable".to_string().write_into(buf)?, - JointType::Aligned => "aligned".to_string().write_into(buf)?, - }; - Ok(()) - } -} diff --git a/azalea-protocol/src/packets/game/serverbound_set_structure_block_packet.rs b/azalea-protocol/src/packets/game/serverbound_set_structure_block_packet.rs deleted file mode 100755 index c2872812..00000000 --- a/azalea-protocol/src/packets/game/serverbound_set_structure_block_packet.rs +++ /dev/null @@ -1,98 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::McBuf; -use azalea_buf::{McBufReadable, McBufWritable}; -use azalea_core::{bitset::FixedBitSet, position::BlockPos}; -use azalea_protocol_macros::ServerboundGamePacket; - -use crate::packets::BufReadError; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSetStructureBlockPacket { - pub pos: BlockPos, - pub update_type: UpdateType, - pub mode: StructureMode, - pub name: String, - pub offset: BytePosition, - pub size: BytePosition, - pub mirror: Mirror, - pub rotation: Rotation, - pub data: String, - pub integrity: f32, - #[var] - pub seed: u64, - pub flags: Flags, -} - -#[derive(Clone, Debug, McBuf)] -pub struct BytePosition { - pub x: u8, - pub y: u8, - pub z: u8, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum UpdateType { - UpdateData = 0, - SaveArea = 1, - LoadArea = 2, - ScanArea = 3, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum StructureMode { - Save = 0, - Load = 1, - Corner = 2, - Data = 3, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum Mirror { - None = 0, - LeftRight = 1, - FrontBack = 2, -} - -#[derive(McBuf, Clone, Copy, Debug)] -pub enum Rotation { - None = 0, - Clockwise90 = 1, - Clockwise180 = 2, - Counterclockwise90 = 3, -} - -#[derive(Debug, Clone)] -pub struct Flags { - pub ignore_entities: bool, - pub show_air: bool, - pub show_bounding_box: bool, -} - -impl McBufReadable for Flags { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let set = FixedBitSet::<3>::read_from(buf)?; - Ok(Self { - ignore_entities: set.index(0), - show_air: set.index(1), - show_bounding_box: set.index(2), - }) - } -} - -impl McBufWritable for Flags { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - let mut set = FixedBitSet::<3>::new(); - if self.ignore_entities { - set.set(0); - } - if self.show_air { - set.set(1); - } - if self.show_bounding_box { - set.set(2); - } - set.write_into(buf)?; - Ok(()) - } -} diff --git a/azalea-protocol/src/packets/game/serverbound_sign_update_packet.rs b/azalea-protocol/src/packets/game/serverbound_sign_update_packet.rs deleted file mode 100755 index 0547c783..00000000 --- a/azalea-protocol/src/packets/game/serverbound_sign_update_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::position::BlockPos; -use azalea_protocol_macros::ServerboundGamePacket; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSignUpdatePacket { - pub pos: BlockPos, - pub is_front_text: bool, - pub lines: [String; 4], -} diff --git a/azalea-protocol/src/packets/game/serverbound_swing_packet.rs b/azalea-protocol/src/packets/game/serverbound_swing_packet.rs deleted file mode 100755 index 53b4a6c1..00000000 --- a/azalea-protocol/src/packets/game/serverbound_swing_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -use crate::packets::game::serverbound_interact_packet::InteractionHand; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundSwingPacket { - pub hand: InteractionHand, -} diff --git a/azalea-protocol/src/packets/game/serverbound_teleport_to_entity_packet.rs b/azalea-protocol/src/packets/game/serverbound_teleport_to_entity_packet.rs deleted file mode 100755 index a7190ea5..00000000 --- a/azalea-protocol/src/packets/game/serverbound_teleport_to_entity_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; -use uuid::Uuid; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundTeleportToEntityPacket { - pub uuid: Uuid, -} diff --git a/azalea-protocol/src/packets/game/serverbound_use_item_on_packet.rs b/azalea-protocol/src/packets/game/serverbound_use_item_on_packet.rs deleted file mode 100755 index 66048327..00000000 --- a/azalea-protocol/src/packets/game/serverbound_use_item_on_packet.rs +++ /dev/null @@ -1,74 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable}; -use azalea_core::{ - direction::Direction, - position::{BlockPos, Vec3}, -}; -use azalea_protocol_macros::ServerboundGamePacket; - -use crate::packets::game::serverbound_interact_packet::InteractionHand; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundUseItemOnPacket { - pub hand: InteractionHand, - pub block_hit: BlockHit, - #[var] - pub sequence: u32, -} - -#[derive(Clone, Debug)] -pub struct BlockHit { - /// The block that we clicked. - pub block_pos: BlockPos, - /// The face of the block that was clicked. - pub direction: Direction, - /// The exact coordinates of the world where the block was clicked. In the - /// network, this is transmitted as the difference between the location and - /// block position. - pub location: Vec3, - /// Whether the player's head is inside of a block. - pub inside: bool, -} - -impl McBufWritable for BlockHit { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - self.block_pos.write_into(buf)?; - self.direction.write_into(buf)?; - f32::write_into( - &((self.location.x - f64::from(self.block_pos.x)) as f32), - buf, - )?; - f32::write_into( - &((self.location.y - f64::from(self.block_pos.y)) as f32), - buf, - )?; - f32::write_into( - &((self.location.z - f64::from(self.block_pos.z)) as f32), - buf, - )?; - self.inside.write_into(buf)?; - Ok(()) - } -} - -impl McBufReadable for BlockHit { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let block_pos = BlockPos::read_from(buf)?; - let direction = Direction::read_from(buf)?; - let cursor_x = f32::read_from(buf)?; - let cursor_y = f32::read_from(buf)?; - let cursor_z = f32::read_from(buf)?; - let inside = bool::read_from(buf)?; - Ok(Self { - block_pos, - direction, - location: Vec3 { - x: f64::from(block_pos.x) + f64::from(cursor_x), - y: f64::from(block_pos.y) + f64::from(cursor_y), - z: f64::from(block_pos.z) + f64::from(cursor_z), - }, - inside, - }) - } -} diff --git a/azalea-protocol/src/packets/game/serverbound_use_item_packet.rs b/azalea-protocol/src/packets/game/serverbound_use_item_packet.rs deleted file mode 100755 index b9f12f23..00000000 --- a/azalea-protocol/src/packets/game/serverbound_use_item_packet.rs +++ /dev/null @@ -1,13 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundGamePacket; - -use crate::packets::game::serverbound_interact_packet::InteractionHand; - -#[derive(Clone, Debug, McBuf, ServerboundGamePacket)] -pub struct ServerboundUseItemPacket { - pub hand: InteractionHand, - #[var] - pub sequence: u32, - pub yaw: f32, - pub pitch: f32, -} diff --git a/azalea-protocol/src/packets/handshake/mod.rs b/azalea-protocol/src/packets/handshake/mod.rs new file mode 100755 index 00000000..90a312e7 --- /dev/null +++ b/azalea-protocol/src/packets/handshake/mod.rs @@ -0,0 +1,12 @@ +// NOTE: This file is generated automatically by codegen/packet.py. +// Don't edit it directly! + +use azalea_protocol_macros::declare_state_packets; + +declare_state_packets!(HandshakePacket, + Clientbound => [ + ], + Serverbound => [ + intention, + ] +); diff --git a/azalea-protocol/src/packets/handshake/s_intention.rs b/azalea-protocol/src/packets/handshake/s_intention.rs new file mode 100755 index 00000000..566ada30 --- /dev/null +++ b/azalea-protocol/src/packets/handshake/s_intention.rs @@ -0,0 +1,15 @@ +use std::hash::Hash; + +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundHandshakePacket; + +use crate::packets::ClientIntention; + +#[derive(Hash, Clone, Debug, AzBuf, ServerboundHandshakePacket)] +pub struct ServerboundIntention { + #[var] + pub protocol_version: i32, + pub hostname: String, + pub port: u16, + pub intention: ClientIntention, +} diff --git a/azalea-protocol/src/packets/handshaking/client_intention_packet.rs b/azalea-protocol/src/packets/handshaking/client_intention_packet.rs deleted file mode 100755 index c0b694c8..00000000 --- a/azalea-protocol/src/packets/handshaking/client_intention_packet.rs +++ /dev/null @@ -1,15 +0,0 @@ -use std::hash::Hash; - -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundHandshakePacket; - -use crate::packets::ClientIntention; - -#[derive(Hash, Clone, Debug, McBuf, ServerboundHandshakePacket)] -pub struct ClientIntentionPacket { - #[var] - pub protocol_version: i32, - pub hostname: String, - pub port: u16, - pub intention: ClientIntention, -} diff --git a/azalea-protocol/src/packets/handshaking/mod.rs b/azalea-protocol/src/packets/handshaking/mod.rs deleted file mode 100755 index f2e8810e..00000000 --- a/azalea-protocol/src/packets/handshaking/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod client_intention_packet; - -use azalea_protocol_macros::declare_state_packets; - -declare_state_packets!( - HandshakePacket, - Serverbound => { - 0x00: client_intention_packet::ClientIntentionPacket, - }, - Clientbound => {} -); diff --git a/azalea-protocol/src/packets/login/c_cookie_request.rs b/azalea-protocol/src/packets/login/c_cookie_request.rs new file mode 100755 index 00000000..d0bb0cd7 --- /dev/null +++ b/azalea-protocol/src/packets/login/c_cookie_request.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundLoginPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundLoginPacket)] +pub struct ClientboundCookieRequest { + pub key: ResourceLocation, +} diff --git a/azalea-protocol/src/packets/login/c_custom_query.rs b/azalea-protocol/src/packets/login/c_custom_query.rs new file mode 100755 index 00000000..80c698e6 --- /dev/null +++ b/azalea-protocol/src/packets/login/c_custom_query.rs @@ -0,0 +1,13 @@ +use std::hash::Hash; + +use azalea_buf::{AzBuf, UnsizedByteArray}; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ClientboundLoginPacket; + +#[derive(Hash, Clone, Debug, AzBuf, ClientboundLoginPacket)] +pub struct ClientboundCustomQuery { + #[var] + pub transaction_id: u32, + pub identifier: ResourceLocation, + pub data: UnsizedByteArray, +} diff --git a/azalea-protocol/src/packets/login/c_hello.rs b/azalea-protocol/src/packets/login/c_hello.rs new file mode 100755 index 00000000..6011ec23 --- /dev/null +++ b/azalea-protocol/src/packets/login/c_hello.rs @@ -0,0 +1,11 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundLoginPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundLoginPacket)] +pub struct ClientboundHello { + #[limit(20)] + pub server_id: String, + pub public_key: Vec, + pub challenge: Vec, + pub should_authenticate: bool, +} diff --git a/azalea-protocol/src/packets/login/c_login_compression.rs b/azalea-protocol/src/packets/login/c_login_compression.rs new file mode 100755 index 00000000..c53e3829 --- /dev/null +++ b/azalea-protocol/src/packets/login/c_login_compression.rs @@ -0,0 +1,10 @@ +use std::hash::Hash; + +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundLoginPacket; + +#[derive(Hash, Clone, Debug, ClientboundLoginPacket, AzBuf)] +pub struct ClientboundLoginCompression { + #[var] + pub compression_threshold: i32, +} diff --git a/azalea-protocol/src/packets/login/c_login_disconnect.rs b/azalea-protocol/src/packets/login/c_login_disconnect.rs new file mode 100755 index 00000000..a0e50aa4 --- /dev/null +++ b/azalea-protocol/src/packets/login/c_login_disconnect.rs @@ -0,0 +1,32 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError}; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundLoginPacket; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, ClientboundLoginPacket)] +pub struct ClientboundLoginDisconnect { + pub reason: FormattedText, +} + +impl AzaleaRead for ClientboundLoginDisconnect { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let disconnect_string = String::azalea_read(buf)?; + let disconnect_json: serde_json::Value = serde_json::from_str(disconnect_string.as_str())?; + + Ok(ClientboundLoginDisconnect { + reason: FormattedText::deserialize(disconnect_json)?, + }) + } +} + +impl AzaleaWrite for ClientboundLoginDisconnect { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let status_string = FormattedText::serialize(&self.reason, serde_json::value::Serializer) + .unwrap() + .to_string(); + status_string.azalea_write(buf)?; + Ok(()) + } +} diff --git a/azalea-protocol/src/packets/login/c_login_finished.rs b/azalea-protocol/src/packets/login/c_login_finished.rs new file mode 100755 index 00000000..482ea53f --- /dev/null +++ b/azalea-protocol/src/packets/login/c_login_finished.rs @@ -0,0 +1,8 @@ +use azalea_auth::game_profile::GameProfile; +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundLoginPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundLoginPacket)] +pub struct ClientboundLoginFinished { + pub game_profile: GameProfile, +} diff --git a/azalea-protocol/src/packets/login/clientbound_cookie_request_packet.rs b/azalea-protocol/src/packets/login/clientbound_cookie_request_packet.rs deleted file mode 100755 index 27ea0c09..00000000 --- a/azalea-protocol/src/packets/login/clientbound_cookie_request_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundLoginPacket; - -#[derive(Clone, Debug, McBuf, ClientboundLoginPacket)] -pub struct ClientboundCookieRequestPacket { - pub key: FormattedText, -} diff --git a/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs b/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs deleted file mode 100755 index 75993fd9..00000000 --- a/azalea-protocol/src/packets/login/clientbound_custom_query_packet.rs +++ /dev/null @@ -1,13 +0,0 @@ -use std::hash::Hash; - -use azalea_buf::{McBuf, UnsizedByteArray}; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ClientboundLoginPacket; - -#[derive(Hash, Clone, Debug, McBuf, ClientboundLoginPacket)] -pub struct ClientboundCustomQueryPacket { - #[var] - pub transaction_id: u32, - pub identifier: ResourceLocation, - pub data: UnsizedByteArray, -} diff --git a/azalea-protocol/src/packets/login/clientbound_hello_packet.rs b/azalea-protocol/src/packets/login/clientbound_hello_packet.rs deleted file mode 100755 index 9beb499c..00000000 --- a/azalea-protocol/src/packets/login/clientbound_hello_packet.rs +++ /dev/null @@ -1,12 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundLoginPacket; - -#[derive(Clone, Debug, McBuf, ClientboundLoginPacket)] -pub struct ClientboundHelloPacket { - // TODO: make this len thing work - // #[len(20)] - pub server_id: String, - pub public_key: Vec, - pub challenge: Vec, - pub should_authenticate: bool, -} diff --git a/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs b/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs deleted file mode 100755 index 4b8fb0c8..00000000 --- a/azalea-protocol/src/packets/login/clientbound_login_compression_packet.rs +++ /dev/null @@ -1,10 +0,0 @@ -use std::hash::Hash; - -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundLoginPacket; - -#[derive(Hash, Clone, Debug, ClientboundLoginPacket, McBuf)] -pub struct ClientboundLoginCompressionPacket { - #[var] - pub compression_threshold: i32, -} diff --git a/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs b/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs deleted file mode 100755 index 416ec63b..00000000 --- a/azalea-protocol/src/packets/login/clientbound_login_disconnect_packet.rs +++ /dev/null @@ -1,34 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::{BufReadError, McBufReadable, McBufWritable}; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundLoginPacket; -use serde::{Deserialize, Serialize}; - -#[derive(Clone, Debug, ClientboundLoginPacket)] -pub struct ClientboundLoginDisconnectPacket { - pub reason: FormattedText, -} - -impl McBufReadable for ClientboundLoginDisconnectPacket { - fn read_from( - buf: &mut Cursor<&[u8]>, - ) -> Result { - let disconnect_string = String::read_from(buf)?; - let disconnect_json: serde_json::Value = serde_json::from_str(disconnect_string.as_str())?; - - Ok(ClientboundLoginDisconnectPacket { - reason: FormattedText::deserialize(disconnect_json)?, - }) - } -} - -impl McBufWritable for ClientboundLoginDisconnectPacket { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - let status_string = FormattedText::serialize(&self.reason, serde_json::value::Serializer) - .unwrap() - .to_string(); - status_string.write_into(buf)?; - Ok(()) - } -} diff --git a/azalea-protocol/src/packets/login/clientbound_login_finished_packet.rs b/azalea-protocol/src/packets/login/clientbound_login_finished_packet.rs deleted file mode 100755 index f885f67f..00000000 --- a/azalea-protocol/src/packets/login/clientbound_login_finished_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_auth::game_profile::GameProfile; -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundLoginPacket; - -#[derive(Clone, Debug, McBuf, ClientboundLoginPacket)] -pub struct ClientboundLoginFinishedPacket { - pub game_profile: GameProfile, -} diff --git a/azalea-protocol/src/packets/login/mod.rs b/azalea-protocol/src/packets/login/mod.rs index 3d218cc1..9edf50cf 100755 --- a/azalea-protocol/src/packets/login/mod.rs +++ b/azalea-protocol/src/packets/login/mod.rs @@ -1,32 +1,22 @@ -pub mod clientbound_cookie_request_packet; -pub mod clientbound_custom_query_packet; -pub mod clientbound_hello_packet; -pub mod clientbound_login_compression_packet; -pub mod clientbound_login_disconnect_packet; -pub mod clientbound_login_finished_packet; -pub mod serverbound_cookie_response_packet; -pub mod serverbound_custom_query_answer_packet; -pub mod serverbound_hello_packet; -pub mod serverbound_key_packet; -pub mod serverbound_login_acknowledged_packet; +// NOTE: This file is generated automatically by codegen/packet.py. +// Don't edit it directly! use azalea_protocol_macros::declare_state_packets; -declare_state_packets!( - LoginPacket, - Serverbound => { - 0x00: serverbound_hello_packet::ServerboundHelloPacket, - 0x01: serverbound_key_packet::ServerboundKeyPacket, - 0x02: serverbound_custom_query_answer_packet::ServerboundCustomQueryAnswerPacket, - 0x03: serverbound_login_acknowledged_packet::ServerboundLoginAcknowledgedPacket, - 0x04: serverbound_cookie_response_packet::ServerboundCookieResponsePacket, - }, - Clientbound => { - 0x00: clientbound_login_disconnect_packet::ClientboundLoginDisconnectPacket, - 0x01: clientbound_hello_packet::ClientboundHelloPacket, - 0x02: clientbound_login_finished_packet::ClientboundLoginFinishedPacket, - 0x03: clientbound_login_compression_packet::ClientboundLoginCompressionPacket, - 0x04: clientbound_custom_query_packet::ClientboundCustomQueryPacket, - 0x05: clientbound_cookie_request_packet::ClientboundCookieRequestPacket, - } +declare_state_packets!(LoginPacket, + Clientbound => [ + login_disconnect, + hello, + login_finished, + login_compression, + custom_query, + cookie_request, + ], + Serverbound => [ + hello, + key, + custom_query_answer, + login_acknowledged, + cookie_response, + ] ); diff --git a/azalea-protocol/src/packets/login/s_cookie_response.rs b/azalea-protocol/src/packets/login/s_cookie_response.rs new file mode 100755 index 00000000..5e757600 --- /dev/null +++ b/azalea-protocol/src/packets/login/s_cookie_response.rs @@ -0,0 +1,9 @@ +use azalea_buf::AzBuf; +use azalea_core::resource_location::ResourceLocation; +use azalea_protocol_macros::ServerboundLoginPacket; + +#[derive(Clone, Debug, AzBuf, ServerboundLoginPacket)] +pub struct ServerboundCookieResponse { + pub key: ResourceLocation, + pub payload: Option>, +} diff --git a/azalea-protocol/src/packets/login/s_custom_query.rs b/azalea-protocol/src/packets/login/s_custom_query.rs new file mode 100755 index 00000000..39ecdcef --- /dev/null +++ b/azalea-protocol/src/packets/login/s_custom_query.rs @@ -0,0 +1,9 @@ +use azalea_buf::{AzBuf, UnsizedByteArray}; +use azalea_protocol_macros::ServerboundLoginPacket; + +#[derive(Clone, Debug, AzBuf, ServerboundLoginPacket)] +pub struct ServerboundCustomQuery { + #[var] + pub transaction_id: u32, + pub data: Option, +} diff --git a/azalea-protocol/src/packets/login/s_custom_query_answer.rs b/azalea-protocol/src/packets/login/s_custom_query_answer.rs new file mode 100644 index 00000000..34820294 --- /dev/null +++ b/azalea-protocol/src/packets/login/s_custom_query_answer.rs @@ -0,0 +1,11 @@ +use std::hash::Hash; + +use azalea_buf::{AzBuf, UnsizedByteArray}; +use azalea_protocol_macros::ServerboundLoginPacket; + +#[derive(Hash, Clone, Debug, AzBuf, ServerboundLoginPacket)] +pub struct ServerboundCustomQueryAnswer { + #[var] + pub transaction_id: u32, + pub data: Option, +} diff --git a/azalea-protocol/src/packets/login/s_hello.rs b/azalea-protocol/src/packets/login/s_hello.rs new file mode 100755 index 00000000..bae1947b --- /dev/null +++ b/azalea-protocol/src/packets/login/s_hello.rs @@ -0,0 +1,31 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundLoginPacket; +use uuid::Uuid; + +#[derive(Clone, Debug, PartialEq, Eq, AzBuf, ServerboundLoginPacket)] +pub struct ServerboundHello { + #[limit(16)] + pub name: String, + pub profile_id: Uuid, +} + +#[cfg(test)] +mod tests { + use std::io::Cursor; + + use azalea_buf::{AzaleaRead, AzaleaWrite}; + + use super::*; + + #[test] + fn test_read_write() { + let packet = ServerboundHello { + name: "test".to_string(), + profile_id: Uuid::nil(), + }; + let mut buf: Vec = Vec::new(); + packet.azalea_write(&mut buf).unwrap(); + let packet2 = ServerboundHello::azalea_read(&mut Cursor::new(&buf)).unwrap(); + assert_eq!(packet, packet2); + } +} diff --git a/azalea-protocol/src/packets/login/s_key.rs b/azalea-protocol/src/packets/login/s_key.rs new file mode 100755 index 00000000..1b96d445 --- /dev/null +++ b/azalea-protocol/src/packets/login/s_key.rs @@ -0,0 +1,8 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundLoginPacket; + +#[derive(Clone, Debug, AzBuf, ServerboundLoginPacket)] +pub struct ServerboundKey { + pub key_bytes: Vec, + pub encrypted_challenge: Vec, +} diff --git a/azalea-protocol/src/packets/login/s_login_acknowledged.rs b/azalea-protocol/src/packets/login/s_login_acknowledged.rs new file mode 100644 index 00000000..e36648b6 --- /dev/null +++ b/azalea-protocol/src/packets/login/s_login_acknowledged.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundLoginPacket; + +#[derive(Clone, Debug, AzBuf, ServerboundLoginPacket)] +pub struct ServerboundLoginAcknowledged {} diff --git a/azalea-protocol/src/packets/login/serverbound_cookie_response_packet.rs b/azalea-protocol/src/packets/login/serverbound_cookie_response_packet.rs deleted file mode 100755 index 2074e2e7..00000000 --- a/azalea-protocol/src/packets/login/serverbound_cookie_response_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::McBuf; -use azalea_core::resource_location::ResourceLocation; -use azalea_protocol_macros::ServerboundLoginPacket; - -#[derive(Clone, Debug, McBuf, ServerboundLoginPacket)] -pub struct ServerboundCookieResponsePacket { - pub key: ResourceLocation, - pub payload: Option>, -} diff --git a/azalea-protocol/src/packets/login/serverbound_custom_query_answer_packet.rs b/azalea-protocol/src/packets/login/serverbound_custom_query_answer_packet.rs deleted file mode 100644 index fe9460a2..00000000 --- a/azalea-protocol/src/packets/login/serverbound_custom_query_answer_packet.rs +++ /dev/null @@ -1,11 +0,0 @@ -use std::hash::Hash; - -use azalea_buf::{McBuf, UnsizedByteArray}; -use azalea_protocol_macros::ServerboundLoginPacket; - -#[derive(Hash, Clone, Debug, McBuf, ServerboundLoginPacket)] -pub struct ServerboundCustomQueryAnswerPacket { - #[var] - pub transaction_id: u32, - pub data: Option, -} diff --git a/azalea-protocol/src/packets/login/serverbound_custom_query_packet.rs b/azalea-protocol/src/packets/login/serverbound_custom_query_packet.rs deleted file mode 100755 index 1d1885cf..00000000 --- a/azalea-protocol/src/packets/login/serverbound_custom_query_packet.rs +++ /dev/null @@ -1,9 +0,0 @@ -use azalea_buf::{McBuf, UnsizedByteArray}; -use azalea_protocol_macros::ServerboundLoginPacket; - -#[derive(Clone, Debug, McBuf, ServerboundLoginPacket)] -pub struct ServerboundCustomQueryPacket { - #[var] - pub transaction_id: u32, - pub data: Option, -} diff --git a/azalea-protocol/src/packets/login/serverbound_hello_packet.rs b/azalea-protocol/src/packets/login/serverbound_hello_packet.rs deleted file mode 100755 index 51ff1830..00000000 --- a/azalea-protocol/src/packets/login/serverbound_hello_packet.rs +++ /dev/null @@ -1,30 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundLoginPacket; -use uuid::Uuid; - -#[derive(Clone, Debug, PartialEq, Eq, McBuf, ServerboundLoginPacket)] -pub struct ServerboundHelloPacket { - pub name: String, - pub profile_id: Uuid, -} - -#[cfg(test)] -mod tests { - use std::io::Cursor; - - use azalea_buf::{McBufReadable, McBufWritable}; - - use super::*; - - #[test] - fn test_read_write() { - let packet = ServerboundHelloPacket { - name: "test".to_string(), - profile_id: Uuid::nil(), - }; - let mut buf: Vec = Vec::new(); - packet.write_into(&mut buf).unwrap(); - let packet2 = ServerboundHelloPacket::read_from(&mut Cursor::new(&buf)).unwrap(); - assert_eq!(packet, packet2); - } -} diff --git a/azalea-protocol/src/packets/login/serverbound_key_packet.rs b/azalea-protocol/src/packets/login/serverbound_key_packet.rs deleted file mode 100755 index dc0abeac..00000000 --- a/azalea-protocol/src/packets/login/serverbound_key_packet.rs +++ /dev/null @@ -1,8 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundLoginPacket; - -#[derive(Clone, Debug, McBuf, ServerboundLoginPacket)] -pub struct ServerboundKeyPacket { - pub key_bytes: Vec, - pub encrypted_challenge: Vec, -} diff --git a/azalea-protocol/src/packets/login/serverbound_login_acknowledged_packet.rs b/azalea-protocol/src/packets/login/serverbound_login_acknowledged_packet.rs deleted file mode 100644 index c242a494..00000000 --- a/azalea-protocol/src/packets/login/serverbound_login_acknowledged_packet.rs +++ /dev/null @@ -1,5 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundLoginPacket; - -#[derive(Clone, Debug, McBuf, ServerboundLoginPacket)] -pub struct ServerboundLoginAcknowledgedPacket {} diff --git a/azalea-protocol/src/packets/mod.rs b/azalea-protocol/src/packets/mod.rs index 1dabe175..14ae7c71 100755 --- a/azalea-protocol/src/packets/mod.rs +++ b/azalea-protocol/src/packets/mod.rs @@ -1,20 +1,18 @@ pub mod common; -pub mod configuration; +pub mod config; pub mod game; -pub mod handshaking; +pub mod handshake; pub mod login; pub mod status; use std::io::{Cursor, Write}; -use azalea_buf::{BufReadError, McBufVarReadable, McBufVarWritable, McBufWritable}; +use azalea_buf::{AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; use crate::read::ReadPacketError; -// TODO: rename the packet files to just like clientbound_add_entity instead of -// clientbound_add_entity_packet - pub const PROTOCOL_VERSION: i32 = 768; +pub const VERSION_NAME: &str = "1.21.3"; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum ConnectionProtocol { @@ -39,7 +37,7 @@ impl ConnectionProtocol { } } -/// An enum of packets for a certain protocol +/// An enum of packets for a certain protocol. pub trait ProtocolPacket where Self: Sized, @@ -52,6 +50,10 @@ where fn write(&self, buf: &mut impl Write) -> Result<(), std::io::Error>; } +pub trait Packet { + fn into_variant(self) -> Protocol; +} + #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum ClientIntention { Status = 1, @@ -81,16 +83,16 @@ impl From for ConnectionProtocol { } } -impl azalea_buf::McBufReadable for ClientIntention { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let id = i32::var_read_from(buf)?; +impl azalea_buf::AzaleaRead for ClientIntention { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let id = i32::azalea_read_var(buf)?; id.try_into() .map_err(|_| BufReadError::UnexpectedEnumVariant { id }) } } -impl McBufWritable for ClientIntention { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - (*self as i32).var_write_into(buf) +impl AzaleaWrite for ClientIntention { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + (*self as i32).azalea_write_var(buf) } } diff --git a/azalea-protocol/src/packets/status/c_pong_response.rs b/azalea-protocol/src/packets/status/c_pong_response.rs new file mode 100755 index 00000000..34a5e73b --- /dev/null +++ b/azalea-protocol/src/packets/status/c_pong_response.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ClientboundStatusPacket; + +#[derive(Clone, Debug, AzBuf, ClientboundStatusPacket)] +pub struct ClientboundPongResponse { + pub time: u64, +} diff --git a/azalea-protocol/src/packets/status/c_status_response.rs b/azalea-protocol/src/packets/status/c_status_response.rs new file mode 100755 index 00000000..b30c75be --- /dev/null +++ b/azalea-protocol/src/packets/status/c_status_response.rs @@ -0,0 +1,61 @@ +use std::io::{Cursor, Write}; + +use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError}; +use azalea_chat::FormattedText; +use azalea_protocol_macros::ClientboundStatusPacket; +use serde::{Deserialize, Serialize}; +use serde_json::value::Serializer; + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Version { + pub name: String, + pub protocol: i32, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct SamplePlayer { + pub id: String, + pub name: String, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Players { + pub max: i32, + pub online: i32, + #[serde(default)] + pub sample: Vec, +} + +// the entire packet is just json, which is why it has deserialize +#[derive(Clone, Debug, Serialize, Deserialize, ClientboundStatusPacket)] +pub struct ClientboundStatusResponse { + pub description: FormattedText, + #[serde(default)] + #[serde(skip_serializing_if = "Option::is_none")] + pub favicon: Option, + pub players: Players, + pub version: Version, + #[serde(default)] + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(rename = "enforcesSecureChat")] + pub enforces_secure_chat: Option, +} + +impl AzaleaRead for ClientboundStatusResponse { + fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result { + let status_string = String::azalea_read(buf)?; + let status_json: serde_json::Value = serde_json::from_str(status_string.as_str())?; + + Ok(ClientboundStatusResponse::deserialize(status_json)?) + } +} + +impl AzaleaWrite for ClientboundStatusResponse { + fn azalea_write(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let status_string = ClientboundStatusResponse::serialize(self, Serializer) + .unwrap() + .to_string(); + status_string.azalea_write(buf)?; + Ok(()) + } +} diff --git a/azalea-protocol/src/packets/status/clientbound_pong_response_packet.rs b/azalea-protocol/src/packets/status/clientbound_pong_response_packet.rs deleted file mode 100755 index 8c8a7bb1..00000000 --- a/azalea-protocol/src/packets/status/clientbound_pong_response_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ClientboundStatusPacket; - -#[derive(Clone, Debug, McBuf, ClientboundStatusPacket)] -pub struct ClientboundPongResponsePacket { - pub time: u64, -} diff --git a/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs b/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs deleted file mode 100755 index 1316894e..00000000 --- a/azalea-protocol/src/packets/status/clientbound_status_response_packet.rs +++ /dev/null @@ -1,61 +0,0 @@ -use std::io::{Cursor, Write}; - -use azalea_buf::{BufReadError, McBufReadable, McBufWritable}; -use azalea_chat::FormattedText; -use azalea_protocol_macros::ClientboundStatusPacket; -use serde::{Deserialize, Serialize}; -use serde_json::value::Serializer; - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct Version { - pub name: String, - pub protocol: i32, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct SamplePlayer { - pub id: String, - pub name: String, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct Players { - pub max: i32, - pub online: i32, - #[serde(default)] - pub sample: Vec, -} - -// the entire packet is just json, which is why it has deserialize -#[derive(Clone, Debug, Serialize, Deserialize, ClientboundStatusPacket)] -pub struct ClientboundStatusResponsePacket { - pub description: FormattedText, - #[serde(default)] - #[serde(skip_serializing_if = "Option::is_none")] - pub favicon: Option, - pub players: Players, - pub version: Version, - #[serde(default)] - #[serde(skip_serializing_if = "Option::is_none")] - #[serde(rename = "enforcesSecureChat")] - pub enforces_secure_chat: Option, -} - -impl McBufReadable for ClientboundStatusResponsePacket { - fn read_from(buf: &mut Cursor<&[u8]>) -> Result { - let status_string = String::read_from(buf)?; - let status_json: serde_json::Value = serde_json::from_str(status_string.as_str())?; - - Ok(ClientboundStatusResponsePacket::deserialize(status_json)?) - } -} - -impl McBufWritable for ClientboundStatusResponsePacket { - fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { - let status_string = ClientboundStatusResponsePacket::serialize(self, Serializer) - .unwrap() - .to_string(); - status_string.write_into(buf)?; - Ok(()) - } -} diff --git a/azalea-protocol/src/packets/status/mod.rs b/azalea-protocol/src/packets/status/mod.rs index 3c70c9b1..335600e3 100755 --- a/azalea-protocol/src/packets/status/mod.rs +++ b/azalea-protocol/src/packets/status/mod.rs @@ -1,18 +1,15 @@ -pub mod clientbound_pong_response_packet; -pub mod clientbound_status_response_packet; -pub mod serverbound_ping_request_packet; -pub mod serverbound_status_request_packet; +// NOTE: This file is generated automatically by codegen/packet.py. +// Don't edit it directly! use azalea_protocol_macros::declare_state_packets; -declare_state_packets!( - StatusPacket, - Serverbound => { - 0x00: serverbound_status_request_packet::ServerboundStatusRequestPacket, - 0x01: serverbound_ping_request_packet::ServerboundPingRequestPacket, - }, - Clientbound => { - 0x00: clientbound_status_response_packet::ClientboundStatusResponsePacket, - 0x01: clientbound_pong_response_packet::ClientboundPongResponsePacket, - } +declare_state_packets!(StatusPacket, + Clientbound => [ + status_response, + pong_response, + ], + Serverbound => [ + status_request, + ping_request, + ] ); diff --git a/azalea-protocol/src/packets/status/s_ping_request.rs b/azalea-protocol/src/packets/status/s_ping_request.rs new file mode 100755 index 00000000..34f2e062 --- /dev/null +++ b/azalea-protocol/src/packets/status/s_ping_request.rs @@ -0,0 +1,7 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundStatusPacket; + +#[derive(Clone, Debug, AzBuf, ServerboundStatusPacket)] +pub struct ServerboundPingRequest { + pub time: u64, +} diff --git a/azalea-protocol/src/packets/status/s_status_request.rs b/azalea-protocol/src/packets/status/s_status_request.rs new file mode 100755 index 00000000..662d74bf --- /dev/null +++ b/azalea-protocol/src/packets/status/s_status_request.rs @@ -0,0 +1,5 @@ +use azalea_buf::AzBuf; +use azalea_protocol_macros::ServerboundStatusPacket; + +#[derive(Clone, Debug, AzBuf, ServerboundStatusPacket)] +pub struct ServerboundStatusRequest {} diff --git a/azalea-protocol/src/packets/status/serverbound_ping_request_packet.rs b/azalea-protocol/src/packets/status/serverbound_ping_request_packet.rs deleted file mode 100755 index c546081c..00000000 --- a/azalea-protocol/src/packets/status/serverbound_ping_request_packet.rs +++ /dev/null @@ -1,7 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundStatusPacket; - -#[derive(Clone, Debug, McBuf, ServerboundStatusPacket)] -pub struct ServerboundPingRequestPacket { - pub time: u64, -} diff --git a/azalea-protocol/src/packets/status/serverbound_status_request_packet.rs b/azalea-protocol/src/packets/status/serverbound_status_request_packet.rs deleted file mode 100755 index 27fce3bf..00000000 --- a/azalea-protocol/src/packets/status/serverbound_status_request_packet.rs +++ /dev/null @@ -1,5 +0,0 @@ -use azalea_buf::McBuf; -use azalea_protocol_macros::ServerboundStatusPacket; - -#[derive(Clone, Debug, McBuf, ServerboundStatusPacket)] -pub struct ServerboundStatusRequestPacket {} diff --git a/azalea-protocol/src/read.rs b/azalea-protocol/src/read.rs index 67ea9aee..d75e3bad 100755 --- a/azalea-protocol/src/read.rs +++ b/azalea-protocol/src/read.rs @@ -6,8 +6,8 @@ use std::{ io::{Cursor, Read}, }; +use azalea_buf::AzaleaReadVar; use azalea_buf::BufReadError; -use azalea_buf::McBufVarReadable; use azalea_crypto::Aes128CfbDec; use bytes::Buf; use bytes::BytesMut; @@ -86,7 +86,7 @@ fn parse_frame(buffer: &mut BytesMut) -> Result { // the packet is all good we read it fully let mut buffer_copy = Cursor::new(&buffer[..]); // Packet Length - let length = match u32::var_read_from(&mut buffer_copy) { + let length = match u32::azalea_read_var(&mut buffer_copy) { Ok(length) => length as usize, Err(err) => match err { BufReadError::Io { source } => return Err(FrameSplitterError::Io { source }), @@ -134,7 +134,7 @@ pub fn deserialize_packet( ) -> Result> { // Packet ID let packet_id = - u32::var_read_from(stream).map_err(|e| ReadPacketError::ReadPacketId { source: e })?; + u32::azalea_read_var(stream).map_err(|e| ReadPacketError::ReadPacketId { source: e })?; P::read(packet_id, stream) } @@ -171,7 +171,7 @@ pub fn compression_decoder( compression_threshold: u32, ) -> Result, DecompressionError> { // Data Length - let n = u32::var_read_from(stream)?; + let n = u32::azalea_read_var(stream)?; if n == 0 { // no data size, no compression let mut buf = vec![]; @@ -351,7 +351,7 @@ where } if log::log_enabled!(log::Level::Trace) { - const DO_NOT_CUT_OFF_PACKET_LOGS: bool = false; + const DO_NOT_CUT_OFF_PACKET_LOGS: bool = true; let buf_string: String = { if !DO_NOT_CUT_OFF_PACKET_LOGS && buf.len() > 500 { diff --git a/azalea-protocol/src/write.rs b/azalea-protocol/src/write.rs index 0ec4308b..512d08ad 100755 --- a/azalea-protocol/src/write.rs +++ b/azalea-protocol/src/write.rs @@ -1,8 +1,11 @@ //! Write packets to a stream. -use std::{fmt::Debug, io::Read}; +use std::{ + fmt::Debug, + io::{self, Read}, +}; -use azalea_buf::McBufVarWritable; +use azalea_buf::AzaleaWriteVar; use azalea_crypto::Aes128CfbEnc; use flate2::{bufread::ZlibEncoder, Compression}; use thiserror::Error; @@ -11,31 +14,26 @@ use tracing::trace; use crate::{packets::ProtocolPacket, read::MAXIMUM_UNCOMPRESSED_LENGTH}; -/// Prepend the length of the packet to it. -fn frame_prepender(mut data: Vec) -> Result, std::io::Error> { - let mut buf = Vec::new(); - (data.len() as u32).var_write_into(&mut buf)?; - buf.append(&mut data); - Ok(buf) -} - -#[derive(Error, Debug)] -pub enum PacketEncodeError { - #[error("{0}")] - Io(#[from] std::io::Error), - #[error("Packet too big (is {actual} bytes, should be less than {maximum}): {packet_string}")] - TooBig { - actual: usize, - maximum: usize, - packet_string: String, - }, +pub async fn write_packet( + packet: &P, + stream: &mut W, + compression_threshold: Option, + cipher: &mut Option, +) -> io::Result<()> +where + P: ProtocolPacket + Debug, + W: AsyncWrite + Unpin + Send, +{ + trace!("Sending packet: {packet:?}"); + let raw_packet = serialize_packet(packet).unwrap(); + write_raw_packet(&raw_packet, stream, compression_threshold, cipher).await } pub fn serialize_packet( packet: &P, ) -> Result, PacketEncodeError> { let mut buf = Vec::new(); - packet.id().var_write_into(&mut buf)?; + packet.id().azalea_write_var(&mut buf)?; packet.write(&mut buf)?; if buf.len() > MAXIMUM_UNCOMPRESSED_LENGTH as usize { return Err(PacketEncodeError::TooBig { @@ -47,10 +45,26 @@ pub fn serialize_packet( Ok(buf) } -#[derive(Error, Debug)] -pub enum PacketCompressError { - #[error("{0}")] - Io(#[from] std::io::Error), +pub async fn write_raw_packet( + raw_packet: &[u8], + stream: &mut W, + compression_threshold: Option, + cipher: &mut Option, +) -> io::Result<()> +where + W: AsyncWrite + Unpin + Send, +{ + trace!("Writing raw packet: {raw_packet:?}"); + let mut raw_packet = raw_packet.to_vec(); + if let Some(threshold) = compression_threshold { + raw_packet = compression_encoder(&raw_packet, threshold).unwrap(); + } + raw_packet = frame_prepender(raw_packet).unwrap(); + // if we were given a cipher, encrypt the packet + if let Some(cipher) = cipher { + azalea_crypto::encrypt_packet(cipher, &mut raw_packet); + } + stream.write_all(&raw_packet).await } pub fn compression_encoder( @@ -61,58 +75,48 @@ pub fn compression_encoder( // if it's less than the compression threshold, don't compress if n < compression_threshold as usize { let mut buf = Vec::new(); - 0.var_write_into(&mut buf)?; - std::io::Write::write_all(&mut buf, data)?; + 0_u32.azalea_write_var(&mut buf)?; + io::Write::write_all(&mut buf, data)?; Ok(buf) } else { // otherwise, compress let mut deflater = ZlibEncoder::new(data, Compression::default()); + // write deflated data to buf let mut compressed_data = Vec::new(); deflater.read_to_end(&mut compressed_data)?; // prepend the length let mut len_prepended_compressed_data = Vec::new(); - (data.len() as u32).var_write_into(&mut len_prepended_compressed_data)?; + (data.len() as u32).azalea_write_var(&mut len_prepended_compressed_data)?; len_prepended_compressed_data.append(&mut compressed_data); Ok(len_prepended_compressed_data) } } -pub async fn write_packet( - packet: &P, - stream: &mut W, - compression_threshold: Option, - cipher: &mut Option, -) -> std::io::Result<()> -where - P: ProtocolPacket + Debug, - W: AsyncWrite + Unpin + Send, -{ - trace!("Sending packet: {packet:?}"); - let raw_packet = serialize_packet(packet).unwrap(); - write_raw_packet(&raw_packet, stream, compression_threshold, cipher).await +/// Prepend the length of the packet to it. +fn frame_prepender(mut data: Vec) -> Result, io::Error> { + let mut buf = Vec::new(); + (data.len() as u32).azalea_write_var(&mut buf)?; + buf.append(&mut data); + Ok(buf) } -pub async fn write_raw_packet( - raw_packet: &[u8], - stream: &mut W, - compression_threshold: Option, - cipher: &mut Option, -) -> std::io::Result<()> -where - W: AsyncWrite + Unpin + Send, -{ - trace!("Writing raw packet: {raw_packet:?}"); - let mut raw_packet = raw_packet.to_vec(); - if let Some(threshold) = compression_threshold { - raw_packet = compression_encoder(&raw_packet, threshold).unwrap(); - } - raw_packet = frame_prepender(raw_packet).unwrap(); - // if we were given a cipher, encrypt the packet - if let Some(cipher) = cipher { - azalea_crypto::encrypt_packet(cipher, &mut raw_packet); - } - stream.write_all(&raw_packet).await +#[derive(Error, Debug)] +pub enum PacketEncodeError { + #[error("{0}")] + Io(#[from] io::Error), + #[error("Packet too big (is {actual} bytes, should be less than {maximum}): {packet_string}")] + TooBig { + actual: usize, + maximum: usize, + packet_string: String, + }, +} + +#[derive(Error, Debug)] +pub enum PacketCompressError { + #[error("{0}")] + Io(#[from] io::Error), } -- cgit v1.2.3