diff --git a/protocol/src/protocol/packet.rs b/protocol/src/protocol/packet.rs index 25e5c33..3e0a5da 100644 --- a/protocol/src/protocol/packet.rs +++ b/protocol/src/protocol/packet.rs @@ -1485,7 +1485,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 =, diff --git a/protocol/src/protocol/versions/v15w39c.rs b/protocol/src/protocol/versions/v15w39c.rs index 4f70808..fc293cf 100644 --- a/protocol/src/protocol/versions/v15w39c.rs +++ b/protocol/src/protocol/versions/v15w39c.rs @@ -88,7 +88,7 @@ protocol_packet_ids!( 0x30 => EntityDestroy 0x31 => EntityRemoveEffect 0x32 => ResourcePackSend - 0x33 => Respawn + 0x33 => Respawn_Gamemode 0x34 => EntityHeadLook 0x35 => WorldBorder 0x36 => Camera diff --git a/protocol/src/protocol/versions/v18w50a.rs b/protocol/src/protocol/versions/v18w50a.rs index 03921e2..1855f59 100644 --- a/protocol/src/protocol/versions/v18w50a.rs +++ b/protocol/src/protocol/versions/v18w50a.rs @@ -110,7 +110,7 @@ protocol_packet_ids!( 0x36 => EntityDestroy 0x37 => EntityRemoveEffect 0x38 => ResourcePackSend - 0x39 => Respawn + 0x39 => Respawn_Gamemode 0x3a => EntityHeadLook 0x3b => SelectAdvancementTab 0x3c => WorldBorder diff --git a/protocol/src/protocol/versions/v19w02a.rs b/protocol/src/protocol/versions/v19w02a.rs index 5c2024c..f1e8498 100644 --- a/protocol/src/protocol/versions/v19w02a.rs +++ b/protocol/src/protocol/versions/v19w02a.rs @@ -110,7 +110,7 @@ protocol_packet_ids!( 0x36 => EntityDestroy 0x37 => EntityRemoveEffect 0x38 => ResourcePackSend - 0x39 => Respawn + 0x39 => Respawn_Gamemode 0x3a => EntityHeadLook 0x3b => SelectAdvancementTab 0x3c => WorldBorder diff --git a/protocol/src/protocol/versions/v1_10_2.rs b/protocol/src/protocol/versions/v1_10_2.rs index 96e6c94..4e93e7d 100644 --- a/protocol/src/protocol/versions/v1_10_2.rs +++ b/protocol/src/protocol/versions/v1_10_2.rs @@ -91,7 +91,7 @@ protocol_packet_ids!( 0x30 => EntityDestroy 0x31 => EntityRemoveEffect 0x32 => ResourcePackSend - 0x33 => Respawn + 0x33 => Respawn_Gamemode 0x34 => EntityHeadLook 0x35 => WorldBorder 0x36 => Camera diff --git a/protocol/src/protocol/versions/v1_11_2.rs b/protocol/src/protocol/versions/v1_11_2.rs index e03abd1..88e9e26 100644 --- a/protocol/src/protocol/versions/v1_11_2.rs +++ b/protocol/src/protocol/versions/v1_11_2.rs @@ -91,7 +91,7 @@ protocol_packet_ids!( 0x30 => EntityDestroy 0x31 => EntityRemoveEffect 0x32 => ResourcePackSend - 0x33 => Respawn + 0x33 => Respawn_Gamemode 0x34 => EntityHeadLook 0x35 => WorldBorder 0x36 => Camera diff --git a/protocol/src/protocol/versions/v1_12_2.rs b/protocol/src/protocol/versions/v1_12_2.rs index 77e0acb..e0e248d 100644 --- a/protocol/src/protocol/versions/v1_12_2.rs +++ b/protocol/src/protocol/versions/v1_12_2.rs @@ -96,7 +96,7 @@ protocol_packet_ids!( 0x32 => EntityDestroy 0x33 => EntityRemoveEffect 0x34 => ResourcePackSend - 0x35 => Respawn + 0x35 => Respawn_Gamemode 0x36 => EntityHeadLook 0x37 => SelectAdvancementTab 0x38 => WorldBorder diff --git a/protocol/src/protocol/versions/v1_13_2.rs b/protocol/src/protocol/versions/v1_13_2.rs index 8e7561a..739a8fc 100644 --- a/protocol/src/protocol/versions/v1_13_2.rs +++ b/protocol/src/protocol/versions/v1_13_2.rs @@ -109,7 +109,7 @@ protocol_packet_ids!( 0x35 => EntityDestroy 0x36 => EntityRemoveEffect 0x37 => ResourcePackSend - 0x38 => Respawn + 0x38 => Respawn_Gamemode 0x39 => EntityHeadLook 0x3a => SelectAdvancementTab 0x3b => WorldBorder diff --git a/protocol/src/protocol/versions/v1_14.rs b/protocol/src/protocol/versions/v1_14.rs index bb168f1..9641abf 100644 --- a/protocol/src/protocol/versions/v1_14.rs +++ b/protocol/src/protocol/versions/v1_14.rs @@ -114,7 +114,7 @@ protocol_packet_ids!( 0x37 => EntityDestroy 0x38 => EntityRemoveEffect 0x39 => ResourcePackSend - 0x3a => Respawn + 0x3a => Respawn_Gamemode 0x3b => EntityHeadLook 0x3c => SelectAdvancementTab 0x3d => WorldBorder diff --git a/protocol/src/protocol/versions/v1_14_1.rs b/protocol/src/protocol/versions/v1_14_1.rs index bb168f1..9641abf 100644 --- a/protocol/src/protocol/versions/v1_14_1.rs +++ b/protocol/src/protocol/versions/v1_14_1.rs @@ -114,7 +114,7 @@ protocol_packet_ids!( 0x37 => EntityDestroy 0x38 => EntityRemoveEffect 0x39 => ResourcePackSend - 0x3a => Respawn + 0x3a => Respawn_Gamemode 0x3b => EntityHeadLook 0x3c => SelectAdvancementTab 0x3d => WorldBorder diff --git a/protocol/src/protocol/versions/v1_14_2.rs b/protocol/src/protocol/versions/v1_14_2.rs index bb168f1..9641abf 100644 --- a/protocol/src/protocol/versions/v1_14_2.rs +++ b/protocol/src/protocol/versions/v1_14_2.rs @@ -114,7 +114,7 @@ protocol_packet_ids!( 0x37 => EntityDestroy 0x38 => EntityRemoveEffect 0x39 => ResourcePackSend - 0x3a => Respawn + 0x3a => Respawn_Gamemode 0x3b => EntityHeadLook 0x3c => SelectAdvancementTab 0x3d => WorldBorder diff --git a/protocol/src/protocol/versions/v1_14_3.rs b/protocol/src/protocol/versions/v1_14_3.rs index ce1c1ac..1acf40d 100644 --- a/protocol/src/protocol/versions/v1_14_3.rs +++ b/protocol/src/protocol/versions/v1_14_3.rs @@ -114,7 +114,7 @@ protocol_packet_ids!( 0x37 => EntityDestroy 0x38 => EntityRemoveEffect 0x39 => ResourcePackSend - 0x3a => Respawn + 0x3a => Respawn_Gamemode 0x3b => EntityHeadLook 0x3c => SelectAdvancementTab 0x3d => WorldBorder diff --git a/protocol/src/protocol/versions/v1_14_4.rs b/protocol/src/protocol/versions/v1_14_4.rs index 4d55d7b..b191d0f 100644 --- a/protocol/src/protocol/versions/v1_14_4.rs +++ b/protocol/src/protocol/versions/v1_14_4.rs @@ -114,7 +114,7 @@ protocol_packet_ids!( 0x37 => EntityDestroy 0x38 => EntityRemoveEffect 0x39 => ResourcePackSend - 0x3a => Respawn + 0x3a => Respawn_Gamemode 0x3b => EntityHeadLook 0x3c => SelectAdvancementTab 0x3d => WorldBorder diff --git a/protocol/src/protocol/versions/v1_7_10.rs b/protocol/src/protocol/versions/v1_7_10.rs index c27eb4e..10c31a9 100644 --- a/protocol/src/protocol/versions/v1_7_10.rs +++ b/protocol/src/protocol/versions/v1_7_10.rs @@ -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 diff --git a/protocol/src/protocol/versions/v1_8_9.rs b/protocol/src/protocol/versions/v1_8_9.rs index bbc6d60..dbf0911 100644 --- a/protocol/src/protocol/versions/v1_8_9.rs +++ b/protocol/src/protocol/versions/v1_8_9.rs @@ -43,7 +43,7 @@ protocol_packet_ids!( 0x04 => EntityEquipment_u16 0x05 => SpawnPosition 0x06 => UpdateHealth - 0x07 => Respawn + 0x07 => Respawn_Gamemode 0x08 => TeleportPlayer_NoConfirm 0x09 => SetCurrentHotbarSlot 0x0a => EntityUsedBed diff --git a/protocol/src/protocol/versions/v1_9.rs b/protocol/src/protocol/versions/v1_9.rs index 3d081f6..3b7f247 100644 --- a/protocol/src/protocol/versions/v1_9.rs +++ b/protocol/src/protocol/versions/v1_9.rs @@ -91,7 +91,7 @@ protocol_packet_ids!( 0x30 => EntityDestroy 0x31 => EntityRemoveEffect 0x32 => ResourcePackSend - 0x33 => Respawn + 0x33 => Respawn_Gamemode 0x34 => EntityHeadLook 0x35 => WorldBorder 0x36 => Camera diff --git a/protocol/src/protocol/versions/v1_9_2.rs b/protocol/src/protocol/versions/v1_9_2.rs index faa149c..fae28bc 100644 --- a/protocol/src/protocol/versions/v1_9_2.rs +++ b/protocol/src/protocol/versions/v1_9_2.rs @@ -91,7 +91,7 @@ protocol_packet_ids!( 0x30 => EntityDestroy 0x31 => EntityRemoveEffect 0x32 => ResourcePackSend - 0x33 => Respawn + 0x33 => Respawn_Gamemode 0x34 => EntityHeadLook 0x35 => WorldBorder 0x36 => Camera diff --git a/src/server/mod.rs b/src/server/mod.rs index a7563db..a15d0cb 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -487,8 +487,9 @@ impl Server { 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, @@ -1007,7 +1008,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) }