Add optional 1.18 (21w40a) snapshot protocol support
Accessible via the net.md_5.bungee.protocol.snapshot JVM property.
This commit is contained in:
parent
c5a90475af
commit
f26f7d8809
@ -226,7 +226,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x4F ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x4F ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_15, 0x50 ),
|
map( ProtocolConstants.MINECRAFT_1_15, 0x50 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x4F ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x4F ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x59 )
|
map( ProtocolConstants.MINECRAFT_1_17, 0x59 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_18, 0x5A )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
ClearTitles.class,
|
ClearTitles.class,
|
||||||
@ -236,12 +237,14 @@ public enum Protocol
|
|||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
Subtitle.class,
|
Subtitle.class,
|
||||||
Subtitle::new,
|
Subtitle::new,
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x57 )
|
map( ProtocolConstants.MINECRAFT_1_17, 0x57 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_17, 0x58 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
TitleTimes.class,
|
TitleTimes.class,
|
||||||
TitleTimes::new,
|
TitleTimes::new,
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x5A )
|
map( ProtocolConstants.MINECRAFT_1_17, 0x5A ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_17, 0x5B )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
PlayerListHeaderFooter.class,
|
PlayerListHeaderFooter.class,
|
||||||
@ -255,7 +258,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x53 ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x53 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_15, 0x54 ),
|
map( ProtocolConstants.MINECRAFT_1_15, 0x54 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x53 ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x53 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x5E )
|
map( ProtocolConstants.MINECRAFT_1_17, 0x5E ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_17, 0x5F )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
EntityStatus.class,
|
EntityStatus.class,
|
||||||
|
@ -36,6 +36,7 @@ public class ProtocolConstants
|
|||||||
public static final int MINECRAFT_1_16_4 = 754;
|
public static final int MINECRAFT_1_16_4 = 754;
|
||||||
public static final int MINECRAFT_1_17 = 755;
|
public static final int MINECRAFT_1_17 = 755;
|
||||||
public static final int MINECRAFT_1_17_1 = 756;
|
public static final int MINECRAFT_1_17_1 = 756;
|
||||||
|
public static final int MINECRAFT_1_18 = 1073741868;
|
||||||
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;
|
||||||
|
|
||||||
@ -87,8 +88,8 @@ public class ProtocolConstants
|
|||||||
|
|
||||||
if ( SNAPSHOT_SUPPORT )
|
if ( SNAPSHOT_SUPPORT )
|
||||||
{
|
{
|
||||||
// supportedVersions.add( "1.17.x" );
|
supportedVersions.add( "1.18.x" );
|
||||||
// supportedVersionIds.add( ProtocolConstants.MINECRAFT_1_17 );
|
supportedVersionIds.add( ProtocolConstants.MINECRAFT_1_18 );
|
||||||
}
|
}
|
||||||
|
|
||||||
SUPPORTED_VERSIONS = supportedVersions.build();
|
SUPPORTED_VERSIONS = supportedVersions.build();
|
||||||
|
@ -32,6 +32,7 @@ public class Login extends DefinedPacket
|
|||||||
private int maxPlayers;
|
private int maxPlayers;
|
||||||
private String levelType;
|
private String levelType;
|
||||||
private int viewDistance;
|
private int viewDistance;
|
||||||
|
private int simulationDistance;
|
||||||
private boolean reducedDebugInfo;
|
private boolean reducedDebugInfo;
|
||||||
private boolean normalRespawn;
|
private boolean normalRespawn;
|
||||||
private boolean debug;
|
private boolean debug;
|
||||||
@ -100,6 +101,10 @@ public class Login extends DefinedPacket
|
|||||||
{
|
{
|
||||||
viewDistance = readVarInt( buf );
|
viewDistance = readVarInt( buf );
|
||||||
}
|
}
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_18 )
|
||||||
|
{
|
||||||
|
simulationDistance = readVarInt( buf );
|
||||||
|
}
|
||||||
if ( protocolVersion >= 29 )
|
if ( protocolVersion >= 29 )
|
||||||
{
|
{
|
||||||
reducedDebugInfo = buf.readBoolean();
|
reducedDebugInfo = buf.readBoolean();
|
||||||
@ -177,6 +182,10 @@ public class Login extends DefinedPacket
|
|||||||
{
|
{
|
||||||
writeVarInt( viewDistance, buf );
|
writeVarInt( viewDistance, buf );
|
||||||
}
|
}
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_18 )
|
||||||
|
{
|
||||||
|
writeVarInt( simulationDistance, buf );
|
||||||
|
}
|
||||||
if ( protocolVersion >= 29 )
|
if ( protocolVersion >= 29 )
|
||||||
{
|
{
|
||||||
buf.writeBoolean( reducedDebugInfo );
|
buf.writeBoolean( reducedDebugInfo );
|
||||||
|
@ -216,7 +216,7 @@ public class ServerConnector extends PacketHandler
|
|||||||
|
|
||||||
// Set tab list size, TODO: what shall we do about packet mutability
|
// Set tab list size, TODO: what shall we do about packet mutability
|
||||||
Login modLogin = new Login( login.getEntityId(), login.isHardcore(), login.getGameMode(), login.getPreviousGameMode(), login.getWorldNames(), login.getDimensions(), login.getDimension(), login.getWorldName(), login.getSeed(), login.getDifficulty(),
|
Login modLogin = new Login( login.getEntityId(), login.isHardcore(), login.getGameMode(), login.getPreviousGameMode(), login.getWorldNames(), login.getDimensions(), login.getDimension(), login.getWorldName(), login.getSeed(), login.getDifficulty(),
|
||||||
(byte) user.getPendingConnection().getListener().getTabListSize(), login.getLevelType(), login.getViewDistance(), login.isReducedDebugInfo(), login.isNormalRespawn(), login.isDebug(), login.isFlat() );
|
(byte) user.getPendingConnection().getListener().getTabListSize(), login.getLevelType(), login.getViewDistance(), login.getSimulationDistance(), login.isReducedDebugInfo(), login.isNormalRespawn(), login.isDebug(), login.isFlat() );
|
||||||
|
|
||||||
user.unsafe().sendPacket( modLogin );
|
user.unsafe().sendPacket( modLogin );
|
||||||
|
|
||||||
|
@ -71,6 +71,8 @@ public abstract class EntityMap
|
|||||||
case ProtocolConstants.MINECRAFT_1_17:
|
case ProtocolConstants.MINECRAFT_1_17:
|
||||||
case ProtocolConstants.MINECRAFT_1_17_1:
|
case ProtocolConstants.MINECRAFT_1_17_1:
|
||||||
return EntityMap_1_16_2.INSTANCE_1_17;
|
return EntityMap_1_16_2.INSTANCE_1_17;
|
||||||
|
case ProtocolConstants.MINECRAFT_1_18:
|
||||||
|
return EntityMap_1_16_2.INSTANCE_1_18;
|
||||||
}
|
}
|
||||||
throw new RuntimeException( "Version " + version + " has no entity map" );
|
throw new RuntimeException( "Version " + version + " has no entity map" );
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ class EntityMap_1_16_2 extends EntityMap
|
|||||||
|
|
||||||
static final EntityMap_1_16_2 INSTANCE_1_16_2 = new EntityMap_1_16_2( 0x04, 0x2D );
|
static final EntityMap_1_16_2 INSTANCE_1_16_2 = new EntityMap_1_16_2( 0x04, 0x2D );
|
||||||
static final EntityMap_1_16_2 INSTANCE_1_17 = new EntityMap_1_16_2( 0x04, 0x2D );
|
static final EntityMap_1_16_2 INSTANCE_1_17 = new EntityMap_1_16_2( 0x04, 0x2D );
|
||||||
|
static final EntityMap_1_16_2 INSTANCE_1_18 = new EntityMap_1_16_2( 0x04, 0x2D );
|
||||||
//
|
//
|
||||||
private final int spawnPlayerId;
|
private final int spawnPlayerId;
|
||||||
private final int spectateId;
|
private final int spectateId;
|
||||||
|
Loading…
Reference in New Issue
Block a user