Open Saghetti0 opened 1 month ago
so if i'm understanding correctly, you need a way to get the ID of a packet in the running version. getCurrentID is returning the latest version. i think it should be reasonably straightforward to add some functionality to do that
I went through the code to explain why getCurrentID returns the latest packet ID, but you got it. I just need a method to get packet IDs for the current server version.
Describe the bug
PacketType.fromCurrent()
does not properly handle an ID mismatch. While there is code in the method that checks for a mismatch, the consumer it invokes (onIdMismatch
) does nothing, and is never referenced anywhere else. WhenPacketRegistry
initializes, it callsfromCurrent()
in order to createPacketType
s with the correct IDs, but these correct IDs are dropped, and erroneousPacketType
s are returned. This results in packet IDs in the registry always being for the latest versions, even when the server is running an older version of Minecraft. This also results in plugins receivingPacketEvent
s containingPacketType
s with the wrong IDs.To Reproduce Run the following code on an older version of the game (ex: 1.20.4) and cross-reference packet IDs with the protocol docs for that version.
Despite the server running on an older version, all the packet IDs correspond to latest.
Expected behavior Packet IDs should correspond to the version of Minecraft that the server is running.
Version Info https://pastebin.com/3JW4RgA0
Additional context I know that
getCurrentId()
is deprecated, but the project I'm currently working on relies on it to work properly, because it records direct packet dumps from the game. These packet IDs are never hardcoded or checked.