Skip to content

Commit

Permalink
Add 1.20.5 and 1.20.6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
adepierre committed May 7, 2024
1 parent 177da60 commit 4749899
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/version-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@ body:
- "1.20.2"
- "1.20.3"
- "1.20.4"
- "1.20.5"
- "1.20.6"
validations:
required: true
2 changes: 1 addition & 1 deletion 3rdparty/botcraft
Submodule botcraft updated 460 files
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

<img width="600" src="https://github.com/adepierre/SniffCraft/assets/24371370/8c6b04d3-61e6-4fdc-aa1e-7e9505ac6033" alt="Sniffcraft GUI" align="center">


Expand Down
4 changes: 4 additions & 0 deletions sniffcraft/include/sniffcraft/MinecraftProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
8 changes: 8 additions & 0 deletions sniffcraft/src/MinecraftProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -460,7 +464,11 @@ void MinecraftProxy::Handle(ServerboundChatCommandPacket& msg)

transmit_original_packet = false;

#if PROTOCOL_VERSION < 766 /* < 1.20.5 */
std::shared_ptr<ServerboundChatCommandPacket> replacement_chat_command = std::make_shared<ServerboundChatCommandPacket>();
#else
std::shared_ptr<ServerboundChatCommandSignedPacket> replacement_chat_command = std::make_shared<ServerboundChatCommandSignedPacket>();
#endif
replacement_chat_command->SetCommand(msg.GetCommand());
replacement_chat_command->SetTimestamp(msg.GetTimestamp());
replacement_chat_command->SetSalt(msg.GetSalt());
Expand Down

0 comments on commit 4749899

Please sign in to comment.