diff --git a/assets/packets.json b/assets/packets.json index 96cf49402..1d2a7d8f0 100644 --- a/assets/packets.json +++ b/assets/packets.json @@ -1,4 +1,92 @@ { + "serverbound": { + "handshake": { + "intention": 0 + }, + "status": { + "status_request": 0, + "ping_request": 1 + }, + "login": { + "hello": 0, + "key": 1, + "custom_query_answer": 2, + "login_acknowledged": 3, + "cookie_response": 4 + }, + "config": { + "client_information": 0, + "cookie_response": 1, + "custom_payload": 2, + "finish_configuration": 3, + "keep_alive": 4, + "pong": 5, + "resource_pack": 6, + "select_known_packs": 7 + }, + "play": { + "accept_teleportation": 0, + "block_entity_tag_query": 1, + "bundle_item_selected": 2, + "change_difficulty": 3, + "chat_ack": 4, + "chat_command": 5, + "chat_command_signed": 6, + "chat": 7, + "chat_session_update": 8, + "chunk_batch_received": 9, + "client_command": 10, + "client_tick_end": 11, + "client_information": 12, + "command_suggestion": 13, + "configuration_acknowledged": 14, + "container_button_click": 15, + "container_click": 16, + "container_close": 17, + "container_slot_state_changed": 18, + "cookie_response": 19, + "custom_payload": 20, + "debug_sample_subscription": 21, + "edit_book": 22, + "entity_tag_query": 23, + "interact": 24, + "jigsaw_generate": 25, + "keep_alive": 26, + "lock_difficulty": 27, + "move_player_pos": 28, + "move_player_pos_rot": 29, + "move_player_rot": 30, + "move_player_status_only": 31, + "move_vehicle": 32, + "paddle_boat": 33, + "pick_item": 34, + "ping_request": 35, + "place_recipe": 36, + "player_abilities": 37, + "player_action": 38, + "player_command": 39, + "player_input": 40, + "pong": 41, + "recipe_book_change_settings": 42, + "recipe_book_seen_recipe": 43, + "rename_item": 44, + "resource_pack": 45, + "seen_advancements": 46, + "select_trade": 47, + "set_beacon": 48, + "set_carried_item": 49, + "set_command_block": 50, + "set_command_minecart": 51, + "set_creative_mode_slot": 52, + "set_jigsaw_block": 53, + "set_structure_block": 54, + "sign_update": 55, + "swing": 56, + "teleport_to_entity": 57, + "use_item_on": 58, + "use_item": 59 + } + }, "clientbound": { "status": { "status_response": 0, @@ -164,93 +252,5 @@ "custom_report_details": 129, "server_links": 130 } - }, - "serverbound": { - "handshake": { - "intention": 0 - }, - "status": { - "status_request": 0, - "ping_request": 1 - }, - "login": { - "hello": 0, - "key": 1, - "custom_query_answer": 2, - "login_acknowledged": 3, - "cookie_response": 4 - }, - "config": { - "client_information": 0, - "cookie_response": 1, - "custom_payload": 2, - "finish_configuration": 3, - "keep_alive": 4, - "pong": 5, - "resource_pack": 6, - "select_known_packs": 7 - }, - "play": { - "accept_teleportation": 0, - "block_entity_tag_query": 1, - "bundle_item_selected": 2, - "change_difficulty": 3, - "chat_ack": 4, - "chat_command": 5, - "chat_command_signed": 6, - "chat": 7, - "chat_session_update": 8, - "chunk_batch_received": 9, - "client_command": 10, - "client_tick_end": 11, - "client_information": 12, - "command_suggestion": 13, - "configuration_acknowledged": 14, - "container_button_click": 15, - "container_click": 16, - "container_close": 17, - "container_slot_state_changed": 18, - "cookie_response": 19, - "custom_payload": 20, - "debug_sample_subscription": 21, - "edit_book": 22, - "entity_tag_query": 23, - "interact": 24, - "jigsaw_generate": 25, - "keep_alive": 26, - "lock_difficulty": 27, - "move_player_pos": 28, - "move_player_pos_rot": 29, - "move_player_rot": 30, - "move_player_status_only": 31, - "move_vehicle": 32, - "paddle_boat": 33, - "pick_item": 34, - "ping_request": 35, - "place_recipe": 36, - "player_abilities": 37, - "player_action": 38, - "player_command": 39, - "player_input": 40, - "pong": 41, - "recipe_book_change_settings": 42, - "recipe_book_seen_recipe": 43, - "rename_item": 44, - "resource_pack": 45, - "seen_advancements": 46, - "select_trade": 47, - "set_beacon": 48, - "set_carried_item": 49, - "set_command_block": 50, - "set_command_minecart": 51, - "set_creative_mode_slot": 52, - "set_jigsaw_block": 53, - "set_structure_block": 54, - "sign_update": 55, - "swing": 56, - "teleport_to_entity": 57, - "use_item_on": 58, - "use_item": 59 - } } } \ No newline at end of file diff --git a/extractor/src/main/kotlin/de/snowii/extractor/extractors/Packets.kt b/extractor/src/main/kotlin/de/snowii/extractor/extractors/Packets.kt index 52d9d7a3f..fe9647147 100644 --- a/extractor/src/main/kotlin/de/snowii/extractor/extractors/Packets.kt +++ b/extractor/src/main/kotlin/de/snowii/extractor/extractors/Packets.kt @@ -47,33 +47,6 @@ class Packets : Extractor.Extractor { private fun serializeServerBound( - packets: Array> - ): JsonObject { - val statusArray = JsonObject() - val loginArray = JsonObject() - val configArray = JsonObject() - val playArray = JsonObject() - - for (factory in packets) { - factory.forEachPacketType { type: PacketType<*>, i: Int -> - when (factory.phase()!!) { - NetworkPhase.HANDSHAKING -> error("Server bound Packet should have no handshake") - NetworkPhase.PLAY -> playArray.addProperty(type.id().path, i) - NetworkPhase.STATUS -> statusArray.addProperty(type.id().path, i) - NetworkPhase.LOGIN -> loginArray.addProperty(type.id().path, i) - NetworkPhase.CONFIGURATION -> configArray.addProperty(type.id().path, i) - } - } - } - val finalJson = JsonObject() - finalJson.add("status", statusArray) - finalJson.add("login", loginArray) - finalJson.add("config", configArray) - finalJson.add("play", playArray) - return finalJson - } - - private fun serializeClientBound( packets: Array> ): JsonObject { val handshakeArray = JsonObject() @@ -101,4 +74,31 @@ class Packets : Extractor.Extractor { finalJson.add("play", playArray) return finalJson } + + private fun serializeClientBound( + packets: Array> + ): JsonObject { + val statusArray = JsonObject() + val loginArray = JsonObject() + val configArray = JsonObject() + val playArray = JsonObject() + + for (factory in packets) { + factory.forEachPacketType { type: PacketType<*>, i: Int -> + when (factory.phase()!!) { + NetworkPhase.HANDSHAKING -> error("Client bound Packet should have no handshake") + NetworkPhase.PLAY -> playArray.addProperty(type.id().path, i) + NetworkPhase.STATUS -> statusArray.addProperty(type.id().path, i) + NetworkPhase.LOGIN -> loginArray.addProperty(type.id().path, i) + NetworkPhase.CONFIGURATION -> configArray.addProperty(type.id().path, i) + } + } + } + val finalJson = JsonObject() + finalJson.add("status", statusArray) + finalJson.add("login", loginArray) + finalJson.add("config", configArray) + finalJson.add("play", playArray) + return finalJson + } }