From 4749899530cf216d715f343834e01c07bf8c192f Mon Sep 17 00:00:00 2001 From: adepierre <24371370+adepierre@users.noreply.github.com> Date: Tue, 7 May 2024 16:03:49 +0200 Subject: [PATCH] Add 1.20.5 and 1.20.6 support --- .github/ISSUE_TEMPLATE/version-request.yml | 2 ++ 3rdparty/botcraft | 2 +- CMakeLists.txt | 4 ++-- README.md | 4 +++- sniffcraft/include/sniffcraft/MinecraftProxy.hpp | 4 ++++ sniffcraft/src/MinecraftProxy.cpp | 8 ++++++++ 6 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/version-request.yml b/.github/ISSUE_TEMPLATE/version-request.yml index b911349..54540ee 100644 --- a/.github/ISSUE_TEMPLATE/version-request.yml +++ b/.github/ISSUE_TEMPLATE/version-request.yml @@ -43,5 +43,7 @@ body: - "1.20.2" - "1.20.3" - "1.20.4" + - "1.20.5" + - "1.20.6" validations: required: true \ No newline at end of file diff --git a/3rdparty/botcraft b/3rdparty/botcraft index 830d8e9..8a58251 160000 --- a/3rdparty/botcraft +++ b/3rdparty/botcraft @@ -1 +1 @@ -Subproject commit 830d8e99e8d14c1be4c1dda956e3dd2719b4365d +Subproject commit 8a582516175c97994cd96cf3b01d6c3912dcecf3 diff --git a/CMakeLists.txt b/CMakeLists.txt index 681bb70..ab1cdee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,8 +38,8 @@ find_package(Threads) # Version selection stuffs set(GAME_VERSION "latest" CACHE STRING "Each version of the game uses a specific protocol. Make sure this matches the version of your server.") -set(GameVersionValues "1.12.2;1.13;1.13.1;1.13.2;1.14;1.14.1;1.14.2;1.14.3;1.14.4;1.15;1.15.1;1.15.2;1.16;1.16.1;1.16.2;1.16.3;1.16.4;1.16.5;1.17;1.17.1;1.18;1.18.1;1.18.2;1.19;1.19.1;1.19.2;1.19.3;1.19.4;1.20;1.20.1;1.20.2;1.20.3;1.20.4;latest") -set(ProtocolVersionValues "340;393;401;404;477;480;485;490;498;573;575;578;735;736;751;753;754;754;755;756;757;757;758;759;760;760;761;762;763;763;764;765;765") +set(GameVersionValues "1.12.2;1.13;1.13.1;1.13.2;1.14;1.14.1;1.14.2;1.14.3;1.14.4;1.15;1.15.1;1.15.2;1.16;1.16.1;1.16.2;1.16.3;1.16.4;1.16.5;1.17;1.17.1;1.18;1.18.1;1.18.2;1.19;1.19.1;1.19.2;1.19.3;1.19.4;1.20;1.20.1;1.20.2;1.20.3;1.20.4;1.20.5;1.20.6;latest") +set(ProtocolVersionValues "340;393;401;404;477;480;485;490;498;573;575;578;735;736;751;753;754;754;755;756;757;757;758;759;760;760;761;762;763;763;764;765;765;766;766") set_property(CACHE GAME_VERSION PROPERTY STRINGS ${GameVersionValues}) if(GAME_VERSION STREQUAL "latest") diff --git a/README.md b/README.md index 101818b..7016527 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ It works as a man-in-the-middle: instead of connecting directly to the server, y ## Features -- Supported minecraft versions: all official releases from 1.12.2 to 1.20.4 +- Supported minecraft versions: all official releases from 1.12.2 to 1.20.6 - GUI mode - Packet logging with different levels of details (ignore packet, log packet name only, log full packet content) - Detailed network usage recap @@ -34,6 +34,8 @@ It works as a man-in-the-middle: instead of connecting directly to the server, y - Creating a [replay mod](https://github.com/ReplayMod/ReplayMod) capture of the session is also possible, see [Replay Mod section](#replay-mod) for more details - No log at all is possible, in this case, SniffCraft becomes a pure proxy that you can adapt to block/modify any packet you want +1.20.5 transfer packet is **not** supported yet. + Sniffcraft GUI diff --git a/sniffcraft/include/sniffcraft/MinecraftProxy.hpp b/sniffcraft/include/sniffcraft/MinecraftProxy.hpp index 5103ea9..5b52eb6 100644 --- a/sniffcraft/include/sniffcraft/MinecraftProxy.hpp +++ b/sniffcraft/include/sniffcraft/MinecraftProxy.hpp @@ -54,7 +54,11 @@ class MinecraftProxy : public BaseProxy, public ProtocolCraft::Handler #if USE_ENCRYPTION && PROTOCOL_VERSION > 760 /* > 1.19.1/2 */ virtual void Handle(ProtocolCraft::ClientboundLoginPacket& msg) override; virtual void Handle(ProtocolCraft::ServerboundChatPacket& msg) override; +#if PROTOCOL_VERSION < 766 /* < 1.20.5 */ virtual void Handle(ProtocolCraft::ServerboundChatCommandPacket& msg) override; +#else + virtual void Handle(ProtocolCraft::ServerboundChatCommandSignedPacket& msg) override; +#endif virtual void Handle(ProtocolCraft::ClientboundPlayerChatPacket& msg) override; #endif #if PROTOCOL_VERSION > 763 /* > 1.20.1 */ diff --git a/sniffcraft/src/MinecraftProxy.cpp b/sniffcraft/src/MinecraftProxy.cpp index 3e8f525..12d305e 100644 --- a/sniffcraft/src/MinecraftProxy.cpp +++ b/sniffcraft/src/MinecraftProxy.cpp @@ -451,7 +451,11 @@ void MinecraftProxy::Handle(ServerboundChatPacket& msg) logger->Log(replacement_chat_packet, connection_state, Endpoint::SniffcraftToServer, 0); } +#if PROTOCOL_VERSION < 766 /* < 1.20.5 */ void MinecraftProxy::Handle(ServerboundChatCommandPacket& msg) +#else +void MinecraftProxy::Handle(ServerboundChatCommandSignedPacket& msg) +#endif { if (authentifier == nullptr) { @@ -460,7 +464,11 @@ void MinecraftProxy::Handle(ServerboundChatCommandPacket& msg) transmit_original_packet = false; +#if PROTOCOL_VERSION < 766 /* < 1.20.5 */ std::shared_ptr replacement_chat_command = std::make_shared(); +#else + std::shared_ptr replacement_chat_command = std::make_shared(); +#endif replacement_chat_command->SetCommand(msg.GetCommand()); replacement_chat_command->SetTimestamp(msg.GetTimestamp()); replacement_chat_command->SetSalt(msg.GetSalt());