Minecraft 1.20 support

This commit is contained in:
md_5
2023-06-08 01:30:00 +10:00
parent 188d502c59
commit 68200133b6
26 changed files with 75 additions and 52 deletions

View File

@@ -6,13 +6,13 @@
<parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-parent</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<version>1.20-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-protocol</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<version>1.20-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>BungeeCord-Protocol</name>

View File

@@ -42,6 +42,7 @@ public class ProtocolConstants
public static final int MINECRAFT_1_19_1 = 760;
public static final int MINECRAFT_1_19_3 = 761;
public static final int MINECRAFT_1_19_4 = 762;
public static final int MINECRAFT_1_20 = 763;
public static final List<String> SUPPORTED_VERSIONS;
public static final List<Integer> SUPPORTED_VERSION_IDS;
@@ -59,7 +60,8 @@ public class ProtocolConstants
"1.16.x",
"1.17.x",
"1.18.x",
"1.19.x"
"1.19.x",
"1.20.x"
);
ImmutableList.Builder<Integer> supportedVersionIds = ImmutableList.<Integer>builder().add(
ProtocolConstants.MINECRAFT_1_8,
@@ -96,13 +98,14 @@ public class ProtocolConstants
ProtocolConstants.MINECRAFT_1_19,
ProtocolConstants.MINECRAFT_1_19_1,
ProtocolConstants.MINECRAFT_1_19_3,
ProtocolConstants.MINECRAFT_1_19_4
ProtocolConstants.MINECRAFT_1_19_4,
ProtocolConstants.MINECRAFT_1_20
);
if ( SNAPSHOT_SUPPORT )
{
// supportedVersions.add( "1.19.x" );
// supportedVersionIds.add( ProtocolConstants.MINECRAFT_1_19 );
// supportedVersions.add( "1.20.x" );
// supportedVersionIds.add( ProtocolConstants.MINECRAFT_1_20 );
}
SUPPORTED_VERSIONS = supportedVersions.build();

View File

@@ -39,6 +39,7 @@ public class Login extends DefinedPacket
private boolean debug;
private boolean flat;
private Location deathLocation;
private int portalCooldown;
@Override
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
@@ -127,6 +128,10 @@ public class Login extends DefinedPacket
deathLocation = new Location( readString( buf ), buf.readLong() );
}
}
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20 )
{
portalCooldown = readVarInt( buf );
}
}
@Override
@@ -220,6 +225,10 @@ public class Login extends DefinedPacket
buf.writeBoolean( false );
}
}
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20 )
{
writeVarInt( portalCooldown, buf );
}
}
@Override

View File

@@ -29,6 +29,7 @@ public class Respawn extends DefinedPacket
private boolean flat;
private boolean copyMeta;
private Location deathLocation;
private int portalCooldown;
@Override
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
@@ -73,6 +74,10 @@ public class Respawn extends DefinedPacket
deathLocation = new Location( readString( buf ), buf.readLong() );
}
}
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20 )
{
portalCooldown = readVarInt( buf );
}
}
@Override
@@ -123,6 +128,10 @@ public class Respawn extends DefinedPacket
buf.writeBoolean( false );
}
}
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20 )
{
writeVarInt( portalCooldown, buf );
}
}
@Override