From 0626888197a14e7b93a9d7a841953bf86551483f Mon Sep 17 00:00:00 2001 From: ice_iix Date: Sat, 27 Jun 2020 18:39:59 -0700 Subject: [PATCH] 1.16.1 protocol support (736) (#345) * Update shifted packet ids * Add new smithing recipe type * Also support 1.16 (735), same packets as 1.16.1 (736) New packets: * GenerateStructure New packet variants: * UseEntity_Sneakflag, split from UseEntity_Hand * ClientAbilities_u8, split from ClientAbilities_f32 * UpdateJigsawBlock_Joint, split from UpdateJigsawBlock_Type * ServerMessage_Sender, split from ServerMessage_Position * ChunkData_Biomes3D_bool, split from ChunkData_Biomes3D * JoinGame_WorldNames, split from JoinGame_HashedSeed_Respawn * Respawn_WorldName, split from Respawn_Gamemode * EntityEquipment_VarInt renamed * UpdateLight_WithTrust, split from UpdateLight_NoTrust * LoginSuccess_UUID, split from LoginSuccess_String --- README.md | 2 + protocol/src/protocol/mod.rs | 5 +- protocol/src/protocol/packet.rs | 132 ++++++++++++++-- protocol/src/protocol/versions.rs | 5 + protocol/src/protocol/versions/v15w39c.rs | 12 +- protocol/src/protocol/versions/v18w50a.rs | 14 +- protocol/src/protocol/versions/v19w02a.rs | 14 +- protocol/src/protocol/versions/v1_10_2.rs | 12 +- protocol/src/protocol/versions/v1_11_2.rs | 12 +- protocol/src/protocol/versions/v1_12_2.rs | 12 +- protocol/src/protocol/versions/v1_13_2.rs | 12 +- protocol/src/protocol/versions/v1_14.rs | 16 +- protocol/src/protocol/versions/v1_14_1.rs | 16 +- protocol/src/protocol/versions/v1_14_2.rs | 16 +- protocol/src/protocol/versions/v1_14_3.rs | 16 +- protocol/src/protocol/versions/v1_14_4.rs | 16 +- protocol/src/protocol/versions/v1_15.rs | 14 +- protocol/src/protocol/versions/v1_16_1.rs | 178 ++++++++++++++++++++++ protocol/src/protocol/versions/v1_7_10.rs | 6 +- protocol/src/protocol/versions/v1_8_9.rs | 8 +- protocol/src/protocol/versions/v1_9.rs | 12 +- protocol/src/protocol/versions/v1_9_2.rs | 12 +- src/server/mod.rs | 62 +++++++- 23 files changed, 475 insertions(+), 129 deletions(-) create mode 100644 protocol/src/protocol/versions/v1_16_1.rs diff --git a/README.md b/README.md index 4c89935..d82eb85 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ Join with your favorite IRC client or [Matrix](https://matrix.to/#/#_espernet_#s | Game version | Protocol version | Supported? | | ------ | --- | --- | +| 1.16.1 | 736 | ✓ | +| 1.16 | 735 | ✓ | | 1.15.2 | 578 | ✓ | | 1.15.1 | 575 | ✓ | | 1.14.4 | 498 | ✓ | diff --git a/protocol/src/protocol/mod.rs b/protocol/src/protocol/mod.rs index 69b01bb..62d0acf 100644 --- a/protocol/src/protocol/mod.rs +++ b/protocol/src/protocol/mod.rs @@ -43,8 +43,9 @@ use std::net::TcpStream; use std::sync::atomic::{AtomicBool, AtomicI32, Ordering}; use std::time::{Duration, Instant}; -pub const SUPPORTED_PROTOCOLS: [i32; 19] = [ - 578, 575, 498, 490, 485, 480, 477, 452, 451, 404, 340, 316, 315, 210, 109, 107, 74, 47, 5, +pub const SUPPORTED_PROTOCOLS: [i32; 21] = [ + 736, 735, 578, 575, 498, 490, 485, 480, 477, 452, 451, 404, 340, 316, 315, 210, 109, 107, 74, + 47, 5, ]; static CURRENT_PROTOCOL_VERSION: AtomicI32 = AtomicI32::new(SUPPORTED_PROTOCOLS[0]); diff --git a/protocol/src/protocol/packet.rs b/protocol/src/protocol/packet.rs index 336e66e..39cddc8 100644 --- a/protocol/src/protocol/packet.rs +++ b/protocol/src/protocol/packet.rs @@ -179,13 +179,22 @@ state_packets!( } /// UseEntity is sent when the user interacts (right clicks) or attacks /// (left clicks) an entity. - packet UseEntity { + packet UseEntity_Sneakflag { field target_id: VarInt =, field ty: VarInt =, - field target_x: f32 = when(|p: &UseEntity| p.ty.0 == 2), - field target_y: f32 = when(|p: &UseEntity| p.ty.0 == 2), - field target_z: f32 = when(|p: &UseEntity| p.ty.0 == 2), - field hand: VarInt = when(|p: &UseEntity| p.ty.0 == 0 || p.ty.0 == 2), + field target_x: f32 = when(|p: &UseEntity_Sneakflag| p.ty.0 == 2), + field target_y: f32 = when(|p: &UseEntity_Sneakflag| p.ty.0 == 2), + field target_z: f32 = when(|p: &UseEntity_Sneakflag| p.ty.0 == 2), + field hand: VarInt = when(|p: &UseEntity_Sneakflag| p.ty.0 == 0 || p.ty.0 == 2), + field sneaking: bool =, + } + packet UseEntity_Hand { + field target_id: VarInt =, + field ty: VarInt =, + field target_x: f32 = when(|p: &UseEntity_Hand| p.ty.0 == 2), + field target_y: f32 = when(|p: &UseEntity_Hand| p.ty.0 == 2), + field target_z: f32 = when(|p: &UseEntity_Hand| p.ty.0 == 2), + field hand: VarInt = when(|p: &UseEntity_Hand| p.ty.0 == 0 || p.ty.0 == 2), } packet UseEntity_Handsfree { field target_id: VarInt =, @@ -198,6 +207,12 @@ state_packets!( field target_id: i32 =, field ty: u8 =, } + /// Sent when Generate is pressed on the Jigsaw Block interface. + packet GenerateStructure { + field location: Position =, + field levels: VarInt =, + field keep_jigsaws: bool =, + } /// KeepAliveServerbound is sent by a client as a response to a /// KeepAliveClientbound. If the client doesn't reply the server /// may disconnect the client. @@ -280,11 +295,14 @@ state_packets!( } /// ClientAbilities is used to modify the players current abilities. /// Currently flying is the only one - packet ClientAbilities { + packet ClientAbilities_f32 { field flags: u8 =, field flying_speed: f32 =, field walking_speed: f32 =, } + packet ClientAbilities_u8 { + field flags: u8 =, + } /// PlayerDigging is sent when the client starts/stops digging a block. /// It also can be sent for droppping items and eating/shooting. packet PlayerDigging { @@ -381,7 +399,15 @@ state_packets!( field slot: i16 =, field clicked_item: Option =, } - packet UpdateJigsawBlock { + packet UpdateJigsawBlock_Joint { + field location: Position =, + field name: String =, + field target: String =, + field pool: String =, + field final_state: String =, + field joint_type: String =, + } + packet UpdateJigsawBlock_Type { field location: Position =, field attachment_type: String =, field target_pool: String =, @@ -840,7 +866,13 @@ state_packets!( /// ServerMessage is a message sent by the server. It could be from a player /// or just a system message. The Type field controls the location the /// message is displayed at and when the message is displayed. - packet ServerMessage { + packet ServerMessage_Sender { + field message: format::Component =, + /// 0 - Chat message, 1 - System message, 2 - Action bar message + field position: u8 =, + field sender: UUID =, + } + packet ServerMessage_Position { field message: format::Component =, /// 0 - Chat message, 1 - System message, 2 - Action bar message field position: u8 =, @@ -1015,6 +1047,17 @@ state_packets!( } /// ChunkData sends or updates a single chunk on the client. If New is set /// then biome data should be sent too. + packet ChunkData_Biomes3D_bool { + field chunk_x: i32 =, + field chunk_z: i32 =, + field new: bool =, + field ignore_old_data: bool =, + field bitmask: VarInt =, + field heightmaps: Option =, + field biomes: Biomes3D = when(|p: &ChunkData_Biomes3D_bool| p.new), + field data: LenPrefixedBytes =, + field block_entities: LenPrefixed> =, + } packet ChunkData_Biomes3D { field chunk_x: i32 =, field chunk_z: i32 =, @@ -1157,6 +1200,38 @@ state_packets!( } /// JoinGame is sent after completing the login process. This /// sets the initial state for the client. + packet JoinGame_WorldNames { + /// The entity id the client will be referenced by + field entity_id: i32 =, + /// The starting gamemode of the client + field gamemode: u8 =, + /// The previous gamemode of the client + field previous_gamemode: u8 =, + /// Identifiers for all worlds on the server + field world_names: LenPrefixed =, + /// Represents a dimension registry + field dimension_codec: Option =, + /// The dimension the client is starting in + field dimension: String =, + /// The world being spawned into + field world_name: String =, + /// Truncated SHA-256 hash of world's seed + field hashed_seed: i64 =, + /// The max number of players on the server + field max_players: u8 =, + /// The render distance (2-32) + field view_distance: VarInt =, + /// Whether the client should reduce the amount of debug + /// information it displays in F3 mode + field reduced_debug_info: bool =, + /// Whether to prompt or immediately respawn + field enable_respawn_screen: bool =, + /// Whether the world is in debug mode + field is_debug: bool =, + /// Whether the world is a superflat world + field is_flat: bool =, + } + packet JoinGame_HashedSeed_Respawn { /// The entity id the client will be referenced by field entity_id: i32 =, @@ -1476,7 +1551,7 @@ state_packets!( field hash: String =, } /// Respawn is sent to respawn the player after death or when they move worlds. - packet Respawn { + packet Respawn_Gamemode { field dimension: i32 =, field difficulty: u8 =, field gamemode: u8 =, @@ -1489,6 +1564,16 @@ state_packets!( field gamemode: u8 =, field level_type: String =, } + packet Respawn_WorldName { + field dimension: String =, + field world_name: String =, + field hashed_seed: i64 =, + field gamemode: u8 =, + field previous_gamemode: u8 =, + field is_debug: bool =, + field is_flat: bool =, + field copy_metadata: bool =, + } /// EntityHeadLook rotates an entity's head to the new angle. packet EntityHeadLook { field entity_id: VarInt =, @@ -1583,7 +1668,7 @@ state_packets!( /// EntityEquipment is sent to display an item on an entity, like a sword /// or armor. Slot 0 is the held item and slots 1 to 4 are boots, leggings /// chestplate and helmet respectively. - packet EntityEquipment { + packet EntityEquipment_VarInt { field entity_id: VarInt =, field slot: VarInt =, field item: Option =, @@ -1880,7 +1965,16 @@ state_packets!( field status: VarInt =, field successful: bool =, } - packet UpdateLight { + packet UpdateLight_WithTrust { + field chunk_x: VarInt =, + field chunk_z: VarInt =, + field trust_edges: bool =, + field sky_light_mask: VarInt =, + field block_light_mask: VarInt =, + field empty_sky_light_mask: VarInt =, + field light_arrays: Vec =, + } + packet UpdateLight_NoTrust { field chunk_x: VarInt =, field chunk_z: VarInt =, field sky_light_mask: VarInt =, @@ -1965,11 +2059,15 @@ state_packets!( /// LoginSuccess is sent by the server if the player successfully /// authenicates with the session servers (online mode) or straight /// after LoginStart (offline mode). - packet LoginSuccess { + packet LoginSuccess_String { /// String encoding of a uuid (with hyphens) field uuid: String =, field username: String =, } + packet LoginSuccess_UUID { + field uuid: UUID =, + field username: String =, + } /// SetInitialCompression sets the compression threshold during the /// login state. packet SetInitialCompression { @@ -2590,6 +2688,11 @@ pub enum RecipeData { ingredient: RecipeIngredient, result: Option, }, + Smithing { + base: RecipeIngredient, + addition: RecipeIngredient, + result: Option, + }, } impl Default for RecipeData { @@ -2704,6 +2807,11 @@ impl Serializable for Recipe { ingredient: Serializable::read_from(buf)?, result: Serializable::read_from(buf)?, }, + "minecraft:smithing" => RecipeData::Smithing { + base: Serializable::read_from(buf)?, + addition: Serializable::read_from(buf)?, + result: Serializable::read_from(buf)?, + }, _ => panic!("unrecognized recipe type: {}", ty), }; diff --git a/protocol/src/protocol/versions.rs b/protocol/src/protocol/versions.rs index cd8f2e0..0033477 100644 --- a/protocol/src/protocol/versions.rs +++ b/protocol/src/protocol/versions.rs @@ -13,6 +13,7 @@ mod v1_14_2; mod v1_14_3; mod v1_14_4; mod v1_15; +mod v1_16_1; mod v1_7_10; mod v1_8_9; mod v1_9; @@ -24,6 +25,8 @@ mod v1_9_2; pub fn protocol_name_to_protocol_version(s: String) -> i32 { match s.as_ref() { "" => SUPPORTED_PROTOCOLS[0], + "1.16.1" => 736, + "1.16" => 735, "1.15.2" => 578, "1.15.1" => 575, "1.14.4" => 498, @@ -61,6 +64,8 @@ pub fn translate_internal_packet_id_for_version( to_internal: bool, ) -> i32 { match version { + 736 => v1_16_1::translate_internal_packet_id(state, dir, id, to_internal), + 735 => v1_16_1::translate_internal_packet_id(state, dir, id, to_internal), 578 => v1_15::translate_internal_packet_id(state, dir, id, to_internal), 575 => v1_15::translate_internal_packet_id(state, dir, id, to_internal), 498 => v1_14_4::translate_internal_packet_id(state, dir, id, to_internal), diff --git a/protocol/src/protocol/versions/v15w39c.rs b/protocol/src/protocol/versions/v15w39c.rs index f12dbda..a76c075 100644 --- a/protocol/src/protocol/versions/v15w39c.rs +++ b/protocol/src/protocol/versions/v15w39c.rs @@ -17,13 +17,13 @@ protocol_packet_ids!( 0x06 => ClickWindow_u8 0x07 => CloseWindow 0x08 => PluginMessageServerbound - 0x09 => UseEntity + 0x09 => UseEntity_Hand 0x0a => KeepAliveServerbound_VarInt 0x0b => PlayerPosition 0x0c => PlayerPositionLook 0x0d => PlayerLook 0x0e => Player - 0x0f => ClientAbilities + 0x0f => ClientAbilities_f32 0x10 => PlayerDigging_u8 0x11 => PlayerAction 0x12 => SteerVehicle @@ -52,7 +52,7 @@ protocol_packet_ids!( 0x0c => BossBar 0x0d => ServerDifficulty 0x0e => TabCompleteReply - 0x0f => ServerMessage + 0x0f => ServerMessage_Position 0x10 => MultiBlockChange_VarInt 0x11 => ConfirmTransaction 0x12 => WindowClose @@ -88,7 +88,7 @@ protocol_packet_ids!( 0x30 => EntityDestroy 0x31 => EntityRemoveEffect 0x32 => ResourcePackSend - 0x33 => Respawn + 0x33 => Respawn_Gamemode 0x34 => EntityHeadLook 0x35 => WorldBorder 0x36 => Camera @@ -97,7 +97,7 @@ protocol_packet_ids!( 0x39 => EntityMetadata 0x3a => EntityAttach_leashed 0x3b => EntityVelocity - 0x3c => EntityEquipment + 0x3c => EntityEquipment_VarInt 0x3d => SetExperience 0x3e => UpdateHealth 0x3f => ScoreboardObjective @@ -122,7 +122,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String 0x03 => SetInitialCompression } } diff --git a/protocol/src/protocol/versions/v18w50a.rs b/protocol/src/protocol/versions/v18w50a.rs index b153340..2b1b6bc 100644 --- a/protocol/src/protocol/versions/v18w50a.rs +++ b/protocol/src/protocol/versions/v18w50a.rs @@ -21,7 +21,7 @@ protocol_packet_ids!( 0x0a => PluginMessageServerbound 0x0b => EditBook 0x0c => QueryEntityNBT - 0x0d => UseEntity + 0x0d => UseEntity_Hand 0x0e => KeepAliveServerbound_i64 0x0f => Player 0x10 => PlayerPosition @@ -31,7 +31,7 @@ protocol_packet_ids!( 0x14 => SteerBoat 0x15 => PickItem 0x16 => CraftRecipeRequest - 0x17 => ClientAbilities + 0x17 => ClientAbilities_f32 0x18 => PlayerDigging 0x19 => PlayerAction 0x1a => SteerVehicle @@ -67,7 +67,7 @@ protocol_packet_ids!( 0x0b => BlockChange_VarInt 0x0c => BossBar 0x0d => ServerDifficulty - 0x0e => ServerMessage + 0x0e => ServerMessage_Position 0x0f => MultiBlockChange_VarInt 0x10 => TabCompleteReply 0x11 => DeclareCommands @@ -110,7 +110,7 @@ protocol_packet_ids!( 0x36 => EntityDestroy 0x37 => EntityRemoveEffect 0x38 => ResourcePackSend - 0x39 => Respawn + 0x39 => Respawn_Gamemode 0x3a => EntityHeadLook 0x3b => SelectAdvancementTab 0x3c => WorldBorder @@ -120,7 +120,7 @@ protocol_packet_ids!( 0x40 => EntityMetadata 0x41 => EntityAttach 0x42 => EntityVelocity - 0x43 => EntityEquipment + 0x43 => EntityEquipment_VarInt 0x44 => SetExperience 0x45 => UpdateHealth 0x46 => ScoreboardObjective @@ -140,7 +140,7 @@ protocol_packet_ids!( 0x55 => EntityEffect 0x56 => DeclareRecipes 0x57 => TagsWithEntities - 0x58 => UpdateLight + 0x58 => UpdateLight_NoTrust } } login Login { @@ -152,7 +152,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String 0x03 => SetInitialCompression 0x04 => LoginPluginRequest } diff --git a/protocol/src/protocol/versions/v19w02a.rs b/protocol/src/protocol/versions/v19w02a.rs index d24b82f..47c3ea6 100644 --- a/protocol/src/protocol/versions/v19w02a.rs +++ b/protocol/src/protocol/versions/v19w02a.rs @@ -21,7 +21,7 @@ protocol_packet_ids!( 0x0a => PluginMessageServerbound 0x0b => EditBook 0x0c => QueryEntityNBT - 0x0d => UseEntity + 0x0d => UseEntity_Hand 0x0e => KeepAliveServerbound_i64 0x0f => Player 0x10 => PlayerPosition @@ -31,7 +31,7 @@ protocol_packet_ids!( 0x14 => SteerBoat 0x15 => PickItem 0x16 => CraftRecipeRequest - 0x17 => ClientAbilities + 0x17 => ClientAbilities_f32 0x18 => PlayerDigging 0x19 => PlayerAction 0x1a => SteerVehicle @@ -67,7 +67,7 @@ protocol_packet_ids!( 0x0b => BlockChange_VarInt 0x0c => BossBar 0x0d => ServerDifficulty - 0x0e => ServerMessage + 0x0e => ServerMessage_Position 0x0f => MultiBlockChange_VarInt 0x10 => TabCompleteReply 0x11 => DeclareCommands @@ -110,7 +110,7 @@ protocol_packet_ids!( 0x36 => EntityDestroy 0x37 => EntityRemoveEffect 0x38 => ResourcePackSend - 0x39 => Respawn + 0x39 => Respawn_Gamemode 0x3a => EntityHeadLook 0x3b => SelectAdvancementTab 0x3c => WorldBorder @@ -120,7 +120,7 @@ protocol_packet_ids!( 0x40 => EntityMetadata 0x41 => EntityAttach 0x42 => EntityVelocity - 0x43 => EntityEquipment + 0x43 => EntityEquipment_VarInt 0x44 => SetExperience 0x45 => UpdateHealth 0x46 => ScoreboardObjective @@ -140,7 +140,7 @@ protocol_packet_ids!( 0x55 => EntityEffect 0x56 => DeclareRecipes 0x57 => TagsWithEntities - 0x58 => UpdateLight + 0x58 => UpdateLight_NoTrust 0x59 => WindowOpen_VarInt 0x5a => TradeList_WithoutRestock // TODO: without 1.14 added fields } @@ -154,7 +154,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String 0x03 => SetInitialCompression 0x04 => LoginPluginRequest } diff --git a/protocol/src/protocol/versions/v1_10_2.rs b/protocol/src/protocol/versions/v1_10_2.rs index 066006f..160d3af 100644 --- a/protocol/src/protocol/versions/v1_10_2.rs +++ b/protocol/src/protocol/versions/v1_10_2.rs @@ -18,7 +18,7 @@ protocol_packet_ids!( 0x07 => ClickWindow 0x08 => CloseWindow 0x09 => PluginMessageServerbound - 0x0a => UseEntity + 0x0a => UseEntity_Hand 0x0b => KeepAliveServerbound_VarInt 0x0c => PlayerPosition 0x0d => PlayerPositionLook @@ -26,7 +26,7 @@ protocol_packet_ids!( 0x0f => Player 0x10 => VehicleMove 0x11 => SteerBoat - 0x12 => ClientAbilities + 0x12 => ClientAbilities_f32 0x13 => PlayerDigging 0x14 => PlayerAction 0x15 => SteerVehicle @@ -55,7 +55,7 @@ protocol_packet_ids!( 0x0c => BossBar 0x0d => ServerDifficulty 0x0e => TabCompleteReply - 0x0f => ServerMessage + 0x0f => ServerMessage_Position 0x10 => MultiBlockChange_VarInt 0x11 => ConfirmTransaction 0x12 => WindowClose @@ -91,7 +91,7 @@ protocol_packet_ids!( 0x30 => EntityDestroy 0x31 => EntityRemoveEffect 0x32 => ResourcePackSend - 0x33 => Respawn + 0x33 => Respawn_Gamemode 0x34 => EntityHeadLook 0x35 => WorldBorder 0x36 => Camera @@ -100,7 +100,7 @@ protocol_packet_ids!( 0x39 => EntityMetadata 0x3a => EntityAttach 0x3b => EntityVelocity - 0x3c => EntityEquipment + 0x3c => EntityEquipment_VarInt 0x3d => SetExperience 0x3e => UpdateHealth 0x3f => ScoreboardObjective @@ -126,7 +126,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String 0x03 => SetInitialCompression } } diff --git a/protocol/src/protocol/versions/v1_11_2.rs b/protocol/src/protocol/versions/v1_11_2.rs index cf95ffe..2a06c20 100644 --- a/protocol/src/protocol/versions/v1_11_2.rs +++ b/protocol/src/protocol/versions/v1_11_2.rs @@ -18,7 +18,7 @@ protocol_packet_ids!( 0x07 => ClickWindow 0x08 => CloseWindow 0x09 => PluginMessageServerbound - 0x0a => UseEntity + 0x0a => UseEntity_Hand 0x0b => KeepAliveServerbound_VarInt 0x0c => PlayerPosition 0x0d => PlayerPositionLook @@ -26,7 +26,7 @@ protocol_packet_ids!( 0x0f => Player 0x10 => VehicleMove 0x11 => SteerBoat - 0x12 => ClientAbilities + 0x12 => ClientAbilities_f32 0x13 => PlayerDigging 0x14 => PlayerAction 0x15 => SteerVehicle @@ -55,7 +55,7 @@ protocol_packet_ids!( 0x0c => BossBar 0x0d => ServerDifficulty 0x0e => TabCompleteReply - 0x0f => ServerMessage + 0x0f => ServerMessage_Position 0x10 => MultiBlockChange_VarInt 0x11 => ConfirmTransaction 0x12 => WindowClose @@ -91,7 +91,7 @@ protocol_packet_ids!( 0x30 => EntityDestroy 0x31 => EntityRemoveEffect 0x32 => ResourcePackSend - 0x33 => Respawn + 0x33 => Respawn_Gamemode 0x34 => EntityHeadLook 0x35 => WorldBorder 0x36 => Camera @@ -100,7 +100,7 @@ protocol_packet_ids!( 0x39 => EntityMetadata 0x3a => EntityAttach 0x3b => EntityVelocity - 0x3c => EntityEquipment + 0x3c => EntityEquipment_VarInt 0x3d => SetExperience 0x3e => UpdateHealth 0x3f => ScoreboardObjective @@ -126,7 +126,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String 0x03 => SetInitialCompression } } diff --git a/protocol/src/protocol/versions/v1_12_2.rs b/protocol/src/protocol/versions/v1_12_2.rs index 679b697..27951a6 100644 --- a/protocol/src/protocol/versions/v1_12_2.rs +++ b/protocol/src/protocol/versions/v1_12_2.rs @@ -18,7 +18,7 @@ protocol_packet_ids!( 0x07 => ClickWindow 0x08 => CloseWindow 0x09 => PluginMessageServerbound - 0x0a => UseEntity + 0x0a => UseEntity_Hand 0x0b => KeepAliveServerbound_i64 0x0c => Player 0x0d => PlayerPosition @@ -27,7 +27,7 @@ protocol_packet_ids!( 0x10 => VehicleMove 0x11 => SteerBoat 0x12 => CraftRecipeRequest - 0x13 => ClientAbilities + 0x13 => ClientAbilities_f32 0x14 => PlayerDigging 0x15 => PlayerAction 0x16 => SteerVehicle @@ -58,7 +58,7 @@ protocol_packet_ids!( 0x0c => BossBar 0x0d => ServerDifficulty 0x0e => TabCompleteReply - 0x0f => ServerMessage + 0x0f => ServerMessage_Position 0x10 => MultiBlockChange_VarInt 0x11 => ConfirmTransaction 0x12 => WindowClose @@ -96,7 +96,7 @@ protocol_packet_ids!( 0x32 => EntityDestroy 0x33 => EntityRemoveEffect 0x34 => ResourcePackSend - 0x35 => Respawn + 0x35 => Respawn_Gamemode 0x36 => EntityHeadLook 0x37 => SelectAdvancementTab 0x38 => WorldBorder @@ -106,7 +106,7 @@ protocol_packet_ids!( 0x3c => EntityMetadata 0x3d => EntityAttach 0x3e => EntityVelocity - 0x3f => EntityEquipment + 0x3f => EntityEquipment_VarInt 0x40 => SetExperience 0x41 => UpdateHealth 0x42 => ScoreboardObjective @@ -133,7 +133,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String 0x03 => SetInitialCompression } } diff --git a/protocol/src/protocol/versions/v1_13_2.rs b/protocol/src/protocol/versions/v1_13_2.rs index 09f5aca..fc0a0b0 100644 --- a/protocol/src/protocol/versions/v1_13_2.rs +++ b/protocol/src/protocol/versions/v1_13_2.rs @@ -21,7 +21,7 @@ protocol_packet_ids!( 0x0a => PluginMessageServerbound 0x0b => EditBook 0x0c => QueryEntityNBT - 0x0d => UseEntity + 0x0d => UseEntity_Hand 0x0e => KeepAliveServerbound_i64 0x0f => Player 0x10 => PlayerPosition @@ -31,7 +31,7 @@ protocol_packet_ids!( 0x14 => SteerBoat 0x15 => PickItem 0x16 => CraftRecipeRequest - 0x17 => ClientAbilities + 0x17 => ClientAbilities_f32 0x18 => PlayerDigging 0x19 => PlayerAction 0x1a => SteerVehicle @@ -67,7 +67,7 @@ protocol_packet_ids!( 0x0b => BlockChange_VarInt 0x0c => BossBar 0x0d => ServerDifficulty - 0x0e => ServerMessage + 0x0e => ServerMessage_Position 0x0f => MultiBlockChange_VarInt 0x10 => TabCompleteReply 0x11 => DeclareCommands @@ -109,7 +109,7 @@ protocol_packet_ids!( 0x35 => EntityDestroy 0x36 => EntityRemoveEffect 0x37 => ResourcePackSend - 0x38 => Respawn + 0x38 => Respawn_Gamemode 0x39 => EntityHeadLook 0x3a => SelectAdvancementTab 0x3b => WorldBorder @@ -119,7 +119,7 @@ protocol_packet_ids!( 0x3f => EntityMetadata 0x40 => EntityAttach 0x41 => EntityVelocity - 0x42 => EntityEquipment + 0x42 => EntityEquipment_VarInt 0x43 => SetExperience 0x44 => UpdateHealth 0x45 => ScoreboardObjective @@ -149,7 +149,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String 0x03 => SetInitialCompression 0x04 => LoginPluginRequest } diff --git a/protocol/src/protocol/versions/v1_14.rs b/protocol/src/protocol/versions/v1_14.rs index 89b0bc4..05a19bd 100644 --- a/protocol/src/protocol/versions/v1_14.rs +++ b/protocol/src/protocol/versions/v1_14.rs @@ -22,7 +22,7 @@ protocol_packet_ids!( 0x0b => PluginMessageServerbound 0x0c => EditBook 0x0d => QueryEntityNBT - 0x0e => UseEntity + 0x0e => UseEntity_Hand 0x0f => KeepAliveServerbound_i64 0x10 => LockDifficulty 0x11 => PlayerPosition @@ -33,7 +33,7 @@ protocol_packet_ids!( 0x16 => SteerBoat 0x17 => PickItem 0x18 => CraftRecipeRequest - 0x19 => ClientAbilities + 0x19 => ClientAbilities_f32 0x1a => PlayerDigging 0x1b => PlayerAction 0x1c => SteerVehicle @@ -47,7 +47,7 @@ protocol_packet_ids!( 0x24 => UpdateCommandBlock 0x25 => UpdateCommandBlockMinecart 0x26 => CreativeInventoryAction - 0x27 => UpdateJigsawBlock + 0x27 => UpdateJigsawBlock_Type 0x28 => UpdateStructureBlock 0x29 => SetSign 0x2a => ArmSwing @@ -70,7 +70,7 @@ protocol_packet_ids!( 0x0b => BlockChange_VarInt 0x0c => BossBar 0x0d => ServerDifficulty_Locked - 0x0e => ServerMessage + 0x0e => ServerMessage_Position 0x0f => MultiBlockChange_VarInt 0x10 => TabCompleteReply 0x11 => DeclareCommands @@ -92,7 +92,7 @@ protocol_packet_ids!( 0x21 => ChunkData_HeightMap 0x22 => Effect 0x23 => Particle_Data - 0x24 => UpdateLight + 0x24 => UpdateLight_NoTrust 0x25 => JoinGame_i32_ViewDistance 0x26 => Maps 0x27 => TradeList_WithoutRestock @@ -114,7 +114,7 @@ protocol_packet_ids!( 0x37 => EntityDestroy 0x38 => EntityRemoveEffect 0x39 => ResourcePackSend - 0x3a => Respawn + 0x3a => Respawn_Gamemode 0x3b => EntityHeadLook 0x3c => SelectAdvancementTab 0x3d => WorldBorder @@ -126,7 +126,7 @@ protocol_packet_ids!( 0x43 => EntityMetadata 0x44 => EntityAttach 0x45 => EntityVelocity - 0x46 => EntityEquipment + 0x46 => EntityEquipment_VarInt 0x47 => SetExperience 0x48 => UpdateHealth 0x49 => ScoreboardObjective @@ -159,7 +159,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String 0x03 => SetInitialCompression 0x04 => LoginPluginRequest } diff --git a/protocol/src/protocol/versions/v1_14_1.rs b/protocol/src/protocol/versions/v1_14_1.rs index 89b0bc4..05a19bd 100644 --- a/protocol/src/protocol/versions/v1_14_1.rs +++ b/protocol/src/protocol/versions/v1_14_1.rs @@ -22,7 +22,7 @@ protocol_packet_ids!( 0x0b => PluginMessageServerbound 0x0c => EditBook 0x0d => QueryEntityNBT - 0x0e => UseEntity + 0x0e => UseEntity_Hand 0x0f => KeepAliveServerbound_i64 0x10 => LockDifficulty 0x11 => PlayerPosition @@ -33,7 +33,7 @@ protocol_packet_ids!( 0x16 => SteerBoat 0x17 => PickItem 0x18 => CraftRecipeRequest - 0x19 => ClientAbilities + 0x19 => ClientAbilities_f32 0x1a => PlayerDigging 0x1b => PlayerAction 0x1c => SteerVehicle @@ -47,7 +47,7 @@ protocol_packet_ids!( 0x24 => UpdateCommandBlock 0x25 => UpdateCommandBlockMinecart 0x26 => CreativeInventoryAction - 0x27 => UpdateJigsawBlock + 0x27 => UpdateJigsawBlock_Type 0x28 => UpdateStructureBlock 0x29 => SetSign 0x2a => ArmSwing @@ -70,7 +70,7 @@ protocol_packet_ids!( 0x0b => BlockChange_VarInt 0x0c => BossBar 0x0d => ServerDifficulty_Locked - 0x0e => ServerMessage + 0x0e => ServerMessage_Position 0x0f => MultiBlockChange_VarInt 0x10 => TabCompleteReply 0x11 => DeclareCommands @@ -92,7 +92,7 @@ protocol_packet_ids!( 0x21 => ChunkData_HeightMap 0x22 => Effect 0x23 => Particle_Data - 0x24 => UpdateLight + 0x24 => UpdateLight_NoTrust 0x25 => JoinGame_i32_ViewDistance 0x26 => Maps 0x27 => TradeList_WithoutRestock @@ -114,7 +114,7 @@ protocol_packet_ids!( 0x37 => EntityDestroy 0x38 => EntityRemoveEffect 0x39 => ResourcePackSend - 0x3a => Respawn + 0x3a => Respawn_Gamemode 0x3b => EntityHeadLook 0x3c => SelectAdvancementTab 0x3d => WorldBorder @@ -126,7 +126,7 @@ protocol_packet_ids!( 0x43 => EntityMetadata 0x44 => EntityAttach 0x45 => EntityVelocity - 0x46 => EntityEquipment + 0x46 => EntityEquipment_VarInt 0x47 => SetExperience 0x48 => UpdateHealth 0x49 => ScoreboardObjective @@ -159,7 +159,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String 0x03 => SetInitialCompression 0x04 => LoginPluginRequest } diff --git a/protocol/src/protocol/versions/v1_14_2.rs b/protocol/src/protocol/versions/v1_14_2.rs index 89b0bc4..05a19bd 100644 --- a/protocol/src/protocol/versions/v1_14_2.rs +++ b/protocol/src/protocol/versions/v1_14_2.rs @@ -22,7 +22,7 @@ protocol_packet_ids!( 0x0b => PluginMessageServerbound 0x0c => EditBook 0x0d => QueryEntityNBT - 0x0e => UseEntity + 0x0e => UseEntity_Hand 0x0f => KeepAliveServerbound_i64 0x10 => LockDifficulty 0x11 => PlayerPosition @@ -33,7 +33,7 @@ protocol_packet_ids!( 0x16 => SteerBoat 0x17 => PickItem 0x18 => CraftRecipeRequest - 0x19 => ClientAbilities + 0x19 => ClientAbilities_f32 0x1a => PlayerDigging 0x1b => PlayerAction 0x1c => SteerVehicle @@ -47,7 +47,7 @@ protocol_packet_ids!( 0x24 => UpdateCommandBlock 0x25 => UpdateCommandBlockMinecart 0x26 => CreativeInventoryAction - 0x27 => UpdateJigsawBlock + 0x27 => UpdateJigsawBlock_Type 0x28 => UpdateStructureBlock 0x29 => SetSign 0x2a => ArmSwing @@ -70,7 +70,7 @@ protocol_packet_ids!( 0x0b => BlockChange_VarInt 0x0c => BossBar 0x0d => ServerDifficulty_Locked - 0x0e => ServerMessage + 0x0e => ServerMessage_Position 0x0f => MultiBlockChange_VarInt 0x10 => TabCompleteReply 0x11 => DeclareCommands @@ -92,7 +92,7 @@ protocol_packet_ids!( 0x21 => ChunkData_HeightMap 0x22 => Effect 0x23 => Particle_Data - 0x24 => UpdateLight + 0x24 => UpdateLight_NoTrust 0x25 => JoinGame_i32_ViewDistance 0x26 => Maps 0x27 => TradeList_WithoutRestock @@ -114,7 +114,7 @@ protocol_packet_ids!( 0x37 => EntityDestroy 0x38 => EntityRemoveEffect 0x39 => ResourcePackSend - 0x3a => Respawn + 0x3a => Respawn_Gamemode 0x3b => EntityHeadLook 0x3c => SelectAdvancementTab 0x3d => WorldBorder @@ -126,7 +126,7 @@ protocol_packet_ids!( 0x43 => EntityMetadata 0x44 => EntityAttach 0x45 => EntityVelocity - 0x46 => EntityEquipment + 0x46 => EntityEquipment_VarInt 0x47 => SetExperience 0x48 => UpdateHealth 0x49 => ScoreboardObjective @@ -159,7 +159,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String 0x03 => SetInitialCompression 0x04 => LoginPluginRequest } diff --git a/protocol/src/protocol/versions/v1_14_3.rs b/protocol/src/protocol/versions/v1_14_3.rs index d39165c..1aa8d92 100644 --- a/protocol/src/protocol/versions/v1_14_3.rs +++ b/protocol/src/protocol/versions/v1_14_3.rs @@ -22,7 +22,7 @@ protocol_packet_ids!( 0x0b => PluginMessageServerbound 0x0c => EditBook 0x0d => QueryEntityNBT - 0x0e => UseEntity + 0x0e => UseEntity_Hand 0x0f => KeepAliveServerbound_i64 0x10 => LockDifficulty 0x11 => PlayerPosition @@ -33,7 +33,7 @@ protocol_packet_ids!( 0x16 => SteerBoat 0x17 => PickItem 0x18 => CraftRecipeRequest - 0x19 => ClientAbilities + 0x19 => ClientAbilities_f32 0x1a => PlayerDigging 0x1b => PlayerAction 0x1c => SteerVehicle @@ -47,7 +47,7 @@ protocol_packet_ids!( 0x24 => UpdateCommandBlock 0x25 => UpdateCommandBlockMinecart 0x26 => CreativeInventoryAction - 0x27 => UpdateJigsawBlock + 0x27 => UpdateJigsawBlock_Type 0x28 => UpdateStructureBlock 0x29 => SetSign 0x2a => ArmSwing @@ -70,7 +70,7 @@ protocol_packet_ids!( 0x0b => BlockChange_VarInt 0x0c => BossBar 0x0d => ServerDifficulty_Locked - 0x0e => ServerMessage + 0x0e => ServerMessage_Position 0x0f => MultiBlockChange_VarInt 0x10 => TabCompleteReply 0x11 => DeclareCommands @@ -92,7 +92,7 @@ protocol_packet_ids!( 0x21 => ChunkData_HeightMap 0x22 => Effect 0x23 => Particle_Data - 0x24 => UpdateLight + 0x24 => UpdateLight_NoTrust 0x25 => JoinGame_i32_ViewDistance 0x26 => Maps 0x27 => TradeList_WithRestock @@ -114,7 +114,7 @@ protocol_packet_ids!( 0x37 => EntityDestroy 0x38 => EntityRemoveEffect 0x39 => ResourcePackSend - 0x3a => Respawn + 0x3a => Respawn_Gamemode 0x3b => EntityHeadLook 0x3c => SelectAdvancementTab 0x3d => WorldBorder @@ -126,7 +126,7 @@ protocol_packet_ids!( 0x43 => EntityMetadata 0x44 => EntityAttach 0x45 => EntityVelocity - 0x46 => EntityEquipment + 0x46 => EntityEquipment_VarInt 0x47 => SetExperience 0x48 => UpdateHealth 0x49 => ScoreboardObjective @@ -159,7 +159,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String 0x03 => SetInitialCompression 0x04 => LoginPluginRequest } diff --git a/protocol/src/protocol/versions/v1_14_4.rs b/protocol/src/protocol/versions/v1_14_4.rs index 573749a..f518c4c 100644 --- a/protocol/src/protocol/versions/v1_14_4.rs +++ b/protocol/src/protocol/versions/v1_14_4.rs @@ -22,7 +22,7 @@ protocol_packet_ids!( 0x0b => PluginMessageServerbound 0x0c => EditBook 0x0d => QueryEntityNBT - 0x0e => UseEntity + 0x0e => UseEntity_Hand 0x0f => KeepAliveServerbound_i64 0x10 => LockDifficulty 0x11 => PlayerPosition @@ -33,7 +33,7 @@ protocol_packet_ids!( 0x16 => SteerBoat 0x17 => PickItem 0x18 => CraftRecipeRequest - 0x19 => ClientAbilities + 0x19 => ClientAbilities_f32 0x1a => PlayerDigging 0x1b => PlayerAction 0x1c => SteerVehicle @@ -47,7 +47,7 @@ protocol_packet_ids!( 0x24 => UpdateCommandBlock 0x25 => UpdateCommandBlockMinecart 0x26 => CreativeInventoryAction - 0x27 => UpdateJigsawBlock + 0x27 => UpdateJigsawBlock_Type 0x28 => UpdateStructureBlock 0x29 => SetSign 0x2a => ArmSwing @@ -70,7 +70,7 @@ protocol_packet_ids!( 0x0b => BlockChange_VarInt 0x0c => BossBar 0x0d => ServerDifficulty_Locked - 0x0e => ServerMessage + 0x0e => ServerMessage_Position 0x0f => MultiBlockChange_VarInt 0x10 => TabCompleteReply 0x11 => DeclareCommands @@ -92,7 +92,7 @@ protocol_packet_ids!( 0x21 => ChunkData_HeightMap 0x22 => Effect 0x23 => Particle_Data - 0x24 => UpdateLight + 0x24 => UpdateLight_NoTrust 0x25 => JoinGame_i32_ViewDistance 0x26 => Maps 0x27 => TradeList_WithRestock @@ -114,7 +114,7 @@ protocol_packet_ids!( 0x37 => EntityDestroy 0x38 => EntityRemoveEffect 0x39 => ResourcePackSend - 0x3a => Respawn + 0x3a => Respawn_Gamemode 0x3b => EntityHeadLook 0x3c => SelectAdvancementTab 0x3d => WorldBorder @@ -126,7 +126,7 @@ protocol_packet_ids!( 0x43 => EntityMetadata 0x44 => EntityAttach 0x45 => EntityVelocity - 0x46 => EntityEquipment + 0x46 => EntityEquipment_VarInt 0x47 => SetExperience 0x48 => UpdateHealth 0x49 => ScoreboardObjective @@ -160,7 +160,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String 0x03 => SetInitialCompression 0x04 => LoginPluginRequest } diff --git a/protocol/src/protocol/versions/v1_15.rs b/protocol/src/protocol/versions/v1_15.rs index 81312be..9ccc921 100644 --- a/protocol/src/protocol/versions/v1_15.rs +++ b/protocol/src/protocol/versions/v1_15.rs @@ -22,7 +22,7 @@ protocol_packet_ids!( 0x0b => PluginMessageServerbound 0x0c => EditBook 0x0d => QueryEntityNBT - 0x0e => UseEntity + 0x0e => UseEntity_Hand 0x0f => KeepAliveServerbound_i64 0x10 => LockDifficulty 0x11 => PlayerPosition @@ -33,7 +33,7 @@ protocol_packet_ids!( 0x16 => SteerBoat 0x17 => PickItem 0x18 => CraftRecipeRequest - 0x19 => ClientAbilities + 0x19 => ClientAbilities_f32 0x1a => PlayerDigging 0x1b => PlayerAction 0x1c => SteerVehicle @@ -47,7 +47,7 @@ protocol_packet_ids!( 0x24 => UpdateCommandBlock 0x25 => UpdateCommandBlockMinecart 0x26 => CreativeInventoryAction - 0x27 => UpdateJigsawBlock + 0x27 => UpdateJigsawBlock_Type 0x28 => UpdateStructureBlock 0x29 => SetSign 0x2a => ArmSwing @@ -71,7 +71,7 @@ protocol_packet_ids!( 0x0c => BlockChange_VarInt 0x0d => BossBar 0x0e => ServerDifficulty_Locked - 0x0f => ServerMessage + 0x0f => ServerMessage_Position 0x10 => MultiBlockChange_VarInt 0x11 => TabCompleteReply 0x12 => DeclareCommands @@ -93,7 +93,7 @@ protocol_packet_ids!( 0x22 => ChunkData_Biomes3D 0x23 => Effect 0x24 => Particle_f64 - 0x25 => UpdateLight + 0x25 => UpdateLight_NoTrust 0x26 => JoinGame_HashedSeed_Respawn 0x27 => Maps 0x28 => TradeList_WithRestock @@ -127,7 +127,7 @@ protocol_packet_ids!( 0x44 => EntityMetadata 0x45 => EntityAttach 0x46 => EntityVelocity - 0x47 => EntityEquipment + 0x47 => EntityEquipment_VarInt 0x48 => SetExperience 0x49 => UpdateHealth 0x4a => ScoreboardObjective @@ -160,7 +160,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String 0x03 => SetInitialCompression 0x04 => LoginPluginRequest } diff --git a/protocol/src/protocol/versions/v1_16_1.rs b/protocol/src/protocol/versions/v1_16_1.rs new file mode 100644 index 0000000..b24033f --- /dev/null +++ b/protocol/src/protocol/versions/v1_16_1.rs @@ -0,0 +1,178 @@ +protocol_packet_ids!( + handshake Handshaking { + serverbound Serverbound { + 0x00 => Handshake + } + clientbound Clientbound { + } + } + play Play { + serverbound Serverbound { + 0x00 => TeleportConfirm + 0x01 => QueryBlockNBT + 0x02 => SetDifficulty + 0x03 => ChatMessage + 0x04 => ClientStatus + 0x05 => ClientSettings + 0x06 => TabComplete + 0x07 => ConfirmTransactionServerbound + 0x08 => ClickWindowButton + 0x09 => ClickWindow + 0x0a => CloseWindow + 0x0b => PluginMessageServerbound + 0x0c => EditBook + 0x0d => QueryEntityNBT + 0x0e => UseEntity_Sneakflag + 0x0f => GenerateStructure + 0x10 => KeepAliveServerbound_i64 + 0x11 => LockDifficulty + 0x12 => PlayerPosition + 0x13 => PlayerPositionLook + 0x14 => PlayerLook + 0x15 => Player + 0x16 => VehicleMove + 0x17 => SteerBoat + 0x18 => PickItem + 0x19 => CraftRecipeRequest + 0x1a => ClientAbilities_u8 + 0x1b => PlayerDigging + 0x1c => PlayerAction + 0x1d => SteerVehicle + 0x1e => CraftingBookData + 0x1f => NameItem + 0x20 => ResourcePackStatus + 0x21 => AdvancementTab + 0x22 => SelectTrade + 0x23 => SetBeaconEffect + 0x24 => HeldItemChange + 0x25 => UpdateCommandBlock + 0x26 => UpdateCommandBlockMinecart + 0x27 => CreativeInventoryAction + 0x28 => UpdateJigsawBlock_Joint + 0x29 => UpdateStructureBlock + 0x2a => SetSign + 0x2b => ArmSwing + 0x2c => SpectateTeleport + 0x2d => PlayerBlockPlacement_insideblock + 0x2e => UseItem + } + clientbound Clientbound { + 0x00 => SpawnObject_VarInt + 0x01 => SpawnExperienceOrb + 0x02 => SpawnMob_NoMeta + 0x03 => SpawnPainting_VarInt + 0x04 => SpawnPlayer_f64_NoMeta + 0x05 => Animation + 0x06 => Statistics + 0x07 => AcknowledgePlayerDigging + 0x08 => BlockBreakAnimation + 0x09 => UpdateBlockEntity + 0x0a => BlockAction + 0x0b => BlockChange_VarInt + 0x0c => BossBar + 0x0d => ServerDifficulty_Locked + 0x0e => ServerMessage_Sender + 0x0f => MultiBlockChange_VarInt + 0x10 => TabCompleteReply + 0x11 => DeclareCommands + 0x12 => ConfirmTransaction + 0x13 => WindowClose + 0x14 => WindowItems + 0x15 => WindowProperty + 0x16 => WindowSetSlot + 0x17 => SetCooldown + 0x18 => PluginMessageClientbound + 0x19 => NamedSoundEffect + 0x1a => Disconnect + 0x1b => EntityAction + 0x1c => Explosion + 0x1d => ChunkUnload + 0x1e => ChangeGameState + 0x1f => WindowOpenHorse + 0x20 => KeepAliveClientbound_i64 + 0x21 => ChunkData_Biomes3D_bool + 0x22 => Effect + 0x23 => Particle_f64 + 0x24 => UpdateLight_WithTrust + 0x25 => JoinGame_WorldNames + 0x26 => Maps + 0x27 => TradeList_WithRestock + 0x28 => EntityMove_i16 + 0x29 => EntityLookAndMove_i16 + 0x2a => EntityLook_VarInt + 0x2b => Entity + 0x2c => VehicleTeleport + 0x2d => OpenBook + 0x2e => WindowOpen_VarInt + 0x2f => SignEditorOpen + 0x30 => CraftRecipeResponse + 0x31 => PlayerAbilities + 0x32 => CombatEvent + 0x33 => PlayerInfo + 0x34 => FacePlayer + 0x35 => TeleportPlayer_WithConfirm + 0x36 => UnlockRecipes_WithSmelting + 0x37 => EntityDestroy + 0x38 => EntityRemoveEffect + 0x39 => ResourcePackSend + 0x3a => Respawn_WorldName + 0x3b => EntityHeadLook + 0x3c => SelectAdvancementTab + 0x3d => WorldBorder + 0x3e => Camera + 0x3f => SetCurrentHotbarSlot + 0x40 => UpdateViewPosition + 0x41 => UpdateViewDistance + 0x42 => SpawnPosition + 0x43 => ScoreboardDisplay + 0x44 => EntityMetadata + 0x45 => EntityAttach + 0x46 => EntityVelocity + 0x47 => EntityEquipment_VarInt // TODO: changed to an array, but earlier than 1.16.1 + 0x48 => SetExperience + 0x49 => UpdateHealth + 0x4a => ScoreboardObjective + 0x4b => SetPassengers + 0x4c => Teams_VarInt + 0x4d => UpdateScore + 0x4e => TimeUpdate + 0x4f => Title + 0x50 => EntitySoundEffect + 0x51 => SoundEffect + 0x52 => StopSound + 0x53 => PlayerListHeaderFooter + 0x54 => NBTQueryResponse + 0x55 => CollectItem + 0x56 => EntityTeleport_f64 + 0x57 => Advancements + 0x58 => EntityProperties + 0x59 => EntityEffect + 0x5a => DeclareRecipes + 0x5b => TagsWithEntities + } + } + login Login { + serverbound Serverbound { + 0x00 => LoginStart + 0x01 => EncryptionResponse + 0x02 => LoginPluginResponse + } + clientbound Clientbound { + 0x00 => LoginDisconnect + 0x01 => EncryptionRequest + 0x02 => LoginSuccess_UUID + 0x03 => SetInitialCompression + 0x04 => LoginPluginRequest + } + } + status Status { + serverbound Serverbound { + 0x00 => StatusRequest + 0x01 => StatusPing + } + clientbound Clientbound { + 0x00 => StatusResponse + 0x01 => StatusPong + } + } +); diff --git a/protocol/src/protocol/versions/v1_7_10.rs b/protocol/src/protocol/versions/v1_7_10.rs index 8da2137..d637f27 100644 --- a/protocol/src/protocol/versions/v1_7_10.rs +++ b/protocol/src/protocol/versions/v1_7_10.rs @@ -27,7 +27,7 @@ protocol_packet_ids!( 0x10 => CreativeInventoryAction 0x11 => EnchantItem 0x12 => SetSign_i16y - 0x13 => ClientAbilities + 0x13 => ClientAbilities_f32 0x14 => TabComplete_NoAssume_NoTarget 0x15 => ClientSettings_u8_Handsfree_Difficulty 0x16 => ClientStatus_u8 @@ -41,7 +41,7 @@ protocol_packet_ids!( 0x04 => EntityEquipment_u16_i32 0x05 => SpawnPosition_i32 0x06 => UpdateHealth_u16 - 0x07 => Respawn + 0x07 => Respawn_Gamemode 0x08 => TeleportPlayer_OnGround 0x09 => SetCurrentHotbarSlot 0x0a => EntityUsedBed_i32 @@ -110,7 +110,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest_i16 - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String } } status Status { diff --git a/protocol/src/protocol/versions/v1_8_9.rs b/protocol/src/protocol/versions/v1_8_9.rs index 8130a10..8b116c5 100644 --- a/protocol/src/protocol/versions/v1_8_9.rs +++ b/protocol/src/protocol/versions/v1_8_9.rs @@ -27,7 +27,7 @@ protocol_packet_ids!( 0x10 => CreativeInventoryAction 0x11 => EnchantItem 0x12 => SetSign - 0x13 => ClientAbilities + 0x13 => ClientAbilities_f32 0x14 => TabComplete_NoAssume 0x15 => ClientSettings_u8_Handsfree 0x16 => ClientStatus @@ -38,12 +38,12 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => KeepAliveClientbound_VarInt 0x01 => JoinGame_i8 - 0x02 => ServerMessage + 0x02 => ServerMessage_Position 0x03 => TimeUpdate 0x04 => EntityEquipment_u16 0x05 => SpawnPosition 0x06 => UpdateHealth - 0x07 => Respawn + 0x07 => Respawn_Gamemode 0x08 => TeleportPlayer_NoConfirm 0x09 => SetCurrentHotbarSlot 0x0a => EntityUsedBed @@ -120,7 +120,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String 0x03 => SetInitialCompression } } diff --git a/protocol/src/protocol/versions/v1_9.rs b/protocol/src/protocol/versions/v1_9.rs index dc817dc..15e1ba9 100644 --- a/protocol/src/protocol/versions/v1_9.rs +++ b/protocol/src/protocol/versions/v1_9.rs @@ -18,7 +18,7 @@ protocol_packet_ids!( 0x07 => ClickWindow 0x08 => CloseWindow 0x09 => PluginMessageServerbound - 0x0a => UseEntity + 0x0a => UseEntity_Hand 0x0b => KeepAliveServerbound_VarInt 0x0c => PlayerPosition 0x0d => PlayerPositionLook @@ -26,7 +26,7 @@ protocol_packet_ids!( 0x0f => Player 0x10 => VehicleMove 0x11 => SteerBoat - 0x12 => ClientAbilities + 0x12 => ClientAbilities_f32 0x13 => PlayerDigging 0x14 => PlayerAction 0x15 => SteerVehicle @@ -55,7 +55,7 @@ protocol_packet_ids!( 0x0c => BossBar 0x0d => ServerDifficulty 0x0e => TabCompleteReply - 0x0f => ServerMessage + 0x0f => ServerMessage_Position 0x10 => MultiBlockChange_VarInt 0x11 => ConfirmTransaction 0x12 => WindowClose @@ -91,7 +91,7 @@ protocol_packet_ids!( 0x30 => EntityDestroy 0x31 => EntityRemoveEffect 0x32 => ResourcePackSend - 0x33 => Respawn + 0x33 => Respawn_Gamemode 0x34 => EntityHeadLook 0x35 => WorldBorder 0x36 => Camera @@ -100,7 +100,7 @@ protocol_packet_ids!( 0x39 => EntityMetadata 0x3a => EntityAttach 0x3b => EntityVelocity - 0x3c => EntityEquipment + 0x3c => EntityEquipment_VarInt 0x3d => SetExperience 0x3e => UpdateHealth 0x3f => ScoreboardObjective @@ -127,7 +127,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String 0x03 => SetInitialCompression } } diff --git a/protocol/src/protocol/versions/v1_9_2.rs b/protocol/src/protocol/versions/v1_9_2.rs index 9ee61b3..b987779 100644 --- a/protocol/src/protocol/versions/v1_9_2.rs +++ b/protocol/src/protocol/versions/v1_9_2.rs @@ -18,7 +18,7 @@ protocol_packet_ids!( 0x07 => ClickWindow 0x08 => CloseWindow 0x09 => PluginMessageServerbound - 0x0a => UseEntity + 0x0a => UseEntity_Hand 0x0b => KeepAliveServerbound_VarInt 0x0c => PlayerPosition 0x0d => PlayerPositionLook @@ -26,7 +26,7 @@ protocol_packet_ids!( 0x0f => Player 0x10 => VehicleMove 0x11 => SteerBoat - 0x12 => ClientAbilities + 0x12 => ClientAbilities_f32 0x13 => PlayerDigging 0x14 => PlayerAction 0x15 => SteerVehicle @@ -55,7 +55,7 @@ protocol_packet_ids!( 0x0c => BossBar 0x0d => ServerDifficulty 0x0e => TabCompleteReply - 0x0f => ServerMessage + 0x0f => ServerMessage_Position 0x10 => MultiBlockChange_VarInt 0x11 => ConfirmTransaction 0x12 => WindowClose @@ -91,7 +91,7 @@ protocol_packet_ids!( 0x30 => EntityDestroy 0x31 => EntityRemoveEffect 0x32 => ResourcePackSend - 0x33 => Respawn + 0x33 => Respawn_Gamemode 0x34 => EntityHeadLook 0x35 => WorldBorder 0x36 => Camera @@ -100,7 +100,7 @@ protocol_packet_ids!( 0x39 => EntityMetadata 0x3a => EntityAttach 0x3b => EntityVelocity - 0x3c => EntityEquipment + 0x3c => EntityEquipment_VarInt 0x3d => SetExperience 0x3e => UpdateHealth 0x3f => ScoreboardObjective @@ -127,7 +127,7 @@ protocol_packet_ids!( clientbound Clientbound { 0x00 => LoginDisconnect 0x01 => EncryptionRequest - 0x02 => LoginSuccess + 0x02 => LoginSuccess_String 0x03 => SetInitialCompression } } diff --git a/src/server/mod.rs b/src/server/mod.rs index a7563db..cb5064f 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -147,7 +147,7 @@ impl Server { verify_token = Rc::new(val.verify_token.data); break; } - protocol::packet::Packet::LoginSuccess(val) => { + protocol::packet::Packet::LoginSuccess_String(val) => { warn!("Server is running in offline mode"); debug!("Login: {} {}", val.username, val.uuid); let mut read = conn.clone(); @@ -164,6 +164,24 @@ impl Server { Some(rx), )); } + // TODO: avoid duplication + protocol::packet::Packet::LoginSuccess_UUID(val) => { + warn!("Server is running in offline mode"); + debug!("Login: {} {:?}", val.username, val.uuid); + let mut read = conn.clone(); + let mut write = conn.clone(); + read.state = protocol::State::Play; + write.state = protocol::State::Play; + let rx = Self::spawn_reader(read); + return Ok(Server::new( + protocol_version, + forge_mods, + val.uuid, + resources, + Some(write), + Some(rx), + )); + } protocol::packet::Packet::LoginDisconnect(val) => { return Err(protocol::Error::Disconnect(val.reason)) } @@ -210,8 +228,15 @@ impl Server { read.set_compresssion(val.threshold.0); write.set_compresssion(val.threshold.0); } - protocol::packet::Packet::LoginSuccess(val) => { + protocol::packet::Packet::LoginSuccess_String(val) => { debug!("Login: {} {}", val.username, val.uuid); + uuid = protocol::UUID::from_str(&val.uuid); + read.state = protocol::State::Play; + write.state = protocol::State::Play; + break; + } + protocol::packet::Packet::LoginSuccess_UUID(val) => { + debug!("Login: {} {:?}", val.username, val.uuid); uuid = val.uuid; read.state = protocol::State::Play; write.state = protocol::State::Play; @@ -229,7 +254,7 @@ impl Server { Ok(Server::new( protocol_version, forge_mods, - protocol::UUID::from_str(&uuid), + uuid, resources, Some(write), Some(rx), @@ -482,16 +507,19 @@ impl Server { self pck { PluginMessageClientbound_i16 => on_plugin_message_clientbound_i16, PluginMessageClientbound => on_plugin_message_clientbound_1, + JoinGame_WorldNames => on_game_join_worldnames, JoinGame_HashedSeed_Respawn => on_game_join_hashedseed_respawn, JoinGame_i32_ViewDistance => on_game_join_i32_viewdistance, JoinGame_i32 => on_game_join_i32, JoinGame_i8 => on_game_join_i8, JoinGame_i8_NoDebug => on_game_join_i8_nodebug, - Respawn => on_respawn, + Respawn_Gamemode => on_respawn_gamemode, Respawn_HashedSeed => on_respawn_hashedseed, + Respawn_WorldName => on_respawn_worldname, KeepAliveClientbound_i64 => on_keep_alive_i64, KeepAliveClientbound_VarInt => on_keep_alive_varint, KeepAliveClientbound_i32 => on_keep_alive_i32, + ChunkData_Biomes3D_bool => on_chunk_data_biomes3d_bool, ChunkData => on_chunk_data, ChunkData_Biomes3D => on_chunk_data_biomes3d, ChunkData_HeightMap => on_chunk_data_heightmap, @@ -942,6 +970,10 @@ impl Server { } } + fn on_game_join_worldnames(&mut self, join: packet::play::clientbound::JoinGame_WorldNames) { + self.on_game_join(join.gamemode, join.entity_id) + } + fn on_game_join_hashedseed_respawn( &mut self, join: packet::play::clientbound::JoinGame_HashedSeed_Respawn, @@ -1007,7 +1039,11 @@ impl Server { self.respawn(respawn.gamemode) } - fn on_respawn(&mut self, respawn: packet::play::clientbound::Respawn) { + fn on_respawn_gamemode(&mut self, respawn: packet::play::clientbound::Respawn_Gamemode) { + self.respawn(respawn.gamemode) + } + + fn on_respawn_worldname(&mut self, respawn: packet::play::clientbound::Respawn_WorldName) { self.respawn(respawn.gamemode) } @@ -1726,6 +1762,22 @@ impl Server { } } + fn on_chunk_data_biomes3d_bool( + &mut self, + chunk_data: packet::play::clientbound::ChunkData_Biomes3D_bool, + ) { + self.world + .load_chunk115( + chunk_data.chunk_x, + chunk_data.chunk_z, + chunk_data.new, + chunk_data.bitmask.0 as u16, + chunk_data.data.data, + ) + .unwrap(); + self.load_block_entities(chunk_data.block_entities.data); + } + fn on_chunk_data_biomes3d( &mut self, chunk_data: packet::play::clientbound::ChunkData_Biomes3D,