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/Protocol/Protocol17x.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/Protocol/Protocol17x.cpp')
-rw-r--r-- | src/Protocol/Protocol17x.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 9c5f5eaba..f5b176e54 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -92,7 +92,8 @@ cProtocol172::cProtocol172(cClientHandle * a_Client, const AString & a_ServerAdd m_ReceivedData(32 KiB), m_OutPacketBuffer(64 KiB), m_OutPacketLenBuffer(20), // 20 bytes is more than enough for one VarInt - m_IsEncrypted(false) + m_IsEncrypted(false), + m_LastSentDimension(dimNotSet) { // Create the comm log file, if so requested: if (g_ShouldLogCommIn || g_ShouldLogCommOut) @@ -656,6 +657,7 @@ void cProtocol172::SendLogin(const cPlayer & a_Player, const cWorld & a_World) Pkt.WriteByte(std::min(Server->GetMaxPlayers(), 60)); Pkt.WriteString("default"); // Level type - wtf? } + m_LastSentDimension = a_World.GetDimension(); // Send the spawn position: { @@ -986,12 +988,19 @@ void cProtocol172::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effect void cProtocol172::SendRespawn(const cWorld & a_World) { + if (m_LastSentDimension == a_World.GetDimension()) + { + // Must not send a respawn for the world with the same dimension, the client goes cuckoo if we do + return; + } + cPacketizer Pkt(*this, 0x07); // Respawn packet cPlayer * Player = m_Client->GetPlayer(); Pkt.WriteInt((int)a_World.GetDimension()); Pkt.WriteByte(2); // TODO: Difficulty (set to Normal) Pkt.WriteByte((Byte)Player->GetEffectiveGameMode()); Pkt.WriteString("default"); + m_LastSentDimension = a_World.GetDimension(); } |