Fix LoginSuccess packet being recorded with incorrect id on 1.20.2-4

This commit is contained in:
Jonas Herzig
2024-07-12 12:38:17 +02:00
parent 6de0e37d96
commit 5959da8744
2 changed files with 17 additions and 0 deletions

View File

@@ -1528,6 +1528,12 @@ public class FullReplaySender extends ChannelInboundHandlerAdapter implements Re
timestamp = (int) data.getTime();
com.replaymod.replaystudio.protocol.Packet packet = data.getPacket();
type = packet.getType();
// Workaround for ReplayMod 2.7.16-17 saving the LoginSuccess packet with an incorrect packet id
// A fake one will have been sythesized by ReplayStudo, so we can simply drop the broken one.
if (packet.getId() == -1) {
bytes = new byte[0];
return;
}
// We need to re-encode ReplayStudio packets, so we can later decode them as NMS packets
// The main reason we aren't reading them as NMS packets is that we want ReplayStudio to be able
// to apply ViaVersion (and potentially other magic) to it.