Minecraft 24w07a support

This commit is contained in:
md_5 2024-02-27 21:36:16 +11:00
parent 3e9a7e45c4
commit 7606d4437b
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11
4 changed files with 24 additions and 6 deletions

View File

@ -45,7 +45,7 @@ public class ProtocolConstants
public static final int MINECRAFT_1_20 = 763; public static final int MINECRAFT_1_20 = 763;
public static final int MINECRAFT_1_20_2 = 764; public static final int MINECRAFT_1_20_2 = 764;
public static final int MINECRAFT_1_20_3 = 765; public static final int MINECRAFT_1_20_3 = 765;
public static final int MINECRAFT_1_20_5 = 1073742000; public static final int MINECRAFT_1_20_5 = 1073742001;
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;

View File

@ -133,7 +133,13 @@ public class Login extends DefinedPacket
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_2 ) if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_2 )
{ {
limitedCrafting = buf.readBoolean(); limitedCrafting = buf.readBoolean();
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 )
{
dimension = readVarInt( buf );
} else
{
dimension = readString( buf ); dimension = readString( buf );
}
worldName = readString( buf ); worldName = readString( buf );
seed = buf.readLong(); seed = buf.readLong();
gameMode = buf.readUnsignedByte(); gameMode = buf.readUnsignedByte();
@ -254,7 +260,13 @@ public class Login extends DefinedPacket
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_2 ) if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_2 )
{ {
buf.writeBoolean( limitedCrafting ); buf.writeBoolean( limitedCrafting );
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 )
{
writeVarInt( (Integer) dimension, buf );
} else
{
writeString( (String) dimension, buf ); writeString( (String) dimension, buf );
}
writeString( worldName, buf ); writeString( worldName, buf );
buf.writeLong( seed ); buf.writeLong( seed );
buf.writeByte( gameMode ); buf.writeByte( gameMode );

View File

@ -36,7 +36,10 @@ public class Respawn extends DefinedPacket
{ {
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 ) if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
{ {
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16_2 && protocolVersion < ProtocolConstants.MINECRAFT_1_19 ) if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 )
{
dimension = readVarInt( buf );
} else if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16_2 && protocolVersion < ProtocolConstants.MINECRAFT_1_19 )
{ {
dimension = readTag( buf, protocolVersion ); dimension = readTag( buf, protocolVersion );
} else } else
@ -92,7 +95,10 @@ public class Respawn extends DefinedPacket
{ {
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 ) if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
{ {
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16_2 && protocolVersion < ProtocolConstants.MINECRAFT_1_19 ) if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 )
{
writeVarInt( (Integer) dimension, buf );
} else if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16_2 && protocolVersion < ProtocolConstants.MINECRAFT_1_19 )
{ {
writeTag( (Tag) dimension, buf, protocolVersion ); writeTag( (Tag) dimension, buf, protocolVersion );
} else } else

View File

@ -243,7 +243,7 @@ public class ServerConnector extends PacketHandler
user.getForgeClientHandler().setHandshakeComplete(); user.getForgeClientHandler().setHandshakeComplete();
} }
if ( user.getServer() == null || !( login.getDimension() instanceof Integer ) ) if ( user.getServer() == null || user.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_16 )
{ {
// Once again, first connection // Once again, first connection
user.setClientEntityId( login.getEntityId() ); user.setClientEntityId( login.getEntityId() );