summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-05-25 14:46:34 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-05-25 14:46:34 +0200
commitee929793f09c431693e1bef7edd77213ba412f60 (patch)
tree566189dcea2b6cac9d3bd2958026b9ad9a264027 /src/World.cpp
parentUpdated Core (diff)
downloadcuberite-ee929793f09c431693e1bef7edd77213ba412f60.tar
cuberite-ee929793f09c431693e1bef7edd77213ba412f60.tar.gz
cuberite-ee929793f09c431693e1bef7edd77213ba412f60.tar.bz2
cuberite-ee929793f09c431693e1bef7edd77213ba412f60.tar.lz
cuberite-ee929793f09c431693e1bef7edd77213ba412f60.tar.xz
cuberite-ee929793f09c431693e1bef7edd77213ba412f60.tar.zst
cuberite-ee929793f09c431693e1bef7edd77213ba412f60.zip
Diffstat (limited to '')
-rw-r--r--src/World.cpp48
1 files changed, 46 insertions, 2 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 807065bfa..29046bba9 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -1551,9 +1551,9 @@ bool cWorld::SetAreaBiome(const cCuboid & a_Area, EMCSBiome a_Biome)
-void cWorld::SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
+void cWorld::SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, bool a_SendToClients)
{
- m_ChunkMap->SetBlock(*this, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
+ m_ChunkMap->SetBlock(*this, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_SendToClients);
}
@@ -3128,6 +3128,50 @@ void cWorld::cTaskUnloadUnusedChunks::Run(cWorld & a_World)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cWorld::cTaskSendBlockTo
+
+cWorld::cTaskSendBlockToAllPlayers::cTaskSendBlockToAllPlayers(int a_BlockX, int a_BlockY, int a_BlockZ) :
+ m_BlockX(a_BlockX),
+ m_BlockY(a_BlockY),
+ m_BlockZ(a_BlockZ)
+{
+}
+
+void cWorld::cTaskSendBlockToAllPlayers::Run(cWorld & a_World)
+{
+ class cPlayerCallback :
+ public cPlayerListCallback
+ {
+ public:
+ cPlayerCallback(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld & a_World) :
+ m_BlockX(a_BlockX),
+ m_BlockY(a_BlockY),
+ m_BlockZ(a_BlockZ),
+ m_World(a_World)
+ {
+ }
+
+ virtual bool Item(cPlayer * a_Player)
+ {
+ m_World.SendBlockTo(m_BlockX, m_BlockY, m_BlockZ, a_Player);
+ return false;
+ }
+
+ private:
+
+ int m_BlockX, m_BlockY, m_BlockZ;
+ cWorld & m_World;
+
+ } PlayerCallback(m_BlockX, m_BlockY, m_BlockZ, a_World);
+
+ a_World.ForEachPlayer(PlayerCallback);
+}
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cWorld::cChunkGeneratorCallbacks:
cWorld::cChunkGeneratorCallbacks::cChunkGeneratorCallbacks(cWorld & a_World) :