#3727: 24w34a snapshot support
This commit is contained in:
		| @@ -146,7 +146,8 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x41 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x43 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_3, 0x45 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x47 ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x47 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x48 ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     BossBar.class, | ||||
| @@ -206,7 +207,8 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x58 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x5A ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_3, 0x5C ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x5E ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x5E ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x60 ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     ScoreboardScore.class, | ||||
| @@ -224,13 +226,15 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x5B ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x5D ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_3, 0x5F ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x61 ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x61 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x64 ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     ScoreboardScoreReset.class, | ||||
|                     ScoreboardScoreReset::new, | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_3, 0x42 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x44 ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x44 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x45 ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     ScoreboardDisplay.class, | ||||
| @@ -248,7 +252,8 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x51 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x53 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_3, 0x55 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x57 ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x57 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x58 ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     Team.class, | ||||
| @@ -266,7 +271,8 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x5A ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x5C ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_3, 0x5E ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x60 ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x60 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x63 ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     PluginMessage.class, | ||||
| @@ -321,7 +327,8 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x5F ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x61 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_3, 0x63 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x65 ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x65 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x68 ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     ClearTitles.class, | ||||
| @@ -342,7 +349,8 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x5D ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x5F ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_3, 0x61 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x63 ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x63 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x66 ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     TitleTimes.class, | ||||
| @@ -354,7 +362,8 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x60 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x62 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_3, 0x64 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x66 ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x66 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x69 ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     SystemChat.class, | ||||
| @@ -365,7 +374,8 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x64 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x67 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_3, 0x69 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x6C ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x6C ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x6F ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     PlayerListHeaderFooter.class, | ||||
| @@ -387,7 +397,8 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x65 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x68 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_3, 0x6A ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x6D ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x6D ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x70 ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     EntityStatus.class, | ||||
| @@ -458,7 +469,8 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x45 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x47 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_3, 0x49 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x4B ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x4B ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x4C ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     PlayerListItemRemove.class, | ||||
| @@ -466,7 +478,8 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_3, 0x35 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x39 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x3B ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x3D ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x3D ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x3E ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     PlayerListItemUpdate.class, | ||||
| @@ -474,14 +487,16 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_3, 0x36 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x3A ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x3C ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x3E ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x3E ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x3F ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     StartConfiguration.class, | ||||
|                     StartConfiguration::new, | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x65 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_3, 0x67 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x69 ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x69 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x6C ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     CookieRequest.class, | ||||
| @@ -491,22 +506,26 @@ public enum Protocol | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     StoreCookie.class, | ||||
|                     StoreCookie::new, | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x6B ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x6B ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x6E ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     Transfer.class, | ||||
|                     Transfer::new, | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x73 ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x73 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x76 ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     DisconnectReportDetails.class, | ||||
|                     DisconnectReportDetails::new, | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21, 0x7A ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21, 0x7A ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x7D ) | ||||
|             ); | ||||
|             TO_CLIENT.registerPacket( | ||||
|                     ServerLinks.class, | ||||
|                     ServerLinks::new, | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21, 0x7B ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21, 0x7B ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x7E ) | ||||
|             ); | ||||
|  | ||||
|             TO_SERVER.registerPacket( | ||||
| @@ -526,7 +545,8 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x12 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x14 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_3, 0x15 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x18 ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x18 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x1A ) | ||||
|             ); | ||||
|             TO_SERVER.registerPacket( Chat.class, | ||||
|                     Chat::new, | ||||
| @@ -542,19 +562,23 @@ public enum Protocol | ||||
|                     ClientCommand::new, | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19, 0x03 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_1, 0x04 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x05 ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x05 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x06 ) | ||||
|             ); | ||||
|             TO_SERVER.registerPacket( | ||||
|                     UnsignedClientCommand.class, | ||||
|                     UnsignedClientCommand::new, | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x04 ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x04 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x05 ) | ||||
|  | ||||
|             ); | ||||
|             TO_SERVER.registerPacket( | ||||
|                     ClientChat.class, | ||||
|                     ClientChat::new, | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19, 0x04 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_1, 0x05 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x06 ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x06 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x07 ) | ||||
|             ); | ||||
|             TO_SERVER.registerPacket( | ||||
|                     TabCompleteRequest.class, | ||||
| @@ -570,7 +594,8 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_3, 0x08 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x09 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x0A ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x0B ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x0B ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x0D ) | ||||
|             ); | ||||
|             TO_SERVER.registerPacket( | ||||
|                     ClientSettings.class, | ||||
| @@ -585,7 +610,8 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_3, 0x07 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x08 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x09 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x0A ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x0A ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x0C ) | ||||
|             ); | ||||
|             TO_SERVER.registerPacket( | ||||
|                     PluginMessage.class, | ||||
| @@ -603,18 +629,21 @@ public enum Protocol | ||||
|                     map( ProtocolConstants.MINECRAFT_1_19_4, 0x0D ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x0F ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_3, 0x10 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x12 ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x12 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x14 ) | ||||
|             ); | ||||
|             TO_SERVER.registerPacket( | ||||
|                     StartConfiguration.class, | ||||
|                     StartConfiguration::new, | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_2, 0x0B ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x0C ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x0C ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x0E ) | ||||
|             ); | ||||
|             TO_SERVER.registerPacket( | ||||
|                     CookieResponse.class, | ||||
|                     CookieResponse::new, | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x11 ) | ||||
|                     map( ProtocolConstants.MINECRAFT_1_20_5, 0x11 ), | ||||
|                     map( ProtocolConstants.MINECRAFT_1_21_2, 0x13 ) | ||||
|             ); | ||||
|         } | ||||
|     }, | ||||
|   | ||||
| @@ -47,6 +47,7 @@ public class ProtocolConstants | ||||
|     public static final int MINECRAFT_1_20_3 = 765; | ||||
|     public static final int MINECRAFT_1_20_5 = 766; | ||||
|     public static final int MINECRAFT_1_21 = 767; | ||||
|     public static final int MINECRAFT_1_21_2 = 1073742030; | ||||
|     public static final List<String> SUPPORTED_VERSIONS; | ||||
|     public static final List<Integer> SUPPORTED_VERSION_IDS; | ||||
|  | ||||
| @@ -114,7 +115,7 @@ public class ProtocolConstants | ||||
|         if ( SNAPSHOT_SUPPORT ) | ||||
|         { | ||||
|             // supportedVersions.add( "1.21.x" ); | ||||
|             // supportedVersionIds.add( ProtocolConstants.MINECRAFT_1_21 ); | ||||
|             supportedVersionIds.add( ProtocolConstants.MINECRAFT_1_21_2 ); | ||||
|         } | ||||
|  | ||||
|         SUPPORTED_VERSIONS = supportedVersions.build(); | ||||
|   | ||||
| @@ -25,6 +25,7 @@ public class ClientSettings extends DefinedPacket | ||||
|     private int mainHand; | ||||
|     private boolean disableTextFiltering; | ||||
|     private boolean allowServerListing; | ||||
|     private ParticleStatus particleStatus; | ||||
|  | ||||
|     @Override | ||||
|     public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) | ||||
| @@ -46,6 +47,10 @@ public class ClientSettings extends DefinedPacket | ||||
|         { | ||||
|             allowServerListing = buf.readBoolean(); | ||||
|         } | ||||
|         if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_21_2 ) | ||||
|         { | ||||
|             particleStatus = ParticleStatus.values()[readVarInt( buf )]; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -74,6 +79,10 @@ public class ClientSettings extends DefinedPacket | ||||
|         { | ||||
|             buf.writeBoolean( allowServerListing ); | ||||
|         } | ||||
|         if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_21_2 ) | ||||
|         { | ||||
|             writeVarInt( particleStatus.ordinal(), buf ); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -81,4 +90,11 @@ public class ClientSettings extends DefinedPacket | ||||
|     { | ||||
|         handler.handle( this ); | ||||
|     } | ||||
|  | ||||
|     public enum ParticleStatus | ||||
|     { | ||||
|         ALL, | ||||
|         DECREASED, | ||||
|         MINIMAL; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -41,6 +41,7 @@ public class Login extends DefinedPacket | ||||
|     private boolean flat; | ||||
|     private Location deathLocation; | ||||
|     private int portalCooldown; | ||||
|     private int seaLevel; | ||||
|     private boolean secureProfile; | ||||
|  | ||||
|     @Override | ||||
| @@ -161,7 +162,10 @@ public class Login extends DefinedPacket | ||||
|         { | ||||
|             portalCooldown = readVarInt( buf ); | ||||
|         } | ||||
|  | ||||
|         if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_21_2 ) | ||||
|         { | ||||
|             seaLevel = readVarInt( buf ); | ||||
|         } | ||||
|         if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 ) | ||||
|         { | ||||
|             secureProfile = buf.readBoolean(); | ||||
| @@ -293,7 +297,10 @@ public class Login extends DefinedPacket | ||||
|         { | ||||
|             writeVarInt( portalCooldown, buf ); | ||||
|         } | ||||
|  | ||||
|         if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_21_2 ) | ||||
|         { | ||||
|             writeVarInt( seaLevel, buf ); | ||||
|         } | ||||
|         if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 ) | ||||
|         { | ||||
|             buf.writeBoolean( secureProfile ); | ||||
|   | ||||
| @@ -145,5 +145,8 @@ public class PlayerListItem extends DefinedPacket | ||||
|         // ADD_PLAYER & UPDATE_DISPLAY_NAME | ||||
|         BaseComponent displayName; | ||||
|  | ||||
|         // UPDATE_LIST_ORDER 1.21.2 | ||||
|         Integer listOrder; | ||||
|  | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -61,6 +61,9 @@ public class PlayerListItemUpdate extends DefinedPacket | ||||
|                             item.displayName = DefinedPacket.readBaseComponent( buf, protocolVersion ); | ||||
|                         } | ||||
|                         break; | ||||
|                     case UPDATE_LIST_ORDER: | ||||
|                         item.listOrder = DefinedPacket.readVarInt( buf ); | ||||
|                         break; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| @@ -109,6 +112,9 @@ public class PlayerListItemUpdate extends DefinedPacket | ||||
|                             DefinedPacket.writeBaseComponent( item.displayName, buf, protocolVersion ); | ||||
|                         } | ||||
|                         break; | ||||
|                     case UPDATE_LIST_ORDER: | ||||
|                         DefinedPacket.writeVarInt( item.listOrder, buf ); | ||||
|                         break; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| @@ -128,6 +134,7 @@ public class PlayerListItemUpdate extends DefinedPacket | ||||
|         UPDATE_GAMEMODE, | ||||
|         UPDATE_LISTED, | ||||
|         UPDATE_LATENCY, | ||||
|         UPDATE_DISPLAY_NAME; | ||||
|         UPDATE_DISPLAY_NAME, | ||||
|         UPDATE_LIST_ORDER; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -30,6 +30,7 @@ public class Respawn extends DefinedPacket | ||||
|     private byte copyMeta; | ||||
|     private Location deathLocation; | ||||
|     private int portalCooldown; | ||||
|     private int seaLevel; | ||||
|  | ||||
|     @Override | ||||
|     public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) | ||||
| @@ -84,6 +85,10 @@ public class Respawn extends DefinedPacket | ||||
|         { | ||||
|             portalCooldown = readVarInt( buf ); | ||||
|         } | ||||
|         if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_21_2 ) | ||||
|         { | ||||
|             seaLevel = readVarInt( buf ); | ||||
|         } | ||||
|         if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_2 ) | ||||
|         { | ||||
|             copyMeta = buf.readByte(); | ||||
| @@ -148,6 +153,10 @@ public class Respawn extends DefinedPacket | ||||
|         { | ||||
|             writeVarInt( portalCooldown, buf ); | ||||
|         } | ||||
|         if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_21_2 ) | ||||
|         { | ||||
|             writeVarInt( seaLevel, buf ); | ||||
|         } | ||||
|         if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_2 ) | ||||
|         { | ||||
|             buf.writeByte( copyMeta ); | ||||
|   | ||||
| @@ -252,7 +252,7 @@ public class ServerConnector extends PacketHandler | ||||
|             // 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(), | ||||
|                     (byte) user.getPendingConnection().getListener().getTabListSize(), login.getLevelType(), login.getViewDistance(), login.getSimulationDistance(), login.isReducedDebugInfo(), login.isNormalRespawn(), login.isLimitedCrafting(), login.isDebug(), login.isFlat(), login.getDeathLocation(), | ||||
|                     login.getPortalCooldown(), login.isSecureProfile() ); | ||||
|                     login.getPortalCooldown(), login.getSeaLevel(), login.isSecureProfile() ); | ||||
|  | ||||
|             user.unsafe().sendPacket( modLogin ); | ||||
|  | ||||
| @@ -270,7 +270,7 @@ public class ServerConnector extends PacketHandler | ||||
|                 user.getSentBossBars().clear(); | ||||
|  | ||||
|                 user.unsafe().sendPacket( new Respawn( login.getDimension(), login.getWorldName(), login.getSeed(), login.getDifficulty(), login.getGameMode(), login.getPreviousGameMode(), login.getLevelType(), login.isDebug(), login.isFlat(), (byte) 0, login.getDeathLocation(), | ||||
|                         login.getPortalCooldown() ) ); | ||||
|                         login.getPortalCooldown(), login.getSeaLevel() ) ); | ||||
|             } else | ||||
|             { | ||||
|                 user.unsafe().sendPacket( BungeeCord.getInstance().registerChannels( user.getPendingConnection().getVersion() ) ); | ||||
| @@ -332,12 +332,12 @@ public class ServerConnector extends PacketHandler | ||||
|             if ( login.getDimension() == user.getDimension() ) | ||||
|             { | ||||
|                 user.unsafe().sendPacket( new Respawn( (Integer) login.getDimension() >= 0 ? -1 : 0, login.getWorldName(), login.getSeed(), login.getDifficulty(), login.getGameMode(), login.getPreviousGameMode(), login.getLevelType(), login.isDebug(), login.isFlat(), | ||||
|                         (byte) 0, login.getDeathLocation(), login.getPortalCooldown() ) ); | ||||
|                         (byte) 0, login.getDeathLocation(), login.getPortalCooldown(), login.getSeaLevel() ) ); | ||||
|             } | ||||
|  | ||||
|             user.setServerEntityId( login.getEntityId() ); | ||||
|             user.unsafe().sendPacket( new Respawn( login.getDimension(), login.getWorldName(), login.getSeed(), login.getDifficulty(), login.getGameMode(), login.getPreviousGameMode(), login.getLevelType(), login.isDebug(), login.isFlat(), | ||||
|                     (byte) 0, login.getDeathLocation(), login.getPortalCooldown() ) ); | ||||
|                     (byte) 0, login.getDeathLocation(), login.getPortalCooldown(), login.getSeaLevel() ) ); | ||||
|             if ( user.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_14 ) | ||||
|             { | ||||
|                 user.unsafe().sendPacket( new ViewDistance( login.getViewDistance() ) ); | ||||
|   | ||||
| @@ -89,6 +89,8 @@ public abstract class EntityMap | ||||
|             case ProtocolConstants.MINECRAFT_1_20_5: | ||||
|             case ProtocolConstants.MINECRAFT_1_21: | ||||
|                 return EntityMap_1_16_2.INSTANCE_1_20_5; | ||||
|             case ProtocolConstants.MINECRAFT_1_21_2: | ||||
|                 return EntityMap_1_16_2.INSTANCE_1_21_2; | ||||
|         } | ||||
|         throw new RuntimeException( "Version " + version + " has no entity map" ); | ||||
|     } | ||||
|   | ||||
| @@ -23,6 +23,7 @@ class EntityMap_1_16_2 extends EntityMap | ||||
|     static final EntityMap_1_16_2 INSTANCE_1_20_2 = new EntityMap_1_16_2( -1, 0x33 ); | ||||
|     static final EntityMap_1_16_2 INSTANCE_1_20_3 = new EntityMap_1_16_2( -1, 0x34 ); | ||||
|     static final EntityMap_1_16_2 INSTANCE_1_20_5 = new EntityMap_1_16_2( -1, 0x37 ); | ||||
|     static final EntityMap_1_16_2 INSTANCE_1_21_2 = new EntityMap_1_16_2( -1, 0x39 ); | ||||
|     // | ||||
|     private final int spawnPlayerId; | ||||
|     private final int spectateId; | ||||
| @@ -31,6 +32,10 @@ class EntityMap_1_16_2 extends EntityMap | ||||
|     @SuppressFBWarnings("DLS_DEAD_LOCAL_STORE") | ||||
|     public void rewriteClientbound(ByteBuf packet, int oldId, int newId, int protocolVersion) | ||||
|     { | ||||
|         if ( spawnPlayerId == -1 ) | ||||
|         { | ||||
|             return; | ||||
|         } | ||||
|         // Special cases | ||||
|         int readerIndex = packet.readerIndex(); | ||||
|         int packetId = DefinedPacket.readVarInt( packet ); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Outfluencer
					Outfluencer