summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol18x.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-08 00:36:30 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-08 00:36:30 +0200
commit09ff17b71ea5659dc628d9d6e3f1fd308d10037a (patch)
tree6771e5ea4a8d924b8ca3947f38dfea735e893ed8 /src/Protocol/Protocol18x.cpp
parentFixed client errors. (diff)
downloadcuberite-09ff17b71ea5659dc628d9d6e3f1fd308d10037a.tar
cuberite-09ff17b71ea5659dc628d9d6e3f1fd308d10037a.tar.gz
cuberite-09ff17b71ea5659dc628d9d6e3f1fd308d10037a.tar.bz2
cuberite-09ff17b71ea5659dc628d9d6e3f1fd308d10037a.tar.lz
cuberite-09ff17b71ea5659dc628d9d6e3f1fd308d10037a.tar.xz
cuberite-09ff17b71ea5659dc628d9d6e3f1fd308d10037a.tar.zst
cuberite-09ff17b71ea5659dc628d9d6e3f1fd308d10037a.zip
Diffstat (limited to 'src/Protocol/Protocol18x.cpp')
-rw-r--r--src/Protocol/Protocol18x.cpp34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp
index a3e72d4dd..bcb5c2036 100644
--- a/src/Protocol/Protocol18x.cpp
+++ b/src/Protocol/Protocol18x.cpp
@@ -13,6 +13,7 @@ Implements the 1.8.x protocol classes:
#include "json/json.h"
#include "ChunkDataSerializer.h"
#include "Protocol18x.h"
+#include "zlib/zlib.h"
#include "../ClientHandle.h"
#include "../CompositeChat.h"
@@ -21,7 +22,7 @@ Implements the 1.8.x protocol classes:
#include "../World.h"
#include "../Entities/Player.h"
-#include "Entities/Painting.h"
+#include "../Entities/Painting.h"
@@ -57,23 +58,38 @@ cProtocol180::cProtocol180(cClientHandle * a_Client, const AString & a_ServerAdd
+void cProtocol180::SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data)
+{
+ ASSERT(m_State == 3); // In game mode?
+
+ cPacketizer Pkt(*this, 0x28); // Effect packet
+ Pkt.WriteInt(a_EffectID);
+ Pkt.WritePosition(Vector3i(a_SrcX, a_SrcY, a_SrcZ));
+ Pkt.WriteInt(a_Data);
+ Pkt.WriteBool(false);
+}
+
+
+
+
+
void cProtocol180::SendLoginSuccess(void)
{
ASSERT(m_State == 2); // State: login?
- // Disable compression:
+ // Enable compression:
{
cPacketizer Pkt(*this, 0x03); // Set compression packet
- Pkt.WriteVarInt(-1);
+ Pkt.WriteVarInt(256);
}
+ m_State = 3; // State = Game
+
{
cPacketizer Pkt(*this, 0x02); // Login success packet
Pkt.WriteString(cMojangAPI::MakeUUIDDashed(m_Client->GetUUID()));
Pkt.WriteString(m_Client->GetUsername());
}
-
- m_State = 3; // State = Game
}
@@ -409,12 +425,10 @@ void cProtocol180::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerialize
// Serialize first, before creating the Packetizer (the packetizer locks a CS)
// This contains the flags and bitmasks, too
- const AString & ChunkData = a_Serializer.Serialize(cChunkDataSerializer::RELEASE_1_8_0);
+ const AString & ChunkData = a_Serializer.Serialize(cChunkDataSerializer::RELEASE_1_8_0, a_ChunkX, a_ChunkZ);
- cPacketizer Pkt(*this, 0x21); // Chunk Data packet
- Pkt.WriteInt(a_ChunkX);
- Pkt.WriteInt(a_ChunkZ);
- Pkt.WriteBuf(ChunkData.data(), ChunkData.size());
+ cCSLock Lock(m_CSPacket);
+ SendData(ChunkData.data(), ChunkData.size());
}