1.16.2+: fix Respawn dimension field, closes #452

This commit is contained in:
ice_iix 2020-12-27 18:13:51 -08:00
parent 71121bd572
commit 80887eec91
3 changed files with 16 additions and 1 deletions

View File

@ -1634,6 +1634,16 @@ state_packets!(
field gamemode: u8 =,
field level_type: String =,
}
packet Respawn_NBT {
field dimension: Option<nbt::NamedTag> =,
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 =,
}
packet Respawn_WorldName {
field dimension: String =,
field world_name: String =,

View File

@ -115,7 +115,7 @@ protocol_packet_ids!(
0x36 => EntityDestroy
0x37 => EntityRemoveEffect
0x38 => ResourcePackSend
0x39 => Respawn_WorldName
0x39 => Respawn_NBT
0x3a => EntityHeadLook
0x3b => MultiBlockChange_Packed
0x3c => SelectAdvancementTab

View File

@ -519,6 +519,7 @@ impl Server {
Respawn_Gamemode => on_respawn_gamemode,
Respawn_HashedSeed => on_respawn_hashedseed,
Respawn_WorldName => on_respawn_worldname,
Respawn_NBT => on_respawn_nbt,
KeepAliveClientbound_i64 => on_keep_alive_i64,
KeepAliveClientbound_VarInt => on_keep_alive_varint,
KeepAliveClientbound_i32 => on_keep_alive_i32,
@ -1057,6 +1058,10 @@ impl Server {
self.respawn(respawn.gamemode)
}
fn on_respawn_nbt(&mut self, respawn: packet::play::clientbound::Respawn_NBT) {
self.respawn(respawn.gamemode)
}
fn respawn(&mut self, gamemode_u8: u8) {
self.world = world::World::new(self.protocol_version);
let gamemode = Gamemode::from_int((gamemode_u8 & 0x7) as i32);