diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-06-10 21:51:22 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-06-10 21:51:22 +0200 |
commit | bfa8aaf41bd2e982e81ca1385efc9ec25ebd246c (patch) | |
tree | 706bb3680c60cbc1f78e31f0ca2ac6d1e9422a6a /src/Entities/Player.cpp | |
parent | Portal improvements and suggestions (diff) | |
parent | Fixed clang warnings about abs() in Noise.cpp. (diff) | |
download | cuberite-bfa8aaf41bd2e982e81ca1385efc9ec25ebd246c.tar cuberite-bfa8aaf41bd2e982e81ca1385efc9ec25ebd246c.tar.gz cuberite-bfa8aaf41bd2e982e81ca1385efc9ec25ebd246c.tar.bz2 cuberite-bfa8aaf41bd2e982e81ca1385efc9ec25ebd246c.tar.lz cuberite-bfa8aaf41bd2e982e81ca1385efc9ec25ebd246c.tar.xz cuberite-bfa8aaf41bd2e982e81ca1385efc9ec25ebd246c.tar.zst cuberite-bfa8aaf41bd2e982e81ca1385efc9ec25ebd246c.zip |
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r-- | src/Entities/Player.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index af4299e4b..4d6688694 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -934,6 +934,8 @@ void cPlayer::Killed(cEntity * a_Victim) void cPlayer::Respawn(void) { + ASSERT(m_World != NULL); + m_Health = GetMaxHealth(); SetInvulnerableTicks(20); @@ -1590,24 +1592,22 @@ bool cPlayer::MoveToWorld(const AString & a_WorldName, cWorld * a_World) return false; } - eDimension OldDimension = m_World->GetDimension(); - + // Send the respawn packet: + if (m_ClientHandle != NULL) + { + m_ClientHandle->SendRespawn(*World); + } + // Remove all links to the old world m_World->RemovePlayer(this); - m_ClientHandle->RemoveFromAllChunks(); // If the dimension is different, we can send the respawn packet // http://wiki.vg/Protocol#0x09 says "don't send if dimension is the same" as of 2013_07_02 - bool SendRespawn = OldDimension != World->GetDimension(); - m_ClientHandle->MoveToWorld(*World, SendRespawn); - // Add player to all the necessary parts of the new world - SetWorld(World); - m_ClientHandle->StreamChunks(); - World->AddEntity(this); + // Queue adding player to the new world, including all the necessary adjustments to the object World->AddPlayer(this); - if (SendRespawn) + if (GetWorld()->GetDimension() != World->GetDimension()) { GetClientHandle()->SendPlayerMoveLook(); GetClientHandle()->SendHealth(); |