summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-11 17:03:09 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-11 17:03:09 +0200
commit3bd3ac2200392542b111d2bcd2951bd342edf721 (patch)
tree7b7670883575c6687a219192923bc40265192eff /src
parent1.8: Added MultiBlockChange packet. (diff)
downloadcuberite-3bd3ac2200392542b111d2bcd2951bd342edf721.tar
cuberite-3bd3ac2200392542b111d2bcd2951bd342edf721.tar.gz
cuberite-3bd3ac2200392542b111d2bcd2951bd342edf721.tar.bz2
cuberite-3bd3ac2200392542b111d2bcd2951bd342edf721.tar.lz
cuberite-3bd3ac2200392542b111d2bcd2951bd342edf721.tar.xz
cuberite-3bd3ac2200392542b111d2bcd2951bd342edf721.tar.zst
cuberite-3bd3ac2200392542b111d2bcd2951bd342edf721.zip
Diffstat (limited to 'src')
-rw-r--r--src/Chunk.cpp4
-rw-r--r--src/Chunk.h2
-rw-r--r--src/ChunkMap.cpp4
-rw-r--r--src/ChunkMap.h2
-rw-r--r--src/ClientHandle.cpp4
-rw-r--r--src/ClientHandle.h2
-rw-r--r--src/Protocol/Protocol.h2
-rw-r--r--src/Protocol/Protocol125.cpp2
-rw-r--r--src/Protocol/Protocol125.h2
-rw-r--r--src/Protocol/Protocol15x.cpp4
-rw-r--r--src/Protocol/Protocol15x.h2
-rw-r--r--src/Protocol/Protocol17x.cpp4
-rw-r--r--src/Protocol/Protocol17x.h2
-rw-r--r--src/Protocol/Protocol18x.cpp100
-rw-r--r--src/Protocol/Protocol18x.h5
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp4
-rw-r--r--src/Protocol/ProtocolRecognizer.h2
-rw-r--r--src/World.cpp4
-rw-r--r--src/World.h2
19 files changed, 115 insertions, 38 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 99e48df95..79602e64e 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -3043,7 +3043,7 @@ void cChunk::BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation
-void cChunk::BroadcastParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount, cClientHandle * a_Exclude)
+void cChunk::BroadcastParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount, cClientHandle * a_Exclude)
{
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
{
@@ -3051,7 +3051,7 @@ void cChunk::BroadcastParticleEffect(const AString & a_ParticleName, float a_Src
{
continue;
}
- (*itr)->SendParticleEffect(a_ParticleName, a_SrcX, a_SrcY, a_SrcZ, a_OffsetX, a_OffsetY, a_OffsetZ, a_ParticleData, a_ParticleAmmount);
+ (*itr)->SendParticleEffect(a_ParticleName, a_SrcX, a_SrcY, a_SrcZ, a_OffsetX, a_OffsetY, a_OffsetZ, a_ParticleData, a_ParticleAmount);
} // for itr - LoadedByClient[]
}
diff --git a/src/Chunk.h b/src/Chunk.h
index f282694c2..e88e72bdc 100644
--- a/src/Chunk.h
+++ b/src/Chunk.h
@@ -326,7 +326,7 @@ public:
void BroadcastEntityStatus (const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude = NULL);
void BroadcastEntityVelocity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
void BroadcastEntityAnimation (const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL);
- void BroadcastParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount, cClientHandle * a_Exclude = NULL);
+ void BroadcastParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount, cClientHandle * a_Exclude = NULL);
void BroadcastRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID, const cClientHandle * a_Exclude = NULL);
void BroadcastSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = NULL);
void BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = NULL);
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index 9c105c5af..e03c9b86c 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -617,7 +617,7 @@ void cChunkMap::BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animat
-void cChunkMap::BroadcastParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount, cClientHandle * a_Exclude)
+void cChunkMap::BroadcastParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount, cClientHandle * a_Exclude)
{
cCSLock Lock(m_CSLayers);
int ChunkX, ChunkZ;
@@ -629,7 +629,7 @@ void cChunkMap::BroadcastParticleEffect(const AString & a_ParticleName, float a_
return;
}
// It's perfectly legal to broadcast packets even to invalid chunks!
- Chunk->BroadcastParticleEffect(a_ParticleName, a_SrcX, a_SrcY, a_SrcZ, a_OffsetX, a_OffsetY, a_OffsetZ, a_ParticleData, a_ParticleAmmount, a_Exclude);
+ Chunk->BroadcastParticleEffect(a_ParticleName, a_SrcX, a_SrcY, a_SrcZ, a_OffsetX, a_OffsetY, a_OffsetZ, a_ParticleData, a_ParticleAmount, a_Exclude);
}
diff --git a/src/ChunkMap.h b/src/ChunkMap.h
index 7354536d4..dcfd1e336 100644
--- a/src/ChunkMap.h
+++ b/src/ChunkMap.h
@@ -87,7 +87,7 @@ public:
void BroadcastEntityStatus(const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude = NULL);
void BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL);
- void BroadcastParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount, cClientHandle * a_Exclude = NULL);
+ void BroadcastParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount, cClientHandle * a_Exclude = NULL);
void BroadcastRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID, const cClientHandle * a_Exclude = NULL);
void BroadcastSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = NULL);
void BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = NULL);
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index fa2c2124b..3b32b06b9 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -2339,9 +2339,9 @@ void cClientHandle::SendMapInfo(int a_ID, unsigned int a_Scale)
-void cClientHandle::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount)
+void cClientHandle::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount)
{
- m_Protocol->SendParticleEffect(a_ParticleName, a_SrcX, a_SrcY, a_SrcZ, a_OffsetX, a_OffsetY, a_OffsetZ, a_ParticleData, a_ParticleAmmount);
+ m_Protocol->SendParticleEffect(a_ParticleName, a_SrcX, a_SrcY, a_SrcZ, a_OffsetX, a_OffsetY, a_OffsetZ, a_ParticleData, a_ParticleAmount);
}
diff --git a/src/ClientHandle.h b/src/ClientHandle.h
index eaa4e90fd..7c5597b8b 100644
--- a/src/ClientHandle.h
+++ b/src/ClientHandle.h
@@ -154,7 +154,7 @@ public:
void SendPaintingSpawn (const cPainting & a_Painting);
void SendPickupSpawn (const cPickup & a_Pickup);
void SendEntityAnimation (const cEntity & a_Entity, char a_Animation); // tolua_export
- void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount);
+ void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount);
void SendPlayerAbilities (void);
void SendPlayerListItem (const cPlayer & a_Player, char a_Action);
void SendPlayerMaxSpeed (void); ///< Informs the client of the maximum player speed (1.6.1+)
diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h
index 902c72675..2b41b809c 100644
--- a/src/Protocol/Protocol.h
+++ b/src/Protocol/Protocol.h
@@ -93,7 +93,7 @@ public:
virtual void SendPickupSpawn (const cPickup & a_Pickup) = 0;
virtual void SendPlayerAbilities (void) = 0;
virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) = 0;
- virtual void SendParticleEffect (const AString & a_SoundName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) = 0;
+ virtual void SendParticleEffect (const AString & a_SoundName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) = 0;
virtual void SendPlayerListItem (const cPlayer & a_Player, char a_Action) = 0;
virtual void SendPlayerMaxSpeed (void) = 0; ///< Informs the client of the maximum player speed (1.6.1+)
virtual void SendPlayerMoveLook (void) = 0;
diff --git a/src/Protocol/Protocol125.cpp b/src/Protocol/Protocol125.cpp
index 8c4534ff7..1d6049097 100644
--- a/src/Protocol/Protocol125.cpp
+++ b/src/Protocol/Protocol125.cpp
@@ -701,7 +701,7 @@ void cProtocol125::SendEntityAnimation(const cEntity & a_Entity, char a_Animatio
-void cProtocol125::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount)
+void cProtocol125::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount)
{
// Not supported by this protocol version
}
diff --git a/src/Protocol/Protocol125.h b/src/Protocol/Protocol125.h
index 029845b8b..262e1818d 100644
--- a/src/Protocol/Protocol125.h
+++ b/src/Protocol/Protocol125.h
@@ -60,7 +60,7 @@ public:
virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) override;
virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators) override;
virtual void SendMapInfo (int a_ID, unsigned int a_Scale) override;
- virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) override;
+ virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override;
virtual void SendPaintingSpawn (const cPainting & a_Painting) override;
virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
virtual void SendPlayerAbilities (void) override {} // This protocol doesn't support such message
diff --git a/src/Protocol/Protocol15x.cpp b/src/Protocol/Protocol15x.cpp
index 2b1f01b08..089296fdf 100644
--- a/src/Protocol/Protocol15x.cpp
+++ b/src/Protocol/Protocol15x.cpp
@@ -80,7 +80,7 @@ void cProtocol150::SendWindowOpen(const cWindow & a_Window)
-void cProtocol150::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount)
+void cProtocol150::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount)
{
cCSLock Lock(m_CSPacket);
WriteByte(PACKET_PARTICLE_EFFECT);
@@ -92,7 +92,7 @@ void cProtocol150::SendParticleEffect(const AString & a_ParticleName, float a_Sr
WriteFloat(a_OffsetY);
WriteFloat(a_OffsetZ);
WriteFloat(a_ParticleData);
- WriteInt(a_ParticleAmmount);
+ WriteInt(a_ParticleAmount);
Flush();
}
diff --git a/src/Protocol/Protocol15x.h b/src/Protocol/Protocol15x.h
index 0d171a67c..968d5ebcf 100644
--- a/src/Protocol/Protocol15x.h
+++ b/src/Protocol/Protocol15x.h
@@ -29,7 +29,7 @@ public:
cProtocol150(cClientHandle * a_Client);
virtual void SendWindowOpen (const cWindow & a_Window) override;
- virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) override;
+ virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override;
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override;
virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) override;
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index b4f96bd88..d83e86ece 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -847,7 +847,7 @@ void cProtocol172::SendEntityAnimation(const cEntity & a_Entity, char a_Animatio
-void cProtocol172::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount)
+void cProtocol172::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount)
{
ASSERT(m_State == 3); // In game mode?
@@ -860,7 +860,7 @@ void cProtocol172::SendParticleEffect(const AString & a_ParticleName, float a_Sr
Pkt.WriteFloat(a_OffsetY);
Pkt.WriteFloat(a_OffsetZ);
Pkt.WriteFloat(a_ParticleData);
- Pkt.WriteInt(a_ParticleAmmount);
+ Pkt.WriteInt(a_ParticleAmount);
}
diff --git a/src/Protocol/Protocol17x.h b/src/Protocol/Protocol17x.h
index 6bb5873d3..60088a1b8 100644
--- a/src/Protocol/Protocol17x.h
+++ b/src/Protocol/Protocol17x.h
@@ -98,7 +98,7 @@ public:
virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators) override;
virtual void SendMapInfo (int a_ID, unsigned int a_Scale) override;
virtual void SendPaintingSpawn (const cPainting & a_Painting) override;
- virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) override;
+ virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override;
virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
virtual void SendPlayerAbilities (void) override;
virtual void SendPlayerListItem (const cPlayer & a_Player, char a_Action) override;
diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp
index c7c6402d9..2ea83351e 100644
--- a/src/Protocol/Protocol18x.cpp
+++ b/src/Protocol/Protocol18x.cpp
@@ -779,7 +779,7 @@ void cProtocol180::SendPickupSpawn(const cPickup & a_Pickup)
{
ASSERT(m_State == 3); // In game mode?
- /*{
+ {
cPacketizer Pkt(*this, 0x0e); // Spawn Object packet
Pkt.WriteVarInt(a_Pickup.GetUniqueID());
Pkt.WriteByte(2); // Type = Pickup
@@ -797,7 +797,7 @@ void cProtocol180::SendPickupSpawn(const cPickup & a_Pickup)
Pkt.WriteByte((0x05 << 5) | 10); // Slot type + index 10
Pkt.WriteItem(a_Pickup.GetItem());
Pkt.WriteByte(0x7f); // End of metadata
- }*/
+ }
}
@@ -846,12 +846,14 @@ void cProtocol180::SendEntityAnimation(const cEntity & a_Entity, char a_Animatio
-void cProtocol180::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount)
+void cProtocol180::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount)
{
ASSERT(m_State == 3); // In game mode?
-
- /*cPacketizer Pkt(*this, 0x2A);
- Pkt.WriteString(a_ParticleName);
+ int ParticleID = GetParticleID(a_ParticleName);
+
+ cPacketizer Pkt(*this, 0x2A);
+ Pkt.WriteInt(ParticleID);
+ Pkt.WriteBool(false);
Pkt.WriteFloat(a_SrcX);
Pkt.WriteFloat(a_SrcY);
Pkt.WriteFloat(a_SrcZ);
@@ -859,7 +861,7 @@ void cProtocol180::SendParticleEffect(const AString & a_ParticleName, float a_Sr
Pkt.WriteFloat(a_OffsetY);
Pkt.WriteFloat(a_OffsetZ);
Pkt.WriteFloat(a_ParticleData);
- Pkt.WriteInt(a_ParticleAmmount);*/
+ Pkt.WriteInt(a_ParticleAmount);
}
@@ -1230,7 +1232,7 @@ void cProtocol180::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType,
{
ASSERT(m_State == 3); // In game mode?
- /*cPacketizer Pkt(*this, 0xe); // Spawn Object packet
+ cPacketizer Pkt(*this, 0xe); // Spawn Object packet
Pkt.WriteVarInt(a_Entity.GetUniqueID());
Pkt.WriteByte(a_ObjectType);
Pkt.WriteFPInt(a_Entity.GetPosX());
@@ -1244,7 +1246,7 @@ void cProtocol180::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType,
Pkt.WriteShort((short)(a_Entity.GetSpeedX() * 400));
Pkt.WriteShort((short)(a_Entity.GetSpeedY() * 400));
Pkt.WriteShort((short)(a_Entity.GetSpeedZ() * 400));
- }*/
+ }
}
@@ -1570,6 +1572,71 @@ bool cProtocol180::CompressPacket(const AString & a_Packet, AString & a_Compress
+int cProtocol180::GetParticleID(const AString & a_ParticleName)
+{
+ static bool IsInitialized = false;
+ static std::map<AString, int> ParticleMap;
+ if (!IsInitialized)
+ {
+ // Initialize the ParticleMap:
+ ParticleMap["explode"] = 0;
+ ParticleMap["largeexplode"] = 1;
+ ParticleMap["hugeexplosion"] = 2;
+ ParticleMap["fireworksspark"] = 3;
+ ParticleMap["bubble"] = 4;
+ ParticleMap["splash"] = 5;
+ ParticleMap["wake"] = 6;
+ ParticleMap["suspended"] = 7;
+ ParticleMap["depthsuspend"] = 8;
+ ParticleMap["crit"] = 9;
+ ParticleMap["magiccrit"] = 10;
+ ParticleMap["smoke"] = 11;
+ ParticleMap["largesmoke"] = 12;
+ ParticleMap["spell"] = 13;
+ ParticleMap["instantspell"] = 14;
+ ParticleMap["mobspell"] = 15;
+ ParticleMap["mobspellambient"] = 16;
+ ParticleMap["witchmagic"] = 17;
+ ParticleMap["dripwater"] = 18;
+ ParticleMap["driplava"] = 19;
+ ParticleMap["angryvillager"] = 20;
+ ParticleMap["happyVillager"] = 21;
+ ParticleMap["townaura"] = 22;
+ ParticleMap["note"] = 23;
+ ParticleMap["portal"] = 24;
+ ParticleMap["enchantmenttable"] = 25;
+ ParticleMap["flame"] = 26;
+ ParticleMap["lava"] = 27;
+ ParticleMap["footstep"] = 28;
+ ParticleMap["cloud"] = 29;
+ ParticleMap["reddust"] = 30;
+ ParticleMap["snowballpoof"] = 31;
+ ParticleMap["snowshovel"] = 32;
+ ParticleMap["slime"] = 33;
+ ParticleMap["heart"] = 34;
+ ParticleMap["barrier"] = 35;
+ ParticleMap["iconcrack"] = 36;
+ ParticleMap["blockcrack"] = 37;
+ ParticleMap["blockdust"] = 38;
+ ParticleMap["droplet"] = 39;
+ ParticleMap["take"] = 40;
+ ParticleMap["mobappearance"] = 41;
+ }
+
+ AString ParticleName = StrToLower(a_ParticleName);
+ if (ParticleMap.find(ParticleName) == ParticleMap.end())
+ {
+ LOGWARNING("Unknown particle: %s", a_ParticleName.c_str());
+ return 0;
+ }
+
+ return ParticleMap[ParticleName];
+}
+
+
+
+
+
void cProtocol180::AddReceivedData(const char * a_Data, size_t a_Size)
{
// Write the incoming data into the comm log file:
@@ -2685,13 +2752,20 @@ void cProtocol180::cPacketizer::WriteUUID(const AString & a_UUID)
{
AString UUID_1 = a_UUID.substr(0, a_UUID.length() / 2);
AString UUID_2 = a_UUID.substr(a_UUID.length() / 2);
-
- UInt64 Value_1, Value_2;
+
+ Int64 Value_1, Value_2;
sscanf(UUID_1.c_str(), "%llx", &Value_1);
sscanf(UUID_2.c_str(), "%llx", &Value_2);
- WriteInt64((Int64)Value_1);
- WriteInt64((Int64)Value_2);
+ AString SValue_1, SValue_2;
+ Printf(SValue_1, "%lld", Value_1);
+ Printf(SValue_2, "%lld", Value_2);
+
+ StringToInteger<Int64>(SValue_1.c_str(), Value_1);
+ StringToInteger<Int64>(SValue_2.c_str(), Value_2);
+
+ WriteInt64(Value_1);
+ WriteInt64(Value_2);
}
diff --git a/src/Protocol/Protocol18x.h b/src/Protocol/Protocol18x.h
index 33e298e48..2b3063556 100644
--- a/src/Protocol/Protocol18x.h
+++ b/src/Protocol/Protocol18x.h
@@ -96,7 +96,7 @@ public:
virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
virtual void SendPlayerAbilities (void) override;
virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override;
- virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) override;
+ virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override;
virtual void SendPlayerListItem (const cPlayer & a_Player, char a_Action) override;
virtual void SendPlayerMaxSpeed (void) override;
virtual void SendPlayerMoveLook (void) override;
@@ -138,6 +138,9 @@ public:
If compression fails, the function returns false. */
static bool CompressPacket(const AString & a_Packet, AString & a_Compressed);
+ /** The 1.8 protocol use a particle id instead of a string. This function converts the name to the id. If the name is incorrect, it returns 0. */
+ static int GetParticleID(const AString & a_ParticleName);
+
protected:
/** Composes individual packets in the protocol's m_OutPacketBuffer; sends them upon being destructed */
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp
index 56e5b43f3..cf63583db 100644
--- a/src/Protocol/ProtocolRecognizer.cpp
+++ b/src/Protocol/ProtocolRecognizer.cpp
@@ -441,10 +441,10 @@ void cProtocolRecognizer::SendMapInfo(int a_ID, unsigned int a_Scale)
-void cProtocolRecognizer::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount)
+void cProtocolRecognizer::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount)
{
ASSERT(m_Protocol != NULL);
- m_Protocol->SendParticleEffect(a_ParticleName, a_SrcX, a_SrcY, a_SrcZ, a_OffsetX, a_OffsetY, a_OffsetZ, a_ParticleData, a_ParticleAmmount);
+ m_Protocol->SendParticleEffect(a_ParticleName, a_SrcX, a_SrcY, a_SrcZ, a_OffsetX, a_OffsetY, a_OffsetZ, a_ParticleData, a_ParticleAmount);
}
diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h
index 4d2bceb68..f73b0b92a 100644
--- a/src/Protocol/ProtocolRecognizer.h
+++ b/src/Protocol/ProtocolRecognizer.h
@@ -96,7 +96,7 @@ public:
virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) override;
virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators) override;
virtual void SendMapInfo (int a_ID, unsigned int a_Scale) override;
- virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) override;
+ virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override;
virtual void SendPaintingSpawn (const cPainting & a_Painting) override;
virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
virtual void SendPlayerAbilities (void) override;
diff --git a/src/World.cpp b/src/World.cpp
index 0e0846943..351dded24 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -2138,9 +2138,9 @@ void cWorld::BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation
-void cWorld::BroadcastParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount, cClientHandle * a_Exclude)
+void cWorld::BroadcastParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount, cClientHandle * a_Exclude)
{
- m_ChunkMap->BroadcastParticleEffect(a_ParticleName, a_SrcX, a_SrcY, a_SrcZ, a_OffsetX, a_OffsetY, a_OffsetZ, a_ParticleData, a_ParticleAmmount, a_Exclude);
+ m_ChunkMap->BroadcastParticleEffect(a_ParticleName, a_SrcX, a_SrcY, a_SrcZ, a_OffsetX, a_OffsetY, a_OffsetZ, a_ParticleData, a_ParticleAmount, a_Exclude);
}
diff --git a/src/World.h b/src/World.h
index fae784c20..2c363c0af 100644
--- a/src/World.h
+++ b/src/World.h
@@ -236,7 +236,7 @@ public:
void BroadcastEntityStatus (const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude = NULL);
void BroadcastEntityVelocity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
virtual void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL) override; // tolua_export
- void BroadcastParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount, cClientHandle * a_Exclude = NULL); // tolua_export
+ void BroadcastParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount, cClientHandle * a_Exclude = NULL); // tolua_export
void BroadcastPlayerListItem (const cPlayer & a_Player, char a_Action, const cClientHandle * a_Exclude = NULL);
void BroadcastRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID, const cClientHandle * a_Exclude = NULL);
void BroadcastScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode);