diff options
author | nea <nea@nea.moe> | 2023-02-03 12:56:44 +0100 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-02-03 12:56:44 +0100 |
commit | f9835f4c382a07bab36a4b156e332e1c0c3b371c (patch) | |
tree | 2b15f23b34d069ad3fa4af4769dd1218d4612ba1 | |
parent | 2572b329cc18a0413dea19297bab805be2b9f2ab (diff) | |
download | mcproto-rs-f9835f4c382a07bab36a4b156e332e1c0c3b371c.tar.gz mcproto-rs-f9835f4c382a07bab36a4b156e332e1c0c3b371c.tar.bz2 mcproto-rs-f9835f4c382a07bab36a4b156e332e1c0c3b371c.zip |
wip
-rw-r--r-- | Cargo.toml | 3 | ||||
-rw-r--r-- | src/lib.rs | 3 | ||||
-rw-r--r-- | src/v1_17_0.rs | 1567 | ||||
-rw-r--r-- | src/v1_17_1.rs | 1567 | ||||
-rw-r--r-- | src/v1_19.rs | 1567 | ||||
-rw-r--r-- | src/v1_19_3.rs | 349 |
6 files changed, 354 insertions, 4702 deletions
@@ -24,7 +24,7 @@ default-features = false flate2 = "1.0.17" [features] -default = [ "std", "bench", "v1_15_2", "v1_16_3", "v1_17_0", "v1_17_1", "v1_19" ] +default = [ "std", "bench", "v1_15_2", "v1_16_3", "v1_17_0", "v1_17_1", "v1_19", "v1_19_3" ] std = [ "rand" ] bench = [] @@ -35,3 +35,4 @@ v1_16_3 = [] v1_17_0 = [] v1_17_1 = [] v1_19 = [] +v1_19_3 = [] @@ -1,4 +1,5 @@ // #![cfg_attr(feature = "bench", feature(test))] +#![feature(test)] // #![cfg_attr(feature = "gat", feature(generic_associated_types))] // #![cfg_attr(not(feature = "std"), no_std)] @@ -28,6 +29,8 @@ pub mod v1_17_0; pub mod v1_17_1; #[cfg(feature = "v1_19")] pub mod v1_19; +#[cfg(feature = "v1_19_3")] +pub mod v1_19_3; pub use deserialize::*; pub use serialize::*; diff --git a/src/v1_17_0.rs b/src/v1_17_0.rs index d65ea74..7014b53 100644 --- a/src/v1_17_0.rs +++ b/src/v1_17_0.rs @@ -3459,1570 +3459,3 @@ proto_struct!(DustParticleData { scale: f32 }); -#[cfg(all(test, feature = "std"))] -pub mod tests { - use super::*; - use crate::packet_test_cases; - - packet_test_cases!( - RawPacket755, - Packet755, - Handshake, - HandshakeSpec, - test_handshake, - bench_write_handshake, - bench_read_handshake - ); - - packet_test_cases!( - RawPacket755, - Packet755, - StatusRequest, - StatusRequestSpec, - test_status_request, - bench_write_status_request, - bench_read_status_request - ); - - packet_test_cases!( - RawPacket755, - Packet755, - StatusPing, - StatusPingSpec, - test_status_ping, - bench_write_status_ping, - bench_read_status_ping - ); - - packet_test_cases!( - RawPacket755, - Packet755, - StatusResponse, - StatusResponseSpec, - test_status_response, - bench_write_status_response, - bench_read_status_response - ); - - packet_test_cases!( - RawPacket755, - Packet755, - StatusPong, - StatusPongSpec, - test_status_pong, - bench_write_status_pong, - bench_read_status_pong - ); - - packet_test_cases!( - RawPacket755, - Packet755, - LoginDisconnect, - LoginDisconnectSpec, - test_login_disconnect, - bench_write_login_disconnect, - bench_read_login_disconnect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - LoginEncryptionRequest, - LoginEncryptionRequestSpec, - test_login_encryption_request, - bench_write_login_encryption_request, - bench_read_login_encryption_request - ); - - packet_test_cases!( - RawPacket755, - Packet755, - LoginSuccess, - LoginSuccessSpec, - test_login_success, - bench_write_login_success, - bench_read_login_success - ); - - packet_test_cases!( - RawPacket755, - Packet755, - LoginSetCompression, - LoginSetCompressionSpec, - test_login_set_compression, - bench_write_login_set_compression, - bench_read_login_set_compression - ); - - packet_test_cases!( - RawPacket755, - Packet755, - LoginPluginRequest, - LoginPluginRequestSpec, - test_login_plugin_request, - bench_write_login_plugin_request, - bench_read_login_plugin_request - ); - - packet_test_cases!( - RawPacket755, - Packet755, - LoginStart, - LoginStartSpec, - test_login_start, - bench_write_login_start, - bench_read_login_start - ); - - packet_test_cases!( - RawPacket755, - Packet755, - LoginEncryptionResponse, - LoginEncryptionResponseSpec, - test_login_encryption_response, - bench_write_login_encryption_response, - bench_read_login_encryption_response - ); - - packet_test_cases!( - RawPacket755, - Packet755, - LoginPluginResponse, - LoginPluginResponseSpec, - test_login_plugin_response, - bench_write_login_plugin_response, - bench_read_login_plugin_response - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySpawnEntity, - PlaySpawnEntitySpec, - test_play_spawn_entity, - bench_write_play_spawn_entity, - bench_read_play_spawn_entity - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySpawnExperienceOrb, - PlaySpawnExperienceOrbSpec, - test_play_spawn_experience_orb, - bench_write_play_spawn_experience_orb, - bench_read_play_spawn_experience_orb - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySpawnLivingEntity, - PlaySpawnLivingEntitySpec, - test_play_spawn_living_entity, - bench_write_play_spawn_living_entity, - bench_read_play_spawn_living_entity - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySpawnPainting, - PlaySpawnPaintingSpec, - test_play_spawn_painting, - bench_write_play_spawn_painting, - bench_read_play_spawn_painting - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySpawnPlayer, - PlaySpawnPlayerSpec, - test_play_spawn_player, - bench_write_play_spawn_player, - bench_read_play_spawn_player - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityAnimation, - PlayEntityAnimationSpec, - test_play_entity_animation, - bench_write_play_entity_animation, - bench_read_play_entity_animation - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayStatistics, - PlayStatisticsSpec, - test_play_statistics, - bench_write_play_statistics, - bench_read_play_statistics - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayAcknowledgePlayerDigging, - PlayAcknowledgePlayerDiggingSpec, - test_play_acknowledge_player_digging, - bench_write_play_acknowledge_player_digging, - bench_read_play_acknowledge_player_digging - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayBlockBreakAnimation, - PlayBlockBreakAnimationSpec, - test_play_block_break_animation, - bench_write_play_block_break_animation, - bench_read_play_block_break_animation - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayBlockEntityData, - PlayBlockEntityDataSpec, - test_play_block_entity_data, - bench_write_play_block_entity_data, - bench_read_play_block_entity_data - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayBlockAction, - PlayBlockActionSpec, - test_play_block_action, - bench_write_play_block_action, - bench_read_play_block_action - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayBlockChange, - PlayBlockChangeSpec, - test_play_block_change, - bench_write_play_block_change, - bench_read_play_block_change - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayBossBar, - PlayBossBarSpec, - test_play_boss_bar, - bench_write_play_boss_bar, - bench_read_play_boss_bar - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerDifficulty, - PlayServerDifficultySpec, - test_play_server_difficulty, - bench_write_play_server_difficulty, - bench_read_play_server_difficulty - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerChatMessage, - PlayServerChatMessageSpec, - test_play_server_chat_message, - bench_write_play_server_chat_message, - bench_read_play_server_chat_message - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayTabComplete, - PlayTabCompleteSpec, - test_play_tab_complete, - bench_write_play_tab_complete, - bench_read_play_tab_complete - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayDeclareCommands, - PlayDeclareCommandsSpec, - test_play_declare_commands, - bench_write_play_declare_commands, - bench_read_play_declare_commands - ); - - // packet_test_cases!( - // RawPacket755, - // Packet755, - // PlayServerWindowConfirmation, - // PlayServerWindowConfirmationSpec, - // test_play_server_window_confirmation, - // bench_write_play_server_window_confirmation, - // bench_read_play_server_window_confirmation - // ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerCloseWindow, - PlayServerCloseWindowSpec, - test_play_server_close_window, - bench_write_play_server_close_window, - bench_read_play_server_close_window - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayWindowItems, - PlayWindowItemsSpec, - test_play_window_items, - bench_write_play_window_items, - bench_read_play_window_items - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayWindowProperty, - PlayWindowPropertySpec, - test_play_window_property, - bench_write_play_window_property, - bench_read_play_window_property - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySetSlot, - PlaySetSlotSpec, - test_play_set_slot, - bench_write_play_set_slot, - bench_read_play_set_slot - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySetCooldown, - PlaySetCooldownSpec, - test_play_set_cooldown, - bench_write_play_set_cooldown, - bench_read_play_set_cooldown - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerPluginMessage, - PlayServerPluginMessageSpec, - test_play_server_plugin_message, - bench_write_play_server_plugin_message, - bench_read_play_server_plugin_message - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayNamedSoundEffect, - PlayNamedSoundEffectSpec, - test_play_named_sound_effect, - bench_write_play_named_sound_effect, - bench_read_play_named_sound_effect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayDisconnect, - PlayDisconnectSpec, - test_play_disconnect, - bench_write_play_disconnect, - bench_read_play_disconnect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityStatus, - PlayEntityStatusSpec, - test_play_entity_status, - bench_write_play_entity_status, - bench_read_play_entity_status - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayExplosion, - PlayExplosionSpec, - test_play_explosion, - bench_write_play_explosion, - bench_read_play_explosion - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUnloadChunk, - PlayUnloadChunkSpec, - test_play_unload_chunk, - bench_write_play_unload_chunk, - bench_read_play_unload_chunk - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayChangeGameState, - PlayChangeGameStateSpec, - test_play_change_game_state, - bench_write_play_change_game_state, - bench_read_play_change_game_state - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayOpenHorseWindow, - PlayOpenHorseWindowSpec, - test_play_open_horse_window, - bench_write_play_open_horse_window, - bench_read_play_open_horse_window - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerKeepAlive, - PlayServerKeepAliveSpec, - test_play_server_keep_alive, - bench_write_play_server_keep_alive, - bench_read_play_server_keep_alive - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayChunkData, - PlayChunkDataWrapper, - test_play_chunk_data, - bench_write_play_chunk_data, - bench_read_play_chunk_data - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEffect, - PlayEffectSpec, - test_play_effect, - bench_write_play_effect, - bench_read_play_effect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayParticle, - PlayParticleSpec, - test_play_particle, - bench_write_play_particle, - bench_read_play_particle - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateLight, - PlayUpdateLightSpec, - test_play_update_light, - bench_write_play_update_light, - bench_read_play_update_light - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayJoinGame, - PlayJoinGameSpec, - test_play_join_game, - bench_write_play_join_game, - bench_read_play_join_game - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayMapData, - PlayMapDataSpec, - test_play_map_data, - bench_write_play_map_data, - bench_read_play_map_data - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayTradeList, - PlayTradeListSpec, - test_play_trade_list, - bench_write_play_trade_list, - bench_read_play_trade_list - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityPosition, - PlayEntityPositionSpec, - test_play_entity_position, - bench_write_play_entity_position, - bench_read_play_entity_position - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityPositionAndRotation, - PlayEntityPositionAndRotationSpec, - test_play_entity_position_and_rotation, - bench_write_play_entity_position_and_rotation, - bench_read_play_entity_position_and_rotation - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityRotation, - PlayEntityRotationSpec, - test_play_entity_rotation, - bench_write_play_entity_rotation, - bench_read_play_entity_rotation - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityMovement, - PlayEntityMovementSpec, - test_play_entity_movement, - bench_write_play_entity_movement, - bench_read_play_entity_movement - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerVehicleMove, - PlayEntityVehicleMoveSpec, - test_play_server_vehicle_move, - bench_write_play_server_vehicle_move, - bench_read_play_server_vehicle_move - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayOpenBook, - PlayOpenBookSpec, - test_play_open_book, - bench_write_play_open_book, - bench_read_play_open_book - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayOpenWindow, - PlayOpenWindowSpec, - test_play_open_window, - bench_write_play_open_window, - bench_read_play_open_window - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayOpenSignEditor, - PlayOpenSignEditorSpec, - test_play_open_sign_editor, - bench_write_play_open_sign_editor, - bench_read_play_open_sign_editor - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayCraftRecipeResponse, - PlayCraftRecipeResponseSpec, - test_play_craft_recipe_response, - bench_write_play_craft_recipe_response, - bench_read_play_craft_recipe_response - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerPlayerAbilities, - PlayServerPlayerAbilitiesSpec, - test_play_server_player_abilities, - bench_write_play_server_player_abilities, - bench_read_play_server_player_abilities - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayCombatEvent, - PlayCombatEventSpec, - test_play_combat_event, - bench_write_play_combat_event, - bench_read_play_combat_event - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayPlayerInfo, - PlayPlayerInfoSpec, - test_play_player_info, - bench_write_play_player_info, - bench_read_play_player_info - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayFacePlayer, - PlayFacePlayerSpec, - test_play_face_player, - bench_write_play_face_player, - bench_read_play_face_player - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerPlayerPositionAndLook, - PlayServerPlayerPositionAndLookSpec, - test_play_server_player_position_and_look, - bench_write_play_server_player_position_and_look, - bench_read_play_server_player_position_and_look - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUnlockRecipes, - PlayUnlockRecipesSpec, - test_play_unlock_recipes, - bench_write_play_unlock_recipes, - bench_read_play_unlock_recipes - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayDestroyEntities, - PlayDestroyEntitiesSpec, - test_play_destroy_entities, - bench_write_play_destroy_entities, - bench_read_play_destroy_entities - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayRemoveEntityEffect, - PlayRemoveEntityEffectSpec, - test_play_remove_entity_effect, - bench_write_play_remove_entity_effect, - bench_read_play_remove_entity_effect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayResourcePackSend, - PlayResourcePackSendSpec, - test_play_resource_pack_send, - bench_write_play_resource_pack_send, - bench_read_play_resource_pack_send - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayRespawn, - PlayRespawnSpec, - test_play_respawn, - bench_write_play_respawn, - bench_read_play_respawn - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityHeadLook, - PlayEntityHeadLookSpec, - test_play_entity_head_look, - bench_write_play_entity_head_look, - bench_read_play_entity_head_look - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayMultiBlockChange, - PlayMultiBlockChangeSpec, - test_play_multi_block_change, - bench_write_play_multi_block_change, - bench_read_play_multi_block_change - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySelectAdvancementTab, - PlaySelectAdvancementTabSpec, - test_play_select_advancement_tab, - bench_write_play_select_advancement_tab, - bench_read_play_select_advancement_tab - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayWorldBorder, - PlayWorldBorderSpec, - test_play_world_border, - bench_write_play_world_border, - bench_read_play_world_border - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayCamera, - PlayCameraSpec, - test_play_camera, - bench_write_play_camera, - bench_read_play_camera - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerHeldItemChange, - PlayServerHeldItemChangeSpec, - test_play_server_held_item_change, - bench_write_play_server_held_item_change, - bench_read_play_server_held_item_change - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateViewPosition, - PlayUpdateViewPositionSpec, - test_play_update_view_position, - bench_write_play_update_view_position, - bench_read_play_update_view_position - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateViewDistance, - PlayUpdateViewDistanceSpec, - test_play_update_view_distance, - bench_write_play_update_view_distance, - bench_read_play_update_view_distance - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySpawnPosition, - PlaySpawnPositionSpec, - test_play_spawn_position, - bench_write_play_spawn_position, - bench_read_play_spawn_position - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayDisplayScoreboard, - PlayDisplayScoreboardSpec, - test_play_display_scoreboard, - bench_write_play_display_scoreboard, - bench_read_play_display_scoreboard - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityMetadata, - PlayEntityMetadataSpec, - test_play_entity_metadata, - bench_write_play_entity_metadata, - bench_read_play_entity_metadata - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayAttachEntity, - PlayAttachEntitySpec, - test_play_attach_entity, - bench_write_play_attach_entity, - bench_read_play_attach_entity - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityVelocity, - PlayEntityVelocitySpec, - test_play_entity_velocity, - bench_write_play_entity_velocity, - bench_read_play_entity_velocity - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityEquipment, - PlayEntityEquiptmentSpec, - test_play_entity_equipment, - bench_write_play_entity_equipment, - bench_read_play_entity_equipment - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySetExperience, - PlaySetExperienceSpec, - test_play_set_experience, - bench_write_play_set_experience, - bench_read_play_set_experience - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdatehealth, - PlayUpdateHealthSpec, - test_play_updatehealth, - bench_write_play_updatehealth, - bench_read_play_updatehealth - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayScoreboardObjective, - PlayScoreboardObjectiveSpec, - test_play_scoreboard_objective, - bench_write_play_scoreboard_objective, - bench_read_play_scoreboard_objective - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySetPassengers, - PlaySetPassengersSpec, - test_play_set_passengers, - bench_write_play_set_passengers, - bench_read_play_set_passengers - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayTeams, - PlayTeamsSpec, - test_play_teams, - bench_write_play_teams, - bench_read_play_teams - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateScore, - PlayUpdateScoreSpec, - test_play_update_score, - bench_write_play_update_score, - bench_read_play_update_score - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayTimeUpdate, - PlayTimeUpdateSpec, - test_play_time_update, - bench_write_play_time_update, - bench_read_play_time_update - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayTitle, - PlayTitleSpec, - test_play_title, - bench_write_play_title, - bench_read_play_title - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntitySoundEffect, - PlayEntitySoundEffectSpec, - test_play_entity_sound_effect, - bench_write_play_entity_sound_effect, - bench_read_play_entity_sound_effect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySoundEffect, - PlaySoundEffectSpec, - test_play_sound_effect, - bench_write_play_sound_effect, - bench_read_play_sound_effect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayStopSound, - PlayStopSoundSpec, - test_play_stop_sound, - bench_write_play_stop_sound, - bench_read_play_stop_sound - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayerPlayerListHeaderAndFooter, - PlayPlayerListHeaderAndFooterSpec, - test_player_player_list_header_and_footer, - bench_write_player_player_list_header_and_footer, - bench_read_player_player_list_header_and_footer - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayNbtQueryResponse, - PlayNbtQueryResponseSpec, - test_play_nbt_query_response, - bench_write_play_nbt_query_response, - bench_read_play_nbt_query_response - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayCollectItem, - PlayCollectItemSpec, - test_play_collect_item, - bench_write_play_collect_item, - bench_read_play_collect_item - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityTeleport, - PlayEntityTeleportSpec, - test_play_entity_teleport, - bench_write_play_entity_teleport, - bench_read_play_entity_teleport - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayAdvancements, - PlayAdvancementsSpec, - test_play_advancements, - bench_write_play_advancements, - bench_read_play_advancements - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityProperties, - PlayEntityPropertiesSpec, - test_play_entity_properties, - bench_write_play_entity_properties, - bench_read_play_entity_properties - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityEffect, - PlayEntityEffectSpec, - test_play_entity_effect, - bench_write_play_entity_effect, - bench_read_play_entity_effect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayDeclareRecipes, - PlayDeclareRecipesSpec, - test_play_declare_recipes, - bench_write_play_declare_recipes, - bench_read_play_declare_recipes - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayTags, - PlayTagsSpec, - test_play_tags, - bench_write_play_tags, - bench_read_play_tags - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayTeleportConfirm, - PlayTeleportConfirmSpec, - test_play_teleport_confirm, - bench_write_play_teleport_confirm, - bench_read_play_teleport_confirm - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayQueryBlockNbt, - PlayQueryBlockNbtSpec, - test_play_query_block_nbt, - bench_write_play_query_block_nbt, - bench_read_play_query_block_nbt - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayQueryEntityNbt, - PlayQueryEntityNbtSpec, - test_play_query_entity_nbt, - bench_write_play_query_entity_nbt, - bench_read_play_query_entity_nbt - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySetDifficulty, - PlaySetDifficultySpec, - test_play_set_difficulty, - bench_write_play_set_difficulty, - bench_read_play_set_difficulty - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientChatMessage, - PlayClientChatMessageSpec, - test_play_client_chat_message, - bench_write_play_client_chat_message, - bench_read_play_client_chat_message - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientStatus, - PlayClientStatusSpec, - test_play_client_status, - bench_write_play_client_status, - bench_read_play_client_status - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientSettings, - PlayClientSettingsSpec, - test_play_client_settings, - bench_write_play_client_settings, - bench_read_play_client_settings - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientTabComplete, - PlayClientTabCompleteSpec, - test_play_client_tab_complete, - bench_write_play_client_tab_complete, - bench_read_play_client_tab_complete - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientWindowConfirmation, - PlayClientWindowConfirmationSpec, - test_play_client_window_confirmation, - bench_write_play_client_window_confirmation, - bench_read_play_client_window_confirmation - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClickWindowButton, - PlayClickWindowButtonSpec, - test_play_click_window_button, - bench_write_play_click_window_button, - bench_read_play_click_window_button - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClickWindow, - PlayClickWindowSpec, - test_play_click_window, - bench_write_play_click_window, - bench_read_play_click_window - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientCloseWindow, - PlayClientCloseWindowSpec, - test_play_client_close_window, - bench_write_play_client_close_window, - bench_read_play_client_close_window - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientPluginMessage, - PlayClientPluginMessageSpec, - test_play_client_plugin_message, - bench_write_play_client_plugin_message, - bench_read_play_client_plugin_message - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEditBook, - PlayEditBookSpec, - test_play_edit_book, - bench_write_play_edit_book, - bench_read_play_edit_book - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayInteractEntity, - PlayInteractEntitySpec, - test_play_interact_entity, - bench_write_play_interact_entity, - bench_read_play_interact_entity - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayGenerateStructure, - PlayGenerateStructureSpec, - test_play_generate_structure, - bench_write_play_generate_structure, - bench_read_play_generate_structure - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientKeepAlive, - PlayClientKeepAliveSpec, - test_play_client_keep_alive, - bench_write_play_client_keep_alive, - bench_read_play_client_keep_alive - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayLockDifficulty, - PlayLockDifficultySpec, - test_play_lock_difficulty, - bench_write_play_lock_difficulty, - bench_read_play_lock_difficulty - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayPlayerPosition, - PlayPlayerPositionSpec, - test_play_player_position, - bench_write_play_player_position, - bench_read_play_player_position - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientPlayerPositionAndRotation, - PlayClientPlayerPositionAndRotationSpec, - test_play_client_player_position_and_rotation, - bench_write_play_client_player_position_and_rotation, - bench_read_play_client_player_position_and_rotation - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayPlayerRotation, - PlayPlayerRotationSpec, - test_play_player_rotation, - bench_write_play_player_rotation, - bench_read_play_player_rotation - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayPlayerMovement, - PlayPlayerMovementSpec, - test_play_player_movement, - bench_write_play_player_movement, - bench_read_play_player_movement - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientVehicleMove, - PlayClientVehicleMoveSpec, - test_play_client_vehicle_move, - bench_write_play_client_vehicle_move, - bench_read_play_client_vehicle_move - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySteerBoat, - PlaySteerBoatSpec, - test_play_steer_boat, - bench_write_play_steer_boat, - bench_read_play_steer_boat - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayPickItem, - PlayPickItemSpec, - test_play_pick_item, - bench_write_play_pick_item, - bench_read_play_pick_item - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayCraftRecipeRequest, - PlayCraftRecipeRequestSpec, - test_play_craft_recipe_request, - bench_write_play_craft_recipe_request, - bench_read_play_craft_recipe_request - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientPlayerAbilities, - PlayClientPlayerAbilitiesSpec, - test_play_client_player_abilities, - bench_write_play_client_player_abilities, - bench_read_play_client_player_abilities - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayPlayerDigging, - PlayPlayerDiggingSpec, - test_play_player_digging, - bench_write_play_player_digging, - bench_read_play_player_digging - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityAction, - PlayEntityActionSpec, - test_play_entity_action, - bench_write_play_entity_action, - bench_read_play_entity_action - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySteerVehicle, - PlaySteerVehicleSpec, - test_play_steer_vehicle, - bench_write_play_steer_vehicle, - bench_read_play_steer_vehicle - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySetDisplayedRecipe, - PlaySetDisplayedRecipeSpec, - test_play_set_displayed_recipe, - bench_write_play_set_displayed_recipe, - bench_read_play_set_displayed_recipe - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySetRecipeBookState, - PlaySetRecipeBookStateSpec, - test_play_set_recipe_book_state, - bench_write_play_set_recipe_book_state, - bench_read_play_set_recipe_book_state - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayNameItem, - PlayNameItemSpec, - test_play_name_item, - bench_write_play_name_item, - bench_read_play_name_item - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayResourcePackStatus, - PlayResourcePackStatusSpec, - test_play_resource_pack_status, - bench_write_play_resource_pack_status, - bench_read_play_resource_pack_status - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayAdvancementTab, - PlayAdvancementTabSpec, - test_play_advancement_tab, - bench_write_play_advancement_tab, - bench_read_play_advancement_tab - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySelectTrade, - PlaySelectTradeSpec, - test_play_select_trade, - bench_write_play_select_trade, - bench_read_play_select_trade - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySetBeaconEffect, - PlaySetBeaconEffectSpec, - test_play_set_beacon_effect, - bench_write_play_set_beacon_effect, - bench_read_play_set_beacon_effect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientHeldItemChange, - PlayClientHeldItemChangeSpec, - test_play_client_held_item_change, - bench_write_play_client_held_item_change, - bench_read_play_client_held_item_change - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateCommandBlock, - PlayUpdateCommandBlockSpec, - test_play_update_command_block, - bench_write_play_update_command_block, - bench_read_play_update_command_block - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateCommandBlockMinecart, - PlayUpdateCommandBlockMinecartSpec, - test_play_update_command_block_minecart, - bench_write_play_update_command_block_minecart, - bench_read_play_update_command_block_minecart - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateJigsawBlock, - PlayUpdateJigsawBlockSpec, - test_play_update_jigsaw_block, - bench_write_play_update_jigsaw_block, - bench_read_play_update_jigsaw_block - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayCreativeInventoryAction, - PlayCreativeInventoryActionSpec, - test_play_creative_inventory_action, - bench_write_play_creative_inventory_action, - bench_read_play_creative_inventory_action - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateStructureBlock, - PlayUpdateStructureBlockSpec, - test_play_update_structure_block, - bench_write_play_update_structure_block, - bench_read_play_update_structure_block - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateSign, - PlayUpdateSignSpec, - test_play_update_sign, - bench_write_play_update_sign, - bench_read_play_update_sign - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientAnimation, - PlayClientAnimationSpec, - test_play_client_animation, - bench_write_play_client_animation, - bench_read_play_client_animation - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySpectate, - PlaySpectateSpec, - test_play_spectate, - bench_write_play_spectate, - bench_read_play_spectate - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayBlockPlacement, - PlayBlockPlacementSpec, - test_play_block_placement, - bench_write_play_block_placement, - bench_read_play_block_placement - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUseItem, - PlayUseItemSpec, - test_play_use_item, - bench_write_play_use_item, - bench_read_play_use_item - ); - - // trust me, this is some cutting edge shit - // I'm definitely not generating code using a unit test - #[test] - fn test_generate_test_cases() { - Packet755::describe().packets.iter().map(move |packet| { - let snake_case = to_snake_case(packet.name.clone()); - alloc::format!("packet_test_cases!(RawPacket755, Packet755, {}, {},\n test_{}, bench_write_{}, bench_read_{});\n", - packet.name, packet.body_struct, snake_case, snake_case, snake_case).to_owned() - }).for_each(move |line| { - println!("{}", line) - }) - } - - fn to_snake_case(camel: String) -> String { - let mut parts = Vec::new(); - let mut buf = String::new(); - for c in camel.chars() { - if !buf.is_empty() && char::is_uppercase(c) { - parts.push(buf); - buf = String::new(); - } - - buf.push(c.to_ascii_lowercase()); - } - - if !buf.is_empty() { - parts.push(buf); - } - - parts.join("_") - } -} diff --git a/src/v1_17_1.rs b/src/v1_17_1.rs index c043816..75303fc 100644 --- a/src/v1_17_1.rs +++ b/src/v1_17_1.rs @@ -3509,1570 +3509,3 @@ proto_struct!(VibrationData { dest_z: f64 }); -#[cfg(all(test, feature = "std"))] -pub mod tests { - use super::*; - use crate::packet_test_cases; - - packet_test_cases!( - RawPacket755, - Packet755, - Handshake, - HandshakeSpec, - test_handshake, - bench_write_handshake, - bench_read_handshake - ); - - packet_test_cases!( - RawPacket755, - Packet755, - StatusRequest, - StatusRequestSpec, - test_status_request, - bench_write_status_request, - bench_read_status_request - ); - - packet_test_cases!( - RawPacket755, - Packet755, - StatusPing, - StatusPingSpec, - test_status_ping, - bench_write_status_ping, - bench_read_status_ping - ); - - packet_test_cases!( - RawPacket755, - Packet755, - StatusResponse, - StatusResponseSpec, - test_status_response, - bench_write_status_response, - bench_read_status_response - ); - - packet_test_cases!( - RawPacket755, - Packet755, - StatusPong, - StatusPongSpec, - test_status_pong, - bench_write_status_pong, - bench_read_status_pong - ); - - packet_test_cases!( - RawPacket755, - Packet755, - LoginDisconnect, - LoginDisconnectSpec, - test_login_disconnect, - bench_write_login_disconnect, - bench_read_login_disconnect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - LoginEncryptionRequest, - LoginEncryptionRequestSpec, - test_login_encryption_request, - bench_write_login_encryption_request, - bench_read_login_encryption_request - ); - - packet_test_cases!( - RawPacket755, - Packet755, - LoginSuccess, - LoginSuccessSpec, - test_login_success, - bench_write_login_success, - bench_read_login_success - ); - - packet_test_cases!( - RawPacket755, - Packet755, - LoginSetCompression, - LoginSetCompressionSpec, - test_login_set_compression, - bench_write_login_set_compression, - bench_read_login_set_compression - ); - - packet_test_cases!( - RawPacket755, - Packet755, - LoginPluginRequest, - LoginPluginRequestSpec, - test_login_plugin_request, - bench_write_login_plugin_request, - bench_read_login_plugin_request - ); - - packet_test_cases!( - RawPacket755, - Packet755, - LoginStart, - LoginStartSpec, - test_login_start, - bench_write_login_start, - bench_read_login_start - ); - - packet_test_cases!( - RawPacket755, - Packet755, - LoginEncryptionResponse, - LoginEncryptionResponseSpec, - test_login_encryption_response, - bench_write_login_encryption_response, - bench_read_login_encryption_response - ); - - packet_test_cases!( - RawPacket755, - Packet755, - LoginPluginResponse, - LoginPluginResponseSpec, - test_login_plugin_response, - bench_write_login_plugin_response, - bench_read_login_plugin_response - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySpawnEntity, - PlaySpawnEntitySpec, - test_play_spawn_entity, - bench_write_play_spawn_entity, - bench_read_play_spawn_entity - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySpawnExperienceOrb, - PlaySpawnExperienceOrbSpec, - test_play_spawn_experience_orb, - bench_write_play_spawn_experience_orb, - bench_read_play_spawn_experience_orb - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySpawnLivingEntity, - PlaySpawnLivingEntitySpec, - test_play_spawn_living_entity, - bench_write_play_spawn_living_entity, - bench_read_play_spawn_living_entity - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySpawnPainting, - PlaySpawnPaintingSpec, - test_play_spawn_painting, - bench_write_play_spawn_painting, - bench_read_play_spawn_painting - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySpawnPlayer, - PlaySpawnPlayerSpec, - test_play_spawn_player, - bench_write_play_spawn_player, - bench_read_play_spawn_player - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityAnimation, - PlayEntityAnimationSpec, - test_play_entity_animation, - bench_write_play_entity_animation, - bench_read_play_entity_animation - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayStatistics, - PlayStatisticsSpec, - test_play_statistics, - bench_write_play_statistics, - bench_read_play_statistics - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayAcknowledgePlayerDigging, - PlayAcknowledgePlayerDiggingSpec, - test_play_acknowledge_player_digging, - bench_write_play_acknowledge_player_digging, - bench_read_play_acknowledge_player_digging - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayBlockBreakAnimation, - PlayBlockBreakAnimationSpec, - test_play_block_break_animation, - bench_write_play_block_break_animation, - bench_read_play_block_break_animation - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayBlockEntityData, - PlayBlockEntityDataSpec, - test_play_block_entity_data, - bench_write_play_block_entity_data, - bench_read_play_block_entity_data - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayBlockAction, - PlayBlockActionSpec, - test_play_block_action, - bench_write_play_block_action, - bench_read_play_block_action - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayBlockChange, - PlayBlockChangeSpec, - test_play_block_change, - bench_write_play_block_change, - bench_read_play_block_change - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayBossBar, - PlayBossBarSpec, - test_play_boss_bar, - bench_write_play_boss_bar, - bench_read_play_boss_bar - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerDifficulty, - PlayServerDifficultySpec, - test_play_server_difficulty, - bench_write_play_server_difficulty, - bench_read_play_server_difficulty - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerChatMessage, - PlayServerChatMessageSpec, - test_play_server_chat_message, - bench_write_play_server_chat_message, - bench_read_play_server_chat_message - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayTabComplete, - PlayTabCompleteSpec, - test_play_tab_complete, - bench_write_play_tab_complete, - bench_read_play_tab_complete - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayDeclareCommands, - PlayDeclareCommandsSpec, - test_play_declare_commands, - bench_write_play_declare_commands, - bench_read_play_declare_commands - ); - - // packet_test_cases!( - // RawPacket755, - // Packet755, - // PlayServerWindowConfirmation, - // PlayServerWindowConfirmationSpec, - // test_play_server_window_confirmation, - // bench_write_play_server_window_confirmation, - // bench_read_play_server_window_confirmation - // ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerCloseWindow, - PlayServerCloseWindowSpec, - test_play_server_close_window, - bench_write_play_server_close_window, - bench_read_play_server_close_window - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayWindowItems, - PlayWindowItemsSpec, - test_play_window_items, - bench_write_play_window_items, - bench_read_play_window_items - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayWindowProperty, - PlayWindowPropertySpec, - test_play_window_property, - bench_write_play_window_property, - bench_read_play_window_property - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySetSlot, - PlaySetSlotSpec, - test_play_set_slot, - bench_write_play_set_slot, - bench_read_play_set_slot - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySetCooldown, - PlaySetCooldownSpec, - test_play_set_cooldown, - bench_write_play_set_cooldown, - bench_read_play_set_cooldown - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerPluginMessage, - PlayServerPluginMessageSpec, - test_play_server_plugin_message, - bench_write_play_server_plugin_message, - bench_read_play_server_plugin_message - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayNamedSoundEffect, - PlayNamedSoundEffectSpec, - test_play_named_sound_effect, - bench_write_play_named_sound_effect, - bench_read_play_named_sound_effect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayDisconnect, - PlayDisconnectSpec, - test_play_disconnect, - bench_write_play_disconnect, - bench_read_play_disconnect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityStatus, - PlayEntityStatusSpec, - test_play_entity_status, - bench_write_play_entity_status, - bench_read_play_entity_status - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayExplosion, - PlayExplosionSpec, - test_play_explosion, - bench_write_play_explosion, - bench_read_play_explosion - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUnloadChunk, - PlayUnloadChunkSpec, - test_play_unload_chunk, - bench_write_play_unload_chunk, - bench_read_play_unload_chunk - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayChangeGameState, - PlayChangeGameStateSpec, - test_play_change_game_state, - bench_write_play_change_game_state, - bench_read_play_change_game_state - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayOpenHorseWindow, - PlayOpenHorseWindowSpec, - test_play_open_horse_window, - bench_write_play_open_horse_window, - bench_read_play_open_horse_window - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerKeepAlive, - PlayServerKeepAliveSpec, - test_play_server_keep_alive, - bench_write_play_server_keep_alive, - bench_read_play_server_keep_alive - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayChunkData, - PlayChunkDataWrapper, - test_play_chunk_data, - bench_write_play_chunk_data, - bench_read_play_chunk_data - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEffect, - PlayEffectSpec, - test_play_effect, - bench_write_play_effect, - bench_read_play_effect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayParticle, - PlayParticleSpec, - test_play_particle, - bench_write_play_particle, - bench_read_play_particle - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateLight, - PlayUpdateLightSpec, - test_play_update_light, - bench_write_play_update_light, - bench_read_play_update_light - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayJoinGame, - PlayJoinGameSpec, - test_play_join_game, - bench_write_play_join_game, - bench_read_play_join_game - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayMapData, - PlayMapDataSpec, - test_play_map_data, - bench_write_play_map_data, - bench_read_play_map_data - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayTradeList, - PlayTradeListSpec, - test_play_trade_list, - bench_write_play_trade_list, - bench_read_play_trade_list - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityPosition, - PlayEntityPositionSpec, - test_play_entity_position, - bench_write_play_entity_position, - bench_read_play_entity_position - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityPositionAndRotation, - PlayEntityPositionAndRotationSpec, - test_play_entity_position_and_rotation, - bench_write_play_entity_position_and_rotation, - bench_read_play_entity_position_and_rotation - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityRotation, - PlayEntityRotationSpec, - test_play_entity_rotation, - bench_write_play_entity_rotation, - bench_read_play_entity_rotation - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityMovement, - PlayEntityMovementSpec, - test_play_entity_movement, - bench_write_play_entity_movement, - bench_read_play_entity_movement - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerVehicleMove, - PlayEntityVehicleMoveSpec, - test_play_server_vehicle_move, - bench_write_play_server_vehicle_move, - bench_read_play_server_vehicle_move - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayOpenBook, - PlayOpenBookSpec, - test_play_open_book, - bench_write_play_open_book, - bench_read_play_open_book - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayOpenWindow, - PlayOpenWindowSpec, - test_play_open_window, - bench_write_play_open_window, - bench_read_play_open_window - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayOpenSignEditor, - PlayOpenSignEditorSpec, - test_play_open_sign_editor, - bench_write_play_open_sign_editor, - bench_read_play_open_sign_editor - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayCraftRecipeResponse, - PlayCraftRecipeResponseSpec, - test_play_craft_recipe_response, - bench_write_play_craft_recipe_response, - bench_read_play_craft_recipe_response - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerPlayerAbilities, - PlayServerPlayerAbilitiesSpec, - test_play_server_player_abilities, - bench_write_play_server_player_abilities, - bench_read_play_server_player_abilities - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayCombatEvent, - PlayCombatEventSpec, - test_play_combat_event, - bench_write_play_combat_event, - bench_read_play_combat_event - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayPlayerInfo, - PlayPlayerInfoSpec, - test_play_player_info, - bench_write_play_player_info, - bench_read_play_player_info - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayFacePlayer, - PlayFacePlayerSpec, - test_play_face_player, - bench_write_play_face_player, - bench_read_play_face_player - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerPlayerPositionAndLook, - PlayServerPlayerPositionAndLookSpec, - test_play_server_player_position_and_look, - bench_write_play_server_player_position_and_look, - bench_read_play_server_player_position_and_look - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUnlockRecipes, - PlayUnlockRecipesSpec, - test_play_unlock_recipes, - bench_write_play_unlock_recipes, - bench_read_play_unlock_recipes - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayDestroyEntities, - PlayDestroyEntitiesSpec, - test_play_destroy_entities, - bench_write_play_destroy_entities, - bench_read_play_destroy_entities - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayRemoveEntityEffect, - PlayRemoveEntityEffectSpec, - test_play_remove_entity_effect, - bench_write_play_remove_entity_effect, - bench_read_play_remove_entity_effect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayResourcePackSend, - PlayResourcePackSendSpec, - test_play_resource_pack_send, - bench_write_play_resource_pack_send, - bench_read_play_resource_pack_send - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayRespawn, - PlayRespawnSpec, - test_play_respawn, - bench_write_play_respawn, - bench_read_play_respawn - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityHeadLook, - PlayEntityHeadLookSpec, - test_play_entity_head_look, - bench_write_play_entity_head_look, - bench_read_play_entity_head_look - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayMultiBlockChange, - PlayMultiBlockChangeSpec, - test_play_multi_block_change, - bench_write_play_multi_block_change, - bench_read_play_multi_block_change - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySelectAdvancementTab, - PlaySelectAdvancementTabSpec, - test_play_select_advancement_tab, - bench_write_play_select_advancement_tab, - bench_read_play_select_advancement_tab - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayWorldBorder, - PlayWorldBorderSpec, - test_play_world_border, - bench_write_play_world_border, - bench_read_play_world_border - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayCamera, - PlayCameraSpec, - test_play_camera, - bench_write_play_camera, - bench_read_play_camera - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayServerHeldItemChange, - PlayServerHeldItemChangeSpec, - test_play_server_held_item_change, - bench_write_play_server_held_item_change, - bench_read_play_server_held_item_change - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateViewPosition, - PlayUpdateViewPositionSpec, - test_play_update_view_position, - bench_write_play_update_view_position, - bench_read_play_update_view_position - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateViewDistance, - PlayUpdateViewDistanceSpec, - test_play_update_view_distance, - bench_write_play_update_view_distance, - bench_read_play_update_view_distance - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySpawnPosition, - PlaySpawnPositionSpec, - test_play_spawn_position, - bench_write_play_spawn_position, - bench_read_play_spawn_position - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayDisplayScoreboard, - PlayDisplayScoreboardSpec, - test_play_display_scoreboard, - bench_write_play_display_scoreboard, - bench_read_play_display_scoreboard - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityMetadata, - PlayEntityMetadataSpec, - test_play_entity_metadata, - bench_write_play_entity_metadata, - bench_read_play_entity_metadata - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayAttachEntity, - PlayAttachEntitySpec, - test_play_attach_entity, - bench_write_play_attach_entity, - bench_read_play_attach_entity - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityVelocity, - PlayEntityVelocitySpec, - test_play_entity_velocity, - bench_write_play_entity_velocity, - bench_read_play_entity_velocity - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityEquipment, - PlayEntityEquiptmentSpec, - test_play_entity_equipment, - bench_write_play_entity_equipment, - bench_read_play_entity_equipment - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySetExperience, - PlaySetExperienceSpec, - test_play_set_experience, - bench_write_play_set_experience, - bench_read_play_set_experience - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdatehealth, - PlayUpdateHealthSpec, - test_play_updatehealth, - bench_write_play_updatehealth, - bench_read_play_updatehealth - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayScoreboardObjective, - PlayScoreboardObjectiveSpec, - test_play_scoreboard_objective, - bench_write_play_scoreboard_objective, - bench_read_play_scoreboard_objective - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySetPassengers, - PlaySetPassengersSpec, - test_play_set_passengers, - bench_write_play_set_passengers, - bench_read_play_set_passengers - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayTeams, - PlayTeamsSpec, - test_play_teams, - bench_write_play_teams, - bench_read_play_teams - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateScore, - PlayUpdateScoreSpec, - test_play_update_score, - bench_write_play_update_score, - bench_read_play_update_score - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayTimeUpdate, - PlayTimeUpdateSpec, - test_play_time_update, - bench_write_play_time_update, - bench_read_play_time_update - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayTitle, - PlayTitleSpec, - test_play_title, - bench_write_play_title, - bench_read_play_title - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntitySoundEffect, - PlayEntitySoundEffectSpec, - test_play_entity_sound_effect, - bench_write_play_entity_sound_effect, - bench_read_play_entity_sound_effect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySoundEffect, - PlaySoundEffectSpec, - test_play_sound_effect, - bench_write_play_sound_effect, - bench_read_play_sound_effect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayStopSound, - PlayStopSoundSpec, - test_play_stop_sound, - bench_write_play_stop_sound, - bench_read_play_stop_sound - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayerPlayerListHeaderAndFooter, - PlayPlayerListHeaderAndFooterSpec, - test_player_player_list_header_and_footer, - bench_write_player_player_list_header_and_footer, - bench_read_player_player_list_header_and_footer - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayNbtQueryResponse, - PlayNbtQueryResponseSpec, - test_play_nbt_query_response, - bench_write_play_nbt_query_response, - bench_read_play_nbt_query_response - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayCollectItem, - PlayCollectItemSpec, - test_play_collect_item, - bench_write_play_collect_item, - bench_read_play_collect_item - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityTeleport, - PlayEntityTeleportSpec, - test_play_entity_teleport, - bench_write_play_entity_teleport, - bench_read_play_entity_teleport - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayAdvancements, - PlayAdvancementsSpec, - test_play_advancements, - bench_write_play_advancements, - bench_read_play_advancements - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityProperties, - PlayEntityPropertiesSpec, - test_play_entity_properties, - bench_write_play_entity_properties, - bench_read_play_entity_properties - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityEffect, - PlayEntityEffectSpec, - test_play_entity_effect, - bench_write_play_entity_effect, - bench_read_play_entity_effect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayDeclareRecipes, - PlayDeclareRecipesSpec, - test_play_declare_recipes, - bench_write_play_declare_recipes, - bench_read_play_declare_recipes - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayTags, - PlayTagsSpec, - test_play_tags, - bench_write_play_tags, - bench_read_play_tags - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayTeleportConfirm, - PlayTeleportConfirmSpec, - test_play_teleport_confirm, - bench_write_play_teleport_confirm, - bench_read_play_teleport_confirm - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayQueryBlockNbt, - PlayQueryBlockNbtSpec, - test_play_query_block_nbt, - bench_write_play_query_block_nbt, - bench_read_play_query_block_nbt - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayQueryEntityNbt, - PlayQueryEntityNbtSpec, - test_play_query_entity_nbt, - bench_write_play_query_entity_nbt, - bench_read_play_query_entity_nbt - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySetDifficulty, - PlaySetDifficultySpec, - test_play_set_difficulty, - bench_write_play_set_difficulty, - bench_read_play_set_difficulty - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientChatMessage, - PlayClientChatMessageSpec, - test_play_client_chat_message, - bench_write_play_client_chat_message, - bench_read_play_client_chat_message - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientStatus, - PlayClientStatusSpec, - test_play_client_status, - bench_write_play_client_status, - bench_read_play_client_status - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientSettings, - PlayClientSettingsSpec, - test_play_client_settings, - bench_write_play_client_settings, - bench_read_play_client_settings - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientTabComplete, - PlayClientTabCompleteSpec, - test_play_client_tab_complete, - bench_write_play_client_tab_complete, - bench_read_play_client_tab_complete - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientWindowConfirmation, - PlayClientWindowConfirmationSpec, - test_play_client_window_confirmation, - bench_write_play_client_window_confirmation, - bench_read_play_client_window_confirmation - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClickWindowButton, - PlayClickWindowButtonSpec, - test_play_click_window_button, - bench_write_play_click_window_button, - bench_read_play_click_window_button - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClickWindow, - PlayClickWindowSpec, - test_play_click_window, - bench_write_play_click_window, - bench_read_play_click_window - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientCloseWindow, - PlayClientCloseWindowSpec, - test_play_client_close_window, - bench_write_play_client_close_window, - bench_read_play_client_close_window - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientPluginMessage, - PlayClientPluginMessageSpec, - test_play_client_plugin_message, - bench_write_play_client_plugin_message, - bench_read_play_client_plugin_message - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEditBook, - PlayEditBookSpec, - test_play_edit_book, - bench_write_play_edit_book, - bench_read_play_edit_book - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayInteractEntity, - PlayInteractEntitySpec, - test_play_interact_entity, - bench_write_play_interact_entity, - bench_read_play_interact_entity - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayGenerateStructure, - PlayGenerateStructureSpec, - test_play_generate_structure, - bench_write_play_generate_structure, - bench_read_play_generate_structure - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientKeepAlive, - PlayClientKeepAliveSpec, - test_play_client_keep_alive, - bench_write_play_client_keep_alive, - bench_read_play_client_keep_alive - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayLockDifficulty, - PlayLockDifficultySpec, - test_play_lock_difficulty, - bench_write_play_lock_difficulty, - bench_read_play_lock_difficulty - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayPlayerPosition, - PlayPlayerPositionSpec, - test_play_player_position, - bench_write_play_player_position, - bench_read_play_player_position - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientPlayerPositionAndRotation, - PlayClientPlayerPositionAndRotationSpec, - test_play_client_player_position_and_rotation, - bench_write_play_client_player_position_and_rotation, - bench_read_play_client_player_position_and_rotation - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayPlayerRotation, - PlayPlayerRotationSpec, - test_play_player_rotation, - bench_write_play_player_rotation, - bench_read_play_player_rotation - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayPlayerMovement, - PlayPlayerMovementSpec, - test_play_player_movement, - bench_write_play_player_movement, - bench_read_play_player_movement - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientVehicleMove, - PlayClientVehicleMoveSpec, - test_play_client_vehicle_move, - bench_write_play_client_vehicle_move, - bench_read_play_client_vehicle_move - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySteerBoat, - PlaySteerBoatSpec, - test_play_steer_boat, - bench_write_play_steer_boat, - bench_read_play_steer_boat - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayPickItem, - PlayPickItemSpec, - test_play_pick_item, - bench_write_play_pick_item, - bench_read_play_pick_item - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayCraftRecipeRequest, - PlayCraftRecipeRequestSpec, - test_play_craft_recipe_request, - bench_write_play_craft_recipe_request, - bench_read_play_craft_recipe_request - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientPlayerAbilities, - PlayClientPlayerAbilitiesSpec, - test_play_client_player_abilities, - bench_write_play_client_player_abilities, - bench_read_play_client_player_abilities - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayPlayerDigging, - PlayPlayerDiggingSpec, - test_play_player_digging, - bench_write_play_player_digging, - bench_read_play_player_digging - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayEntityAction, - PlayEntityActionSpec, - test_play_entity_action, - bench_write_play_entity_action, - bench_read_play_entity_action - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySteerVehicle, - PlaySteerVehicleSpec, - test_play_steer_vehicle, - bench_write_play_steer_vehicle, - bench_read_play_steer_vehicle - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySetDisplayedRecipe, - PlaySetDisplayedRecipeSpec, - test_play_set_displayed_recipe, - bench_write_play_set_displayed_recipe, - bench_read_play_set_displayed_recipe - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySetRecipeBookState, - PlaySetRecipeBookStateSpec, - test_play_set_recipe_book_state, - bench_write_play_set_recipe_book_state, - bench_read_play_set_recipe_book_state - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayNameItem, - PlayNameItemSpec, - test_play_name_item, - bench_write_play_name_item, - bench_read_play_name_item - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayResourcePackStatus, - PlayResourcePackStatusSpec, - test_play_resource_pack_status, - bench_write_play_resource_pack_status, - bench_read_play_resource_pack_status - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayAdvancementTab, - PlayAdvancementTabSpec, - test_play_advancement_tab, - bench_write_play_advancement_tab, - bench_read_play_advancement_tab - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySelectTrade, - PlaySelectTradeSpec, - test_play_select_trade, - bench_write_play_select_trade, - bench_read_play_select_trade - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySetBeaconEffect, - PlaySetBeaconEffectSpec, - test_play_set_beacon_effect, - bench_write_play_set_beacon_effect, - bench_read_play_set_beacon_effect - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientHeldItemChange, - PlayClientHeldItemChangeSpec, - test_play_client_held_item_change, - bench_write_play_client_held_item_change, - bench_read_play_client_held_item_change - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateCommandBlock, - PlayUpdateCommandBlockSpec, - test_play_update_command_block, - bench_write_play_update_command_block, - bench_read_play_update_command_block - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateCommandBlockMinecart, - PlayUpdateCommandBlockMinecartSpec, - test_play_update_command_block_minecart, - bench_write_play_update_command_block_minecart, - bench_read_play_update_command_block_minecart - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateJigsawBlock, - PlayUpdateJigsawBlockSpec, - test_play_update_jigsaw_block, - bench_write_play_update_jigsaw_block, - bench_read_play_update_jigsaw_block - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayCreativeInventoryAction, - PlayCreativeInventoryActionSpec, - test_play_creative_inventory_action, - bench_write_play_creative_inventory_action, - bench_read_play_creative_inventory_action - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateStructureBlock, - PlayUpdateStructureBlockSpec, - test_play_update_structure_block, - bench_write_play_update_structure_block, - bench_read_play_update_structure_block - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUpdateSign, - PlayUpdateSignSpec, - test_play_update_sign, - bench_write_play_update_sign, - bench_read_play_update_sign - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayClientAnimation, - PlayClientAnimationSpec, - test_play_client_animation, - bench_write_play_client_animation, - bench_read_play_client_animation - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlaySpectate, - PlaySpectateSpec, - test_play_spectate, - bench_write_play_spectate, - bench_read_play_spectate - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayBlockPlacement, - PlayBlockPlacementSpec, - test_play_block_placement, - bench_write_play_block_placement, - bench_read_play_block_placement - ); - - packet_test_cases!( - RawPacket755, - Packet755, - PlayUseItem, - PlayUseItemSpec, - test_play_use_item, - bench_write_play_use_item, - bench_read_play_use_item - ); - - // trust me, this is some cutting edge shit - // I'm definitely not generating code using a unit test - #[test] - fn test_generate_test_cases() { - Packet755::describe().packets.iter().map(move |packet| { - let snake_case = to_snake_case(packet.name.clone()); - alloc::format!("packet_test_cases!(RawPacket755, Packet755, {}, {},\n test_{}, bench_write_{}, bench_read_{});\n", - packet.name, packet.body_struct, snake_case, snake_case, snake_case).to_owned() - }).for_each(move |line| { - println!("{}", line) - }) - } - - fn to_snake_case(camel: String) -> String { - let mut parts = Vec::new(); - let mut buf = String::new(); - for c in camel.chars() { - if !buf.is_empty() && char::is_uppercase(c) { - parts.push(buf); - buf = String::new(); - } - - buf.push(c.to_ascii_lowercase()); - } - - if !buf.is_empty() { - parts.push(buf); - } - - parts.join("_") - } -} diff --git a/src/v1_19.rs b/src/v1_19.rs index d07238e..9613f06 100644 --- a/src/v1_19.rs +++ b/src/v1_19.rs @@ -3526,1570 +3526,3 @@ proto_struct!(VibrationData { dest_z: f64 }); -#[cfg(all(test, feature = "std"))] -pub mod tests { - use super::*; - use crate::packet_test_cases; - - packet_test_cases!( - RawPacket759, - Packet759, - Handshake, - HandshakeSpec, - test_handshake, - bench_write_handshake, - bench_read_handshake - ); - - packet_test_cases!( - RawPacket759, - Packet759, - StatusRequest, - StatusRequestSpec, - test_status_request, - bench_write_status_request, - bench_read_status_request - ); - - packet_test_cases!( - RawPacket759, - Packet759, - StatusPing, - StatusPingSpec, - test_status_ping, - bench_write_status_ping, - bench_read_status_ping - ); - - packet_test_cases!( - RawPacket759, - Packet759, - StatusResponse, - StatusResponseSpec, - test_status_response, - bench_write_status_response, - bench_read_status_response - ); - - packet_test_cases!( - RawPacket759, - Packet759, - StatusPong, - StatusPongSpec, - test_status_pong, - bench_write_status_pong, - bench_read_status_pong - ); - - packet_test_cases!( - RawPacket759, - Packet759, - LoginDisconnect, - LoginDisconnectSpec, - test_login_disconnect, - bench_write_login_disconnect, - bench_read_login_disconnect - ); - - packet_test_cases!( - RawPacket759, - Packet759, - LoginEncryptionRequest, - LoginEncryptionRequestSpec, - test_login_encryption_request, - bench_write_login_encryption_request, - bench_read_login_encryption_request - ); - - packet_test_cases!( - RawPacket759, - Packet759, - LoginSuccess, - LoginSuccessSpec, - test_login_success, - bench_write_login_success, - bench_read_login_success - ); - - packet_test_cases!( - RawPacket759, - Packet759, - LoginSetCompression, - LoginSetCompressionSpec, - test_login_set_compression, - bench_write_login_set_compression, - bench_read_login_set_compression - ); - - packet_test_cases!( - RawPacket759, - Packet759, - LoginPluginRequest, - LoginPluginRequestSpec, - test_login_plugin_request, - bench_write_login_plugin_request, - bench_read_login_plugin_request - ); - - packet_test_cases!( - RawPacket759, - Packet759, - LoginStart, - LoginStartSpec, - test_login_start, - bench_write_login_start, - bench_read_login_start - ); - - packet_test_cases!( - RawPacket759, - Packet759, - LoginEncryptionResponse, - LoginEncryptionResponseSpec, - test_login_encryption_response, - bench_write_login_encryption_response, - bench_read_login_encryption_response - ); - - packet_test_cases!( - RawPacket759, - Packet759, - LoginPluginResponse, - LoginPluginResponseSpec, - test_login_plugin_response, - bench_write_login_plugin_response, - bench_read_login_plugin_response - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySpawnEntity, - PlaySpawnEntitySpec, - test_play_spawn_entity, - bench_write_play_spawn_entity, - bench_read_play_spawn_entity - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySpawnExperienceOrb, - PlaySpawnExperienceOrbSpec, - test_play_spawn_experience_orb, - bench_write_play_spawn_experience_orb, - bench_read_play_spawn_experience_orb - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySpawnLivingEntity, - PlaySpawnLivingEntitySpec, - test_play_spawn_living_entity, - bench_write_play_spawn_living_entity, - bench_read_play_spawn_living_entity - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySpawnPainting, - PlaySpawnPaintingSpec, - test_play_spawn_painting, - bench_write_play_spawn_painting, - bench_read_play_spawn_painting - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySpawnPlayer, - PlaySpawnPlayerSpec, - test_play_spawn_player, - bench_write_play_spawn_player, - bench_read_play_spawn_player - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEntityAnimation, - PlayEntityAnimationSpec, - test_play_entity_animation, - bench_write_play_entity_animation, - bench_read_play_entity_animation - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayStatistics, - PlayStatisticsSpec, - test_play_statistics, - bench_write_play_statistics, - bench_read_play_statistics - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayAcknowledgePlayerDigging, - PlayAcknowledgePlayerDiggingSpec, - test_play_acknowledge_player_digging, - bench_write_play_acknowledge_player_digging, - bench_read_play_acknowledge_player_digging - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayBlockBreakAnimation, - PlayBlockBreakAnimationSpec, - test_play_block_break_animation, - bench_write_play_block_break_animation, - bench_read_play_block_break_animation - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayBlockEntityData, - PlayBlockEntityDataSpec, - test_play_block_entity_data, - bench_write_play_block_entity_data, - bench_read_play_block_entity_data - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayBlockAction, - PlayBlockActionSpec, - test_play_block_action, - bench_write_play_block_action, - bench_read_play_block_action - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayBlockChange, - PlayBlockChangeSpec, - test_play_block_change, - bench_write_play_block_change, - bench_read_play_block_change - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayBossBar, - PlayBossBarSpec, - test_play_boss_bar, - bench_write_play_boss_bar, - bench_read_play_boss_bar - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayServerDifficulty, - PlayServerDifficultySpec, - test_play_server_difficulty, - bench_write_play_server_difficulty, - bench_read_play_server_difficulty - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayServerChatMessage, - PlayServerChatMessageSpec, - test_play_server_chat_message, - bench_write_play_server_chat_message, - bench_read_play_server_chat_message - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayTabComplete, - PlayTabCompleteSpec, - test_play_tab_complete, - bench_write_play_tab_complete, - bench_read_play_tab_complete - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayDeclareCommands, - PlayDeclareCommandsSpec, - test_play_declare_commands, - bench_write_play_declare_commands, - bench_read_play_declare_commands - ); - - // packet_test_cases!( - // RawPacket759, - // Packet759, - // PlayServerWindowConfirmation, - // PlayServerWindowConfirmationSpec, - // test_play_server_window_confirmation, - // bench_write_play_server_window_confirmation, - // bench_read_play_server_window_confirmation - // ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayServerCloseWindow, - PlayServerCloseWindowSpec, - test_play_server_close_window, - bench_write_play_server_close_window, - bench_read_play_server_close_window - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayWindowItems, - PlayWindowItemsSpec, - test_play_window_items, - bench_write_play_window_items, - bench_read_play_window_items - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayWindowProperty, - PlayWindowPropertySpec, - test_play_window_property, - bench_write_play_window_property, - bench_read_play_window_property - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySetSlot, - PlaySetSlotSpec, - test_play_set_slot, - bench_write_play_set_slot, - bench_read_play_set_slot - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySetCooldown, - PlaySetCooldownSpec, - test_play_set_cooldown, - bench_write_play_set_cooldown, - bench_read_play_set_cooldown - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayServerPluginMessage, - PlayServerPluginMessageSpec, - test_play_server_plugin_message, - bench_write_play_server_plugin_message, - bench_read_play_server_plugin_message - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayNamedSoundEffect, - PlayNamedSoundEffectSpec, - test_play_named_sound_effect, - bench_write_play_named_sound_effect, - bench_read_play_named_sound_effect - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayDisconnect, - PlayDisconnectSpec, - test_play_disconnect, - bench_write_play_disconnect, - bench_read_play_disconnect - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEntityStatus, - PlayEntityStatusSpec, - test_play_entity_status, - bench_write_play_entity_status, - bench_read_play_entity_status - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayExplosion, - PlayExplosionSpec, - test_play_explosion, - bench_write_play_explosion, - bench_read_play_explosion - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayUnloadChunk, - PlayUnloadChunkSpec, - test_play_unload_chunk, - bench_write_play_unload_chunk, - bench_read_play_unload_chunk - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayChangeGameState, - PlayChangeGameStateSpec, - test_play_change_game_state, - bench_write_play_change_game_state, - bench_read_play_change_game_state - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayOpenHorseWindow, - PlayOpenHorseWindowSpec, - test_play_open_horse_window, - bench_write_play_open_horse_window, - bench_read_play_open_horse_window - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayServerKeepAlive, - PlayServerKeepAliveSpec, - test_play_server_keep_alive, - bench_write_play_server_keep_alive, - bench_read_play_server_keep_alive - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayChunkData, - PlayChunkDataWrapper, - test_play_chunk_data, - bench_write_play_chunk_data, - bench_read_play_chunk_data - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEffect, - PlayEffectSpec, - test_play_effect, - bench_write_play_effect, - bench_read_play_effect - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayParticle, - PlayParticleSpec, - test_play_particle, - bench_write_play_particle, - bench_read_play_particle - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayUpdateLight, - PlayUpdateLightSpec, - test_play_update_light, - bench_write_play_update_light, - bench_read_play_update_light - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayJoinGame, - PlayJoinGameSpec, - test_play_join_game, - bench_write_play_join_game, - bench_read_play_join_game - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayMapData, - PlayMapDataSpec, - test_play_map_data, - bench_write_play_map_data, - bench_read_play_map_data - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayTradeList, - PlayTradeListSpec, - test_play_trade_list, - bench_write_play_trade_list, - bench_read_play_trade_list - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEntityPosition, - PlayEntityPositionSpec, - test_play_entity_position, - bench_write_play_entity_position, - bench_read_play_entity_position - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEntityPositionAndRotation, - PlayEntityPositionAndRotationSpec, - test_play_entity_position_and_rotation, - bench_write_play_entity_position_and_rotation, - bench_read_play_entity_position_and_rotation - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEntityRotation, - PlayEntityRotationSpec, - test_play_entity_rotation, - bench_write_play_entity_rotation, - bench_read_play_entity_rotation - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEntityMovement, - PlayEntityMovementSpec, - test_play_entity_movement, - bench_write_play_entity_movement, - bench_read_play_entity_movement - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayServerVehicleMove, - PlayEntityVehicleMoveSpec, - test_play_server_vehicle_move, - bench_write_play_server_vehicle_move, - bench_read_play_server_vehicle_move - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayOpenBook, - PlayOpenBookSpec, - test_play_open_book, - bench_write_play_open_book, - bench_read_play_open_book - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayOpenWindow, - PlayOpenWindowSpec, - test_play_open_window, - bench_write_play_open_window, - bench_read_play_open_window - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayOpenSignEditor, - PlayOpenSignEditorSpec, - test_play_open_sign_editor, - bench_write_play_open_sign_editor, - bench_read_play_open_sign_editor - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayCraftRecipeResponse, - PlayCraftRecipeResponseSpec, - test_play_craft_recipe_response, - bench_write_play_craft_recipe_response, - bench_read_play_craft_recipe_response - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayServerPlayerAbilities, - PlayServerPlayerAbilitiesSpec, - test_play_server_player_abilities, - bench_write_play_server_player_abilities, - bench_read_play_server_player_abilities - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayCombatEvent, - PlayCombatEventSpec, - test_play_combat_event, - bench_write_play_combat_event, - bench_read_play_combat_event - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayPlayerInfo, - PlayPlayerInfoSpec, - test_play_player_info, - bench_write_play_player_info, - bench_read_play_player_info - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayFacePlayer, - PlayFacePlayerSpec, - test_play_face_player, - bench_write_play_face_player, - bench_read_play_face_player - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayServerPlayerPositionAndLook, - PlayServerPlayerPositionAndLookSpec, - test_play_server_player_position_and_look, - bench_write_play_server_player_position_and_look, - bench_read_play_server_player_position_and_look - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayUnlockRecipes, - PlayUnlockRecipesSpec, - test_play_unlock_recipes, - bench_write_play_unlock_recipes, - bench_read_play_unlock_recipes - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayDestroyEntities, - PlayDestroyEntitiesSpec, - test_play_destroy_entities, - bench_write_play_destroy_entities, - bench_read_play_destroy_entities - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayRemoveEntityEffect, - PlayRemoveEntityEffectSpec, - test_play_remove_entity_effect, - bench_write_play_remove_entity_effect, - bench_read_play_remove_entity_effect - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayResourcePackSend, - PlayResourcePackSendSpec, - test_play_resource_pack_send, - bench_write_play_resource_pack_send, - bench_read_play_resource_pack_send - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayRespawn, - PlayRespawnSpec, - test_play_respawn, - bench_write_play_respawn, - bench_read_play_respawn - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEntityHeadLook, - PlayEntityHeadLookSpec, - test_play_entity_head_look, - bench_write_play_entity_head_look, - bench_read_play_entity_head_look - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayMultiBlockChange, - PlayMultiBlockChangeSpec, - test_play_multi_block_change, - bench_write_play_multi_block_change, - bench_read_play_multi_block_change - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySelectAdvancementTab, - PlaySelectAdvancementTabSpec, - test_play_select_advancement_tab, - bench_write_play_select_advancement_tab, - bench_read_play_select_advancement_tab - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayWorldBorder, - PlayWorldBorderSpec, - test_play_world_border, - bench_write_play_world_border, - bench_read_play_world_border - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayCamera, - PlayCameraSpec, - test_play_camera, - bench_write_play_camera, - bench_read_play_camera - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayServerHeldItemChange, - PlayServerHeldItemChangeSpec, - test_play_server_held_item_change, - bench_write_play_server_held_item_change, - bench_read_play_server_held_item_change - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayUpdateViewPosition, - PlayUpdateViewPositionSpec, - test_play_update_view_position, - bench_write_play_update_view_position, - bench_read_play_update_view_position - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayUpdateViewDistance, - PlayUpdateViewDistanceSpec, - test_play_update_view_distance, - bench_write_play_update_view_distance, - bench_read_play_update_view_distance - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySpawnPosition, - PlaySpawnPositionSpec, - test_play_spawn_position, - bench_write_play_spawn_position, - bench_read_play_spawn_position - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayDisplayScoreboard, - PlayDisplayScoreboardSpec, - test_play_display_scoreboard, - bench_write_play_display_scoreboard, - bench_read_play_display_scoreboard - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEntityMetadata, - PlayEntityMetadataSpec, - test_play_entity_metadata, - bench_write_play_entity_metadata, - bench_read_play_entity_metadata - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayAttachEntity, - PlayAttachEntitySpec, - test_play_attach_entity, - bench_write_play_attach_entity, - bench_read_play_attach_entity - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEntityVelocity, - PlayEntityVelocitySpec, - test_play_entity_velocity, - bench_write_play_entity_velocity, - bench_read_play_entity_velocity - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEntityEquipment, - PlayEntityEquiptmentSpec, - test_play_entity_equipment, - bench_write_play_entity_equipment, - bench_read_play_entity_equipment - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySetExperience, - PlaySetExperienceSpec, - test_play_set_experience, - bench_write_play_set_experience, - bench_read_play_set_experience - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayUpdatehealth, - PlayUpdateHealthSpec, - test_play_updatehealth, - bench_write_play_updatehealth, - bench_read_play_updatehealth - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayScoreboardObjective, - PlayScoreboardObjectiveSpec, - test_play_scoreboard_objective, - bench_write_play_scoreboard_objective, - bench_read_play_scoreboard_objective - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySetPassengers, - PlaySetPassengersSpec, - test_play_set_passengers, - bench_write_play_set_passengers, - bench_read_play_set_passengers - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayTeams, - PlayTeamsSpec, - test_play_teams, - bench_write_play_teams, - bench_read_play_teams - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayUpdateScore, - PlayUpdateScoreSpec, - test_play_update_score, - bench_write_play_update_score, - bench_read_play_update_score - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayTimeUpdate, - PlayTimeUpdateSpec, - test_play_time_update, - bench_write_play_time_update, - bench_read_play_time_update - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayTitle, - PlayTitleSpec, - test_play_title, - bench_write_play_title, - bench_read_play_title - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEntitySoundEffect, - PlayEntitySoundEffectSpec, - test_play_entity_sound_effect, - bench_write_play_entity_sound_effect, - bench_read_play_entity_sound_effect - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySoundEffect, - PlaySoundEffectSpec, - test_play_sound_effect, - bench_write_play_sound_effect, - bench_read_play_sound_effect - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayStopSound, - PlayStopSoundSpec, - test_play_stop_sound, - bench_write_play_stop_sound, - bench_read_play_stop_sound - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayerPlayerListHeaderAndFooter, - PlayPlayerListHeaderAndFooterSpec, - test_player_player_list_header_and_footer, - bench_write_player_player_list_header_and_footer, - bench_read_player_player_list_header_and_footer - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayNbtQueryResponse, - PlayNbtQueryResponseSpec, - test_play_nbt_query_response, - bench_write_play_nbt_query_response, - bench_read_play_nbt_query_response - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayCollectItem, - PlayCollectItemSpec, - test_play_collect_item, - bench_write_play_collect_item, - bench_read_play_collect_item - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEntityTeleport, - PlayEntityTeleportSpec, - test_play_entity_teleport, - bench_write_play_entity_teleport, - bench_read_play_entity_teleport - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayAdvancements, - PlayAdvancementsSpec, - test_play_advancements, - bench_write_play_advancements, - bench_read_play_advancements - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEntityProperties, - PlayEntityPropertiesSpec, - test_play_entity_properties, - bench_write_play_entity_properties, - bench_read_play_entity_properties - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEntityEffect, - PlayEntityEffectSpec, - test_play_entity_effect, - bench_write_play_entity_effect, - bench_read_play_entity_effect - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayDeclareRecipes, - PlayDeclareRecipesSpec, - test_play_declare_recipes, - bench_write_play_declare_recipes, - bench_read_play_declare_recipes - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayTags, - PlayTagsSpec, - test_play_tags, - bench_write_play_tags, - bench_read_play_tags - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayTeleportConfirm, - PlayTeleportConfirmSpec, - test_play_teleport_confirm, - bench_write_play_teleport_confirm, - bench_read_play_teleport_confirm - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayQueryBlockNbt, - PlayQueryBlockNbtSpec, - test_play_query_block_nbt, - bench_write_play_query_block_nbt, - bench_read_play_query_block_nbt - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayQueryEntityNbt, - PlayQueryEntityNbtSpec, - test_play_query_entity_nbt, - bench_write_play_query_entity_nbt, - bench_read_play_query_entity_nbt - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySetDifficulty, - PlaySetDifficultySpec, - test_play_set_difficulty, - bench_write_play_set_difficulty, - bench_read_play_set_difficulty - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayClientChatMessage, - PlayClientChatMessageSpec, - test_play_client_chat_message, - bench_write_play_client_chat_message, - bench_read_play_client_chat_message - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayClientStatus, - PlayClientStatusSpec, - test_play_client_status, - bench_write_play_client_status, - bench_read_play_client_status - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayClientSettings, - PlayClientSettingsSpec, - test_play_client_settings, - bench_write_play_client_settings, - bench_read_play_client_settings - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayClientTabComplete, - PlayClientTabCompleteSpec, - test_play_client_tab_complete, - bench_write_play_client_tab_complete, - bench_read_play_client_tab_complete - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayClientWindowConfirmation, - PlayClientWindowConfirmationSpec, - test_play_client_window_confirmation, - bench_write_play_client_window_confirmation, - bench_read_play_client_window_confirmation - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayClickWindowButton, - PlayClickWindowButtonSpec, - test_play_click_window_button, - bench_write_play_click_window_button, - bench_read_play_click_window_button - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayClickWindow, - PlayClickWindowSpec, - test_play_click_window, - bench_write_play_click_window, - bench_read_play_click_window - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayClientCloseWindow, - PlayClientCloseWindowSpec, - test_play_client_close_window, - bench_write_play_client_close_window, - bench_read_play_client_close_window - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayClientPluginMessage, - PlayClientPluginMessageSpec, - test_play_client_plugin_message, - bench_write_play_client_plugin_message, - bench_read_play_client_plugin_message - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEditBook, - PlayEditBookSpec, - test_play_edit_book, - bench_write_play_edit_book, - bench_read_play_edit_book - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayInteractEntity, - PlayInteractEntitySpec, - test_play_interact_entity, - bench_write_play_interact_entity, - bench_read_play_interact_entity - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayGenerateStructure, - PlayGenerateStructureSpec, - test_play_generate_structure, - bench_write_play_generate_structure, - bench_read_play_generate_structure - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayClientKeepAlive, - PlayClientKeepAliveSpec, - test_play_client_keep_alive, - bench_write_play_client_keep_alive, - bench_read_play_client_keep_alive - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayLockDifficulty, - PlayLockDifficultySpec, - test_play_lock_difficulty, - bench_write_play_lock_difficulty, - bench_read_play_lock_difficulty - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayPlayerPosition, - PlayPlayerPositionSpec, - test_play_player_position, - bench_write_play_player_position, - bench_read_play_player_position - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayClientPlayerPositionAndRotation, - PlayClientPlayerPositionAndRotationSpec, - test_play_client_player_position_and_rotation, - bench_write_play_client_player_position_and_rotation, - bench_read_play_client_player_position_and_rotation - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayPlayerRotation, - PlayPlayerRotationSpec, - test_play_player_rotation, - bench_write_play_player_rotation, - bench_read_play_player_rotation - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayPlayerMovement, - PlayPlayerMovementSpec, - test_play_player_movement, - bench_write_play_player_movement, - bench_read_play_player_movement - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayClientVehicleMove, - PlayClientVehicleMoveSpec, - test_play_client_vehicle_move, - bench_write_play_client_vehicle_move, - bench_read_play_client_vehicle_move - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySteerBoat, - PlaySteerBoatSpec, - test_play_steer_boat, - bench_write_play_steer_boat, - bench_read_play_steer_boat - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayPickItem, - PlayPickItemSpec, - test_play_pick_item, - bench_write_play_pick_item, - bench_read_play_pick_item - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayCraftRecipeRequest, - PlayCraftRecipeRequestSpec, - test_play_craft_recipe_request, - bench_write_play_craft_recipe_request, - bench_read_play_craft_recipe_request - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayClientPlayerAbilities, - PlayClientPlayerAbilitiesSpec, - test_play_client_player_abilities, - bench_write_play_client_player_abilities, - bench_read_play_client_player_abilities - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayPlayerDigging, - PlayPlayerDiggingSpec, - test_play_player_digging, - bench_write_play_player_digging, - bench_read_play_player_digging - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayEntityAction, - PlayEntityActionSpec, - test_play_entity_action, - bench_write_play_entity_action, - bench_read_play_entity_action - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySteerVehicle, - PlaySteerVehicleSpec, - test_play_steer_vehicle, - bench_write_play_steer_vehicle, - bench_read_play_steer_vehicle - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySetDisplayedRecipe, - PlaySetDisplayedRecipeSpec, - test_play_set_displayed_recipe, - bench_write_play_set_displayed_recipe, - bench_read_play_set_displayed_recipe - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySetRecipeBookState, - PlaySetRecipeBookStateSpec, - test_play_set_recipe_book_state, - bench_write_play_set_recipe_book_state, - bench_read_play_set_recipe_book_state - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayNameItem, - PlayNameItemSpec, - test_play_name_item, - bench_write_play_name_item, - bench_read_play_name_item - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayResourcePackStatus, - PlayResourcePackStatusSpec, - test_play_resource_pack_status, - bench_write_play_resource_pack_status, - bench_read_play_resource_pack_status - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayAdvancementTab, - PlayAdvancementTabSpec, - test_play_advancement_tab, - bench_write_play_advancement_tab, - bench_read_play_advancement_tab - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySelectTrade, - PlaySelectTradeSpec, - test_play_select_trade, - bench_write_play_select_trade, - bench_read_play_select_trade - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySetBeaconEffect, - PlaySetBeaconEffectSpec, - test_play_set_beacon_effect, - bench_write_play_set_beacon_effect, - bench_read_play_set_beacon_effect - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayClientHeldItemChange, - PlayClientHeldItemChangeSpec, - test_play_client_held_item_change, - bench_write_play_client_held_item_change, - bench_read_play_client_held_item_change - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayUpdateCommandBlock, - PlayUpdateCommandBlockSpec, - test_play_update_command_block, - bench_write_play_update_command_block, - bench_read_play_update_command_block - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayUpdateCommandBlockMinecart, - PlayUpdateCommandBlockMinecartSpec, - test_play_update_command_block_minecart, - bench_write_play_update_command_block_minecart, - bench_read_play_update_command_block_minecart - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayUpdateJigsawBlock, - PlayUpdateJigsawBlockSpec, - test_play_update_jigsaw_block, - bench_write_play_update_jigsaw_block, - bench_read_play_update_jigsaw_block - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayCreativeInventoryAction, - PlayCreativeInventoryActionSpec, - test_play_creative_inventory_action, - bench_write_play_creative_inventory_action, - bench_read_play_creative_inventory_action - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayUpdateStructureBlock, - PlayUpdateStructureBlockSpec, - test_play_update_structure_block, - bench_write_play_update_structure_block, - bench_read_play_update_structure_block - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayUpdateSign, - PlayUpdateSignSpec, - test_play_update_sign, - bench_write_play_update_sign, - bench_read_play_update_sign - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayClientAnimation, - PlayClientAnimationSpec, - test_play_client_animation, - bench_write_play_client_animation, - bench_read_play_client_animation - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlaySpectate, - PlaySpectateSpec, - test_play_spectate, - bench_write_play_spectate, - bench_read_play_spectate - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayBlockPlacement, - PlayBlockPlacementSpec, - test_play_block_placement, - bench_write_play_block_placement, - bench_read_play_block_placement - ); - - packet_test_cases!( - RawPacket759, - Packet759, - PlayUseItem, - PlayUseItemSpec, - test_play_use_item, - bench_write_play_use_item, - bench_read_play_use_item - ); - - // trust me, this is some cutting edge shit - // I'm definitely not generating code using a unit test - #[test] - fn test_generate_test_cases() { - Packet759::describe().packets.iter().map(move |packet| { - let snake_case = to_snake_case(packet.name.clone()); - alloc::format!("packet_test_cases!(RawPacket759, Packet759, {}, {},\n test_{}, bench_write_{}, bench_read_{});\n", - packet.name, packet.body_struct, snake_case, snake_case, snake_case).to_owned() - }).for_each(move |line| { - println!("{}", line) - }) - } - - fn to_snake_case(camel: String) -> String { - let mut parts = Vec::new(); - let mut buf = String::new(); - for c in camel.chars() { - if !buf.is_empty() && char::is_uppercase(c) { - parts.push(buf); - buf = String::new(); - } - - buf.push(c.to_ascii_lowercase()); - } - - if !buf.is_empty() { - parts.push(buf); - } - - parts.join("_") - } -} diff --git a/src/v1_19_3.rs b/src/v1_19_3.rs new file mode 100644 index 0000000..ee51d04 --- /dev/null +++ b/src/v1_19_3.rs @@ -0,0 +1,349 @@ +use alloc::{ + borrow::ToOwned, + string::{String, ToString}, + vec::Vec, +}; +use alloc::fmt; +use fmt::Debug; + +use crate::{*, types::*, uuid::*}; +pub use crate::v1_19::CommandNode; +#[cfg(all(test, feature = "std"))] +use crate::protocol::TestRandom; + +define_protocol!(760, Packet760, RawPacket760, RawPacket760Body, Packet760Kind => { + // Handshaking + Handshake, 0x00, Handshaking, ServerBound => HandshakeSpec { + version: VarInt, + server_address: String, + server_port: u16, + next_state: HandshakeNextState + }, + + // Status - ClientBound + StatusRespone, 0x00, Status, ClientBound => StatusResponseSpec { + response: super::status::StatusSpec + }, + PingResponse, 0x01, Status, ClientBound => PingResponseSpec { + payload: i64 + }, + + // Status - ServerBound + StatusRequest, 0x00, Status, ServerBound => StatusRequestSpec { + }, + PingRequest, 0x01, Status, ServerBound => PingRequestSpec { + payload: i64 + }, + + // Login - ClientBound + DisconnectLogin, 0x00, Login, ClientBound => DisconnectLoginSpec { + payloadreason: Chat + }, + EncryptionRequest, 0x01, Login, ClientBound => EncryptionRequestSpec { + server_id: String, + public_key: CountedArray<u8, VarInt>, + verify_token: CountedArray<u8, VarInt> + }, + LoginSuccess, 0x02, Login, ClientBound => LoginSuccessSpec { + uuid: UUID4, + username: String, + properties: CountedArray<LoginProperty, VarInt> + }, + SetCompression, 0x03, Login, ClientBound => SetCompressionSpec { + threshold: VarInt + }, + LoginPluginRequest, 0x04, Login, ClientBound => LoginPluginRequestSpec { + message_id: VarInt, + channel: String, + data: RemainingBytes + }, + + // Login - ServerBound + LoginStart, 0x00, Login, ServerBound => LoginStartSpec { + name: String, + player_uuid: Option<UUID4> + }, + EncryptionResponse, 0x01, Login, ServerBound => EncryptionResponseSpec { + shared_secret: CountedArray<u8, VarInt>, + verfiy_token: CountedArray<u8, VarInt> + }, + LoginPluginResponse, 0x02, Login, ServerBound => LoginPluginResponseSpec { + message_id: VarInt, + successful: bool, + data: RemainingBytes + }, + + // Play - ClientBound + SpawnEntity, 0x00, Play, ClientBound => SpawnEntitySpec { + entity_id: VarInt, + entity_uuid: UUID4, + entity_type: VarInt, // TODO enumerate mob types + position: Vec3<f64>, + pitch: Angle, + yaw: Angle, + data: i32, + velocity: Vec3<i16> + }, + SpawnExperienceOrb, 0x01, Play, ClientBound => SpawnExperienceOrbSpec { + entity_id: VarInt, + position: Vec3<f64>, + count: i16 + }, + SpawnPlayer, 0x02, Play, ClientBound => SpawnPlayerSpec { + entity_id: VarInt, + player_uuid: UUID4, + position: Vec3<f64>, + yaw: Angle, + pitch: Angle + }, + EntityAnimation, 0x03, Play, ClientBound => EntityAnimationSpec { + entity_id: VarInt, + animation: u8 // TODO: enumerate animation id + }, + AwardStatistics, 0x04, Play, ClientBound => AwardStatisticsSpec { + statistics: CountedArray<StatisticValue, VarInt> + }, + AcknowledgeBlockChange, 0x05, Play, ClientBound => AcknowledgeBlockChangeSpec { + sequence_id: VarInt + }, + SetBlockDestroyStage, 0x06, Play, ClientBound => SetBlockDestroyStageSpec { + entity_id: VarInt, + location: IntPosition, + destroy_stage: u8 + }, + BlockEntityData, 0x07, Play, ClientBound => BlockEntityDataSpec { + location: IntPosition, + block_entity_type: VarInt, + nbt_data: NamedNbtTag + }, + BlockAction, 0x08, Play, ClientBound => BlockActionSpec { + location: IntPosition, + action_id: u8, + action_parameter: u8, + block_type: VarInt + }, + BlockUpdate, 0x09, Play, ClientBound => BlockUpdateSpec { + location: IntPosition, + block_id: VarInt + }, + BossBar, 0x0A, Play, ClientBound => BossBarSpec { + uuid: UUID4, + action: BossBarAction + }, + ChangeDifficulty, 0x0B, Play, ClientBound => ChangeDifficultySpec { + difficulty: Difficulty, + difficulty_locked: bool + }, + ClearTitles, 0x0C, Play, ClientBound => ClearTitlesSpec { + reset: bool + }, + CommandSuggestionResponse, 0x0D, Play, ClientBound => CommandSuggestionResponseSpec { + transaction_id: VarInt, + start: VarInt, + length: VarInt, + suggestions: CountedArray<CommandSuggestion, VarInt> + }, + Commands, 0x0E, Play, ClientBound => CommandsSpec { + nodes: CountedArray<CommandNode, VarInt>, + root_index: VarInt + }, + CloseContainer, 0x0F, Play, ClientBound => CloseContainerSpec { + window_id: u8 + }, + SetContainerContent, 0x10, Play, ClientBound => SetContainerContentSpec { + window_id: u8, + state_id: VarInt, + slot_data: CountedArray<Slot, VarInt>, + carried_item: Slot + }, + SetContainerProperty, 0x11, Play, ClientBound => SetContainerPropertySpec { + window_id: u8, + property: i16, + value: i16 + }, + SetContainerSlot, 0x12, Play, ClientBound => SetContainerSlotSpec { + window_id: u8, + state_id: VarInt, + slot_index: i16, + slot_data: Slot + }, + SetCooldown, 0x13, Play, ClientBound => SetCooldownSpec { + item_id: VarInt, + cooldown_ticks: VarInt + }, + ChatSuggestions, 0x14, Play, ClientBound => ChatSuggestionsSpec { + action: VarInt, + entries: CountedArray<String, VarInt> + }, + PluginMessage, 0x15, Play, ClientBound => PluginMessageSpec { + channel: String, + data: RemainingBytes + }, + DeleteMessage, 0x16, Play, ClientBound => DeleteMessageSpec { + signature: CountedArray<u8, VarInt> + }, + DisconnectPlay, 0x17, Play, ClientBound => DisconnectPlaySpec { + reason: Chat + }, + DisguisedChatMessage, 0x18, Play, ClientBound => DisguisedChatMessageSpec { + message: Chat, + chat_type: VarInt, + chat_type_name: Chat, + target_name: Option<Chat> + }, + EntityEvent, 0x19, Play, ClientBound => EntityEventSpec { + entity_id: i32, + entity_status: u8 + }, + Explosion, 0x1A, Play, ClientBound => ExplosionSpec { + position: Vec3<f64>, + strength: f32, + affected_blocks: CountedArray<Vec3<i8>, VarInt>, + player_motion: Vec3<f32> + }, + UnloadChunk, 0x1B, Play, ClientBound => UnloadChunkSpec { + chunk_x: i32, + chunk_z: i32 + }, + GameEvent, 0x1C, Play, ClientBound => GameEventSpec { + event: GameEventType, + data: f32 + }, + OpenHorseScreen, 0x1D, Play, ClientBound => OpenHorseScreenSpec { + window_id: u8, + slot_count: VarInt, + entity_id: i32 + }, + InitializeWorldBorder, 0x1E, Play, ClientBound => InitializeWorldBorderSpec { + x: f32, + z: f32, + old_diameter: f32, + new_diameter: f32, + speed: VarLong, + portal_teleport_boundary: VarInt, + warning_blocks: VarInt, + warning_time: VarInt + }, + KeepAlive, 0x1f, Play, ClientBound => KeepAliveSpec { + keep_alive_id: i64 + }, + ChunkDataAndUpdateLight, 0x20, Play, ClientBound => ChunkDataAndUpdateLightSpec { + chunk_x: i32, + chunk_z: i32, + heightmaps: NamedNbtTag, + chunk_data: CountedArray<u8, VarInt>, + block_entities: CountedArray<BlockEntity, VarInt>, + trust_edges: bool // TODO: HEEELP + } +}); + + +// Helper types + +proto_struct!(BlockEntity { + packed_xz: u8, + y: i16, + block_entity_type: VarInt, + data: NamedNbtTag +}); +proto_byte_enum!(GameEventType, + 0 :: NoRespawnBlockAvailable, + 1 :: EndRaining, + 2 :: BeginRaining, + 3 :: ChangeGamemode, + 4 :: WinGame, + 5 :: DemoEvent, + 6 :: ArrowHitPlayer, + 7 :: RainLevelChange, + 8 :: ThunderLevelChange, + 9 :: PlayPufferfishStingSound, + 10 :: PlayElderGuardianMobAppearance, + 11 :: SetImmediateRespawn +); + +proto_struct!(CommandSuggestion { + match_text: String, + tooltip: Option<Chat> +}); + +proto_byte_enum!(Difficulty, + 0 :: Peaceful, + 1 :: Easy, + 2 :: Normal, + 3 :: Hard +); + +proto_byte_enum!(HandshakeNextState, + 0x01 :: Status, + 0x02 :: Login +); + +proto_struct!(LoginProperty { + name: String, + value: String, + signature: Option<String> +}); + +proto_struct!(StatisticValue { + category_id: StatisticCategory, + statistic_id: VarInt, + value: VarInt +}); + +proto_varint_enum!(StatisticCategory, + 0 :: Mined, + 1 :: Crafted, + 2 :: Used, + 3 :: Broken, + 4 :: PickedUp, + 5 :: Dropped, + 6 :: Killed, + 7 :: KilledBy, + 8 :: Custom +); + +proto_varint_enum!(BossBarAction, + 0 :: Add(BossBarAddSpec), + 1 :: Remove, + 2 :: UpdateHealth(f32), + 3 :: UpdateTitle(Chat), + 4 :: UpdateStyle(BossBarUpdateStyleSpec), + 5 :: UpdateFlags(BossBarFlags) +); + +proto_struct!(BossBarAddSpec { + title: Chat, + health: f32, + color: BossBarColor, + division: BossBarDivision, + flags: BossBarFlags +}); + +proto_struct!(BossBarUpdateStyleSpec { + color: BossBarColor, + dividers: BossBarDivision +}); + +proto_varint_enum!(BossBarColor, + 0 :: Pink, + 1 :: Blue, + 2 :: Red, + 3 :: Green, + 4 :: Yellow, + 5 :: Purple, + 6 :: White +); +proto_varint_enum!(BossBarDivison, + 0 :: NoDivision, + 1 :: SixNotches, + 2 :: TenNotches, + 3 :: TwelveNotches, + 4 :: TwentyNotches +); + +proto_byte_flag!(BossBarFlags, + 0x01 :: is_darken_sky set_darken_sky, + 0x02 :: is_dragon_bar set_dragon_bar, + 0x03 :: is_create_fog set_create_fog +); + |