diff --git a/src/main/java/de/bixilon/minosoft/protocol/packets/c2s/play/PingC2SP.kt b/src/main/java/de/bixilon/minosoft/protocol/packets/c2s/play/PingC2SP.kt new file mode 100644 index 000000000..4fc9b9157 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/protocol/packets/c2s/play/PingC2SP.kt @@ -0,0 +1,33 @@ +/* + * Minosoft + * Copyright (C) 2020-2023 Moritz Zwerger + * + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program. If not, see . + * + * This software is not affiliated with Mojang AB, the original developer of Minecraft. + */ +package de.bixilon.minosoft.protocol.packets.c2s.play + +import de.bixilon.minosoft.protocol.packets.c2s.PlayC2SPacket +import de.bixilon.minosoft.protocol.protocol.buffers.play.PlayOutByteBuffer +import de.bixilon.minosoft.util.logging.Log +import de.bixilon.minosoft.util.logging.LogLevels +import de.bixilon.minosoft.util.logging.LogMessageType + +class PingC2SP( + val payload: Long, +) : PlayC2SPacket { + + override fun write(buffer: PlayOutByteBuffer) { + buffer.writeLong(payload) + } + + override fun log(reducedLog: Boolean) { + if (reducedLog) return + Log.log(LogMessageType.NETWORK_OUT, LogLevels.VERBOSE) { "Ping (payload=$payload)" } + } +} diff --git a/src/main/java/de/bixilon/minosoft/protocol/packets/registry/DefaultPackets.kt b/src/main/java/de/bixilon/minosoft/protocol/packets/registry/DefaultPackets.kt index a683dd4bf..e3652608b 100644 --- a/src/main/java/de/bixilon/minosoft/protocol/packets/registry/DefaultPackets.kt +++ b/src/main/java/de/bixilon/minosoft/protocol/packets/registry/DefaultPackets.kt @@ -210,6 +210,7 @@ object DefaultPackets { register("recipe_book", RecipeBookC2SP::class) register("next_chunk_batch", NextChunkBatchC2SP::class) + register("ping", de.bixilon.minosoft.protocol.packets.c2s.play.PingC2SP::class) register("reconfigure", ReconfigureC2SP::class) register("session_data", SessionDataC2SP::class) register("settings", SettingsC2SP::class) @@ -397,6 +398,7 @@ object DefaultPackets { registerPlay("initialize", ::InitializeS2CP, threadSafe = false, extra = PacketExtraHandler.Disconnect) registerPlay("nbt_response", ::NbtResponseS2CP) registerPlay("play_status", ::PlayStatusS2CP) + registerPlay("pong", { de.bixilon.minosoft.protocol.packets.s2c.play.PongS2CP(it) }) registerPlay("reconfigure", ::ReconfigureS2CP, threadSafe = false) registerPlay("respawn", ::RespawnS2CP, threadSafe = false, extra = PacketExtraHandler.Disconnect) registerPlay("statistics", ::StatisticsS2CP) diff --git a/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/PongS2CP.kt b/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/PongS2CP.kt new file mode 100644 index 000000000..b90673368 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/PongS2CP.kt @@ -0,0 +1,30 @@ +/* + * Minosoft + * Copyright (C) 2020-2023 Moritz Zwerger + * + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program. If not, see . + * + * This software is not affiliated with Mojang AB, the original developer of Minecraft. + */ + +package de.bixilon.minosoft.protocol.packets.s2c.play + +import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket +import de.bixilon.minosoft.protocol.protocol.buffers.play.PlayInByteBuffer +import de.bixilon.minosoft.util.logging.Log +import de.bixilon.minosoft.util.logging.LogLevels +import de.bixilon.minosoft.util.logging.LogMessageType + +class PongS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket { + val payload = buffer.readLong() + + override fun log(reducedLog: Boolean) { + if (reducedLog) return + + Log.log(LogMessageType.NETWORK_IN, LogLevels.VERBOSE) { "Pong (payload=$payload)" } + } +} diff --git a/src/main/resources/assets/minosoft/mapping/versions.json b/src/main/resources/assets/minosoft/mapping/versions.json index 4fa229bc9..604df9669 100644 --- a/src/main/resources/assets/minosoft/mapping/versions.json +++ b/src/main/resources/assets/minosoft/mapping/versions.json @@ -1,4 +1,18 @@ { + "906": { + "name": "23w32a", + "protocol_id": 1073741969, + "packets": { + "c2s": { + "play": ["confirm_teleport", "block_nbt", "difficulty", "message_acknowledgement", "command", "signed_chat_message", "session_data", "next_chunk_batch", "client_action", "settings", "command_suggestions", "reconfigure", "container_button", "container_click", "close_container", "channel", "book", "entity_nbt", "entity_interact", "generate_structure", "heartbeat", "lock_difficulty", "position", "position_rotation", "rotation", "ground_change", "move_vehicle", "steer_boat", "item_pick", "ping", "crafting_recipe", "toggle_fly", "player_action", "entity_action", "vehicle_input", "pong", "displayed_recipe", "recipe_book", "anvil_item_name", "resourcepack", "advancement_tab", "trade", "beacon_effect", "hotbar_slot", "command_block", "minecart_command_block", "item_stack_create", "jigsaw_block", "structure_block", "sign_text", "swing_arm", "entity_spectate", "block_interact", "use_item"], + "configuration": ["channel", "ready", "heartbeat", "pong", "resourcepack"] + }, + "s2c": { + "play": ["bundle", "entity_object_spawn", "entity_experience_orb", "entity_player", "entity_animation", "statistics", "block_break", "block_break_animation", "block_data", "block_action", "block", "bossbar", "difficulty", "chunk_batch_done", "chunk_batch_start", "chunk_biome", "clear_title", "command_suggestions", "commands", "close_container", "container_items", "container_properties", "container_item", "item_cooldown", "chat_suggestions", "channel", "entity_damage", "hide_message", "kick", "unsigned_chat_message", "entity_event", "explosion", "unload_chunk", "game_event", "open_entity_container", "damage_tilt", "initialize_world_border", "heartbeat", "chunk", "world_event", "particle", "chunk_light", "initialize", "map", "villager_trades", "relative_move", "movement_rotation", "rotation", "move_vehicle", "book", "open_container", "sign_editor", "ping", "pong", "crafting_recipe", "player_abilities", "signed_chat_message", "end_combat_event", "enter_combat_event", "kill_combat_event", "tab_list_remove", "tab_list", "player_face", "position_rotation", "unlock_recipes", "entity_destroy", "entity_remove_effect", "resourcepack", "respawn", "head_rotation", "blocks", "advancement_tab", "play_status", "hotbar_text", "center_world_border", "interpolate_world_border", "size_world_border", "warn_time_world_border", "warn_blocks_world_border", "camera", "hotbar_slot", "chunk_center", "view_distance", "compass_position", "objective_position", "entity_data", "entity_attach", "velocity", "entity_equipment", "experience", "health", "objective", "entity_passenger", "teams", "scoreboard_score", "simulation_distance", "subtitle", "time", "title_text", "title_times", "entity_sound", "sound_event", "reconfigure", "stop_sound", "chat_message", "tab_list_text", "nbt_response", "entity_collect", "teleport", "advancements", "entity_attributes", "entity_effect", "recipes", "tags"], + "configuration": ["channel", "kick", "ready", "heartbeat", "ping", "registries", "resourcepack", "features", "tags"] + } + } + }, "905": { "name": "23w31a", "protocol_id": 1073741968,