diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-08-27 08:37:54 +0200 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-08-29 10:16:06 +0200 |
commit | c088f7ff0a336703fb19038eef36f736a4e388f7 (patch) | |
tree | f1d9104b186d02f5da8f31ed8ce124bfbff3f6b2 /src/ClientHandle.cpp | |
parent | Fixed SendUnloadChunk bug (#3353) (diff) | |
download | cuberite-c088f7ff0a336703fb19038eef36f736a4e388f7.tar cuberite-c088f7ff0a336703fb19038eef36f736a4e388f7.tar.gz cuberite-c088f7ff0a336703fb19038eef36f736a4e388f7.tar.bz2 cuberite-c088f7ff0a336703fb19038eef36f736a4e388f7.tar.lz cuberite-c088f7ff0a336703fb19038eef36f736a4e388f7.tar.xz cuberite-c088f7ff0a336703fb19038eef36f736a4e388f7.tar.zst cuberite-c088f7ff0a336703fb19038eef36f736a4e388f7.zip |
Diffstat (limited to '')
-rw-r--r-- | src/ClientHandle.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 882c7f283..6febbfc3a 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -62,6 +62,7 @@ int cClientHandle::s_ClientCount = 0; // cClientHandle: cClientHandle::cClientHandle(const AString & a_IPString, int a_ViewDistance) : + m_LastSentDimension(dimNotSet), m_CurrentViewDistance(a_ViewDistance), m_RequestedViewDistance(a_ViewDistance), m_IPString(a_IPString), @@ -368,6 +369,7 @@ void cClientHandle::Authenticate(const AString & a_Name, const AString & a_UUID, // Return a server login packet m_Protocol->SendLogin(*m_Player, *World); + m_LastSentDimension = World->GetDimension(); // Send Weather if raining: if ((World->GetWeather() == 1) || (World->GetWeather() == 2)) @@ -2704,7 +2706,21 @@ void cClientHandle::SendResetTitle() void cClientHandle::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) { - m_Protocol->SendRespawn(a_Dimension, a_ShouldIgnoreDimensionChecks); + // If a_ShouldIgnoreDimensionChecks is true, we must be traveling to the same dimension + ASSERT((!a_ShouldIgnoreDimensionChecks) || (a_Dimension == m_LastSentDimension)); + + if ((!a_ShouldIgnoreDimensionChecks) && (a_Dimension == m_LastSentDimension)) + { + // The client goes crazy if we send a respawn packet with the dimension of the current world + // So we send a temporary one first. + // This is not needed when the player dies, hence the a_ShouldIgnoreDimensionChecks flag. + // a_ShouldIgnoreDimensionChecks is true only at cPlayer::respawn, which is called after + // the player dies. + eDimension TemporaryDimension = (a_Dimension == dimOverworld) ? dimNether : dimOverworld; + m_Protocol->SendRespawn(TemporaryDimension); + } + m_Protocol->SendRespawn(a_Dimension); + m_LastSentDimension = a_Dimension; } |