diff --git a/protocol/src/protocol/packet.rs b/protocol/src/protocol/packet.rs index f870e71..527bfed 100644 --- a/protocol/src/protocol/packet.rs +++ b/protocol/src/protocol/packet.rs @@ -1166,6 +1166,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 =, diff --git a/protocol/src/protocol/versions/v1_16_1.rs b/protocol/src/protocol/versions/v1_16_1.rs index a67903a..1cbfaa3 100644 --- a/protocol/src/protocol/versions/v1_16_1.rs +++ b/protocol/src/protocol/versions/v1_16_1.rs @@ -94,7 +94,7 @@ protocol_packet_ids!( 0x22 => Effect 0x23 => Particle_f64 0x24 => UpdateLight // TODO - 0x25 => JoinGame_HashedSeed_Respawn // TODO + 0x25 => JoinGame_WorldNames 0x26 => Maps 0x27 => TradeList_WithRestock 0x28 => EntityMove_i16 diff --git a/src/server/mod.rs b/src/server/mod.rs index 8619af2..ada9d58 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -507,6 +507,7 @@ 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, @@ -968,6 +969,13 @@ 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,