From 7e4abd7dd09ed8f88471db7369c9e8fb5247416f Mon Sep 17 00:00:00 2001 From: sleirsgoevy Date: Sat, 2 Nov 2024 01:20:13 +0300 Subject: Fix player respawn for 1.8 clients (#5535) 1.8 clients seem to dislike "resurrecting" a dead player entity, doing so results in the player entering a glitched state where its nickname is displayed on the feet and they can't be attacked by melee. Destroying and recreating the client-side entity at respawn time seems to fix the glitch, and does not seem to affect more modern clients. --- src/Entities/Player.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index c580d8293..de99a299d 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -982,6 +982,13 @@ void cPlayer::Respawn(void) TeleportToCoords(m_RespawnPosition.x, m_RespawnPosition.y, m_RespawnPosition.z); } + // The Notchian client enters a weird glitched state when trying to "resurrect" dead players + // To prevent that, destroy the existing client-side entity, and create a new one with the same ID + // This does not make any difference to more modern clients + m_World->BroadcastDestroyEntity(*this, &*m_ClientHandle); + m_World->BroadcastSpawnEntity(*this, &*m_ClientHandle); + + SetVisible(true); } -- cgit v1.2.3