summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol17x.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-10 21:51:22 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-10 21:51:22 +0200
commitbfa8aaf41bd2e982e81ca1385efc9ec25ebd246c (patch)
tree706bb3680c60cbc1f78e31f0ca2ac6d1e9422a6a /src/Protocol/Protocol17x.cpp
parentPortal improvements and suggestions (diff)
parentFixed clang warnings about abs() in Noise.cpp. (diff)
downloadcuberite-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 '')
-rw-r--r--src/Protocol/Protocol17x.cpp11
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();
}