Fix LoginSuccess packet being recorded with incorrect id on 1.20.2-4
This commit is contained in:
@@ -50,6 +50,10 @@ import org.apache.logging.log4j.Logger;
|
||||
//$$ import net.minecraft.network.handler.NetworkStateTransitions;
|
||||
//$$ import net.minecraft.network.packet.s2c.config.ReadyS2CPacket;
|
||||
//$$ import net.minecraft.network.state.LoginStates;
|
||||
//#else
|
||||
//#if MC>=12002
|
||||
//$$ import net.minecraft.network.packet.s2c.login.LoginSuccessS2CPacket;
|
||||
//#endif
|
||||
//#endif
|
||||
|
||||
//#if MC>=12002
|
||||
@@ -394,6 +398,13 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
||||
//$$ }
|
||||
//#else
|
||||
//#if MC>=10800
|
||||
//#if MC>=12002
|
||||
//$$ // Special case for our initial LoginSuccess packet which we only save after the pipeline has already
|
||||
//$$ // started to transition to the next phase
|
||||
//$$ if (packet instanceof LoginSuccessS2CPacket) {
|
||||
//$$ connectionState = NetworkState.LOGIN;
|
||||
//$$ }
|
||||
//#endif
|
||||
Integer packetId = connectionState.getPacketId(NetworkSide.CLIENTBOUND, packet);
|
||||
//#else
|
||||
//$$ Integer packetId = (Integer) connectionState.func_150755_b().inverse().get(packet.getClass());
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user