steel_protocol/packets/game/c_respawn.rs
1//! Clientbound respawn packet - sent to respawn a player or change dimensions.
2
3use steel_macros::{ClientPacket, WriteTo};
4use steel_registry::packets::play::C_RESPAWN;
5use steel_utils::{BlockPos, Identifier};
6
7/// Respawn a player in any dimension.
8///
9/// Sent by the server when a player respawns after death or changes dimensions.
10/// The client will reset its world state and prepare for new chunk data.
11#[derive(ClientPacket, WriteTo, Clone, Debug)]
12#[packet_id(Play = C_RESPAWN)]
13pub struct CRespawn {
14 /// The dimension type registry ID.
15 #[write(as = VarInt)]
16 pub dimension_type: i32,
17 /// The dimension name (e.g. `minecraft:overworld`).
18 pub dimension_name: Identifier,
19 /// The hashed seed of the world (used for biome noise).
20 pub hashed_seed: i64,
21 /// The player's game mode after respawning.
22 pub gamemode: u8,
23 /// The player's previous game mode (-1 if none).
24 pub previous_gamemode: i8,
25 /// Whether this is a debug world.
26 pub is_debug: bool,
27 /// Whether this is a superflat world.
28 pub is_flat: bool,
29 /// Whether the player has a death location.
30 pub has_death_location: bool,
31 /// The dimension name of the death location (if `has_death_location` is true).
32 #[write(as = Unprefixed)]
33 pub death_dimension_name: Option<Identifier>,
34 /// The block position of the death location (if `has_death_location` is true).
35 #[write(as = Unprefixed)]
36 pub death_location: Option<BlockPos>,
37 /// The portal cooldown in ticks.
38 #[write(as = VarInt)]
39 pub portal_cooldown_ticks: i32,
40 /// The sea level of the dimension.
41 #[write(as = VarInt)]
42 pub sea_level: i32,
43 /// Bit field: 0x01 = keep attributes, 0x02 = keep metadata.
44 /// Set to 0 for a full reset (normal respawn).
45 pub data_kept: i8,
46}