summaryrefslogtreecommitdiffstats
path: root/source/cChunkMap.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-15 15:22:44 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-15 15:22:44 +0100
commit1aebcea095e92572a39cb6555cba8517234b156c (patch)
treebbef44ce857aa49b2171ef43bedc2e802fbd5dd8 /source/cChunkMap.cpp
parentCan now pass any argument to cWorld:ForEachPlayer in Lua! But I'm not even using it.. lol (diff)
downloadcuberite-1aebcea095e92572a39cb6555cba8517234b156c.tar
cuberite-1aebcea095e92572a39cb6555cba8517234b156c.tar.gz
cuberite-1aebcea095e92572a39cb6555cba8517234b156c.tar.bz2
cuberite-1aebcea095e92572a39cb6555cba8517234b156c.tar.lz
cuberite-1aebcea095e92572a39cb6555cba8517234b156c.tar.xz
cuberite-1aebcea095e92572a39cb6555cba8517234b156c.tar.zst
cuberite-1aebcea095e92572a39cb6555cba8517234b156c.zip
Diffstat (limited to '')
-rw-r--r--source/cChunkMap.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/source/cChunkMap.cpp b/source/cChunkMap.cpp
index b864b9792..efb69aca0 100644
--- a/source/cChunkMap.cpp
+++ b/source/cChunkMap.cpp
@@ -136,6 +136,44 @@ cChunkPtr cChunkMap::GetChunkNoGen( int a_ChunkX, int a_ChunkY, int a_ChunkZ )
+void cChunkMap::BroadcastToChunkOfBlock(int a_X, int a_Y, int a_Z, cPacket * a_Packet, cClientHandle * a_Exclude)
+{
+ // Broadcasts a_Packet to all clients in the chunk where block [x, y, z] is, except to client a_Exclude
+
+ cCSLock Lock(m_CSLayers);
+ int ChunkX, ChunkZ;
+ BlockToChunk(a_X, a_Y, a_Z, ChunkX, ChunkZ);
+ cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ);
+ if (Chunk == NULL)
+ {
+ return;
+ }
+ // Packets can be broadcasted even to invalid chunks!
+ Chunk->Broadcast(a_Packet);
+}
+
+
+
+
+
+void cChunkMap::UseBlockEntity(cPlayer * a_Player, int a_X, int a_Y, int a_Z)
+{
+ // a_Player rclked block entity at the coords specified, handle it
+ cCSLock Lock(m_CSLayers);
+ int ChunkX, ChunkZ;
+ BlockToChunk(a_X, a_Y, a_Z, ChunkX, ChunkZ);
+ cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ);
+ if ((Chunk == NULL) || !Chunk->IsValid())
+ {
+ return;
+ }
+ Chunk->UseBlockEntity(a_Player, a_X, a_Y, a_Z);
+}
+
+
+
+
+
void cChunkMap::Tick( float a_Dt, MTRand & a_TickRandom )
{
cCSLock Lock(m_CSLayers);