Implement JoinGame_WorldNames

This commit is contained in:
ice_iix 2020-06-27 17:11:32 -07:00
parent d6ee4b6e1e
commit 08e08d1bd9
3 changed files with 41 additions and 1 deletions

View File

@ -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<VarInt, String> =,
/// Represents a dimension registry
field dimension_codec: Option<nbt::NamedTag> =,
/// 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 =,

View File

@ -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

View File

@ -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,