Minecraft 26.2-pre-2 support

This commit is contained in:
md_5
2026-05-29 19:20:13 +10:00
parent c21769b06c
commit 0cf68b5d63
5 changed files with 14 additions and 3 deletions
@@ -55,7 +55,7 @@ public class ProtocolConstants
public static final int MINECRAFT_1_21_9 = 773; public static final int MINECRAFT_1_21_9 = 773;
public static final int MINECRAFT_1_21_11 = 774; public static final int MINECRAFT_1_21_11 = 774;
public static final int MINECRAFT_26_1 = 775; public static final int MINECRAFT_26_1 = 775;
public static final int MINECRAFT_26_2 = 1073742137; public static final int MINECRAFT_26_2 = 1073742140;
public static final List<String> SUPPORTED_VERSIONS; public static final List<String> SUPPORTED_VERSIONS;
public static final List<Integer> SUPPORTED_VERSION_IDS; public static final List<Integer> SUPPORTED_VERSION_IDS;
@@ -21,6 +21,7 @@ public class LoginSuccess extends DefinedPacket
private UUID uuid; private UUID uuid;
private String username; private String username;
private Property[] properties; private Property[] properties;
private UUID sessionId;
@Override @Override
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
@@ -42,6 +43,10 @@ public class LoginSuccess extends DefinedPacket
// Whether the client should disconnect on its own if it receives invalid data from the server // Whether the client should disconnect on its own if it receives invalid data from the server
buf.readBoolean(); buf.readBoolean();
} }
if ( protocolVersion >= ProtocolConstants.MINECRAFT_26_2 )
{
sessionId = readUUID( buf );
}
} }
@Override @Override
@@ -65,6 +70,10 @@ public class LoginSuccess extends DefinedPacket
// Vanilla sends true so we also send true // Vanilla sends true so we also send true
buf.writeBoolean( true ); buf.writeBoolean( true );
} }
if ( protocolVersion >= ProtocolConstants.MINECRAFT_26_2 )
{
writeUUID( sessionId, buf );
}
} }
@Override @Override
@@ -386,7 +386,7 @@ public class ServerConnector extends PacketHandler
} else } else
{ {
LoginResult loginProfile = user.getPendingConnection().getLoginProfile(); LoginResult loginProfile = user.getPendingConnection().getLoginProfile();
user.unsafe().sendPacket( new LoginSuccess( user.getRewriteId(), user.getName(), ( loginProfile == null ) ? null : loginProfile.getProperties() ) ); user.unsafe().sendPacket( new LoginSuccess( user.getRewriteId(), user.getName(), ( loginProfile == null ) ? null : loginProfile.getProperties(), user.getSessionId() ) );
user.getCh().setEncodeProtocol( Protocol.CONFIGURATION ); user.getCh().setEncodeProtocol( Protocol.CONFIGURATION );
} }
} }
@@ -131,6 +131,8 @@ public final class UserConnection implements ProxiedPlayer
private final Collection<String> permissions = new CaseInsensitiveSet(); private final Collection<String> permissions = new CaseInsensitiveSet();
/*========================================================================*/ /*========================================================================*/
@Getter @Getter
private final UUID sessionId = UUID.randomUUID();
@Getter
@Setter @Setter
private int clientEntityId; private int clientEntityId;
@Getter @Getter
@@ -621,7 +621,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
if ( getVersion() < ProtocolConstants.MINECRAFT_1_20_2 ) if ( getVersion() < ProtocolConstants.MINECRAFT_1_20_2 )
{ {
unsafe.sendPacket( new LoginSuccess( getRewriteId(), getName(), ( loginProfile == null ) ? null : loginProfile.getProperties() ) ); unsafe.sendPacket( new LoginSuccess( getRewriteId(), getName(), ( loginProfile == null ) ? null : loginProfile.getProperties(), null ) );
ch.setProtocol( Protocol.GAME ); ch.setProtocol( Protocol.GAME );
} }
finish2(); finish2();