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_11 = 774;
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<Integer> SUPPORTED_VERSION_IDS;
@@ -21,6 +21,7 @@ public class LoginSuccess extends DefinedPacket
private UUID uuid;
private String username;
private Property[] properties;
private UUID sessionId;
@Override
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
buf.readBoolean();
}
if ( protocolVersion >= ProtocolConstants.MINECRAFT_26_2 )
{
sessionId = readUUID( buf );
}
}
@Override
@@ -65,6 +70,10 @@ public class LoginSuccess extends DefinedPacket
// Vanilla sends true so we also send true
buf.writeBoolean( true );
}
if ( protocolVersion >= ProtocolConstants.MINECRAFT_26_2 )
{
writeUUID( sessionId, buf );
}
}
@Override
@@ -386,7 +386,7 @@ public class ServerConnector extends PacketHandler
} else
{
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 );
}
}
@@ -131,6 +131,8 @@ public final class UserConnection implements ProxiedPlayer
private final Collection<String> permissions = new CaseInsensitiveSet();
/*========================================================================*/
@Getter
private final UUID sessionId = UUID.randomUUID();
@Getter
@Setter
private int clientEntityId;
@Getter
@@ -621,7 +621,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
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 );
}
finish2();