diff options
-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 |
3 files changed, 4701 insertions, 0 deletions
diff --git a/src/v1_17_0.rs b/src/v1_17_0.rs index 7014b53..d65ea74 100644 --- a/src/v1_17_0.rs +++ b/src/v1_17_0.rs @@ -3459,3 +3459,1570 @@ 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 75303fc..c043816 100644 --- a/src/v1_17_1.rs +++ b/src/v1_17_1.rs @@ -3509,3 +3509,1570 @@ 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 9613f06..d07238e 100644 --- a/src/v1_19.rs +++ b/src/v1_19.rs @@ -3526,3 +3526,1570 @@ 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("_") + } +} |