summaryrefslogtreecommitdiffstats
path: root/source/cChunkMap.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-24 09:58:26 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-24 09:58:26 +0200
commite92b9e7ecbdf2918aab59d4eeb7bb5966430b264 (patch)
tree1a998d44e5faab91c54ea8517dd9fa02b3732ef7 /source/cChunkMap.cpp
parentAdded plugin name to deprecation messages (diff)
downloadcuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar.gz
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar.bz2
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar.lz
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar.xz
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar.zst
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.zip
Diffstat (limited to 'source/cChunkMap.cpp')
-rw-r--r--source/cChunkMap.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/source/cChunkMap.cpp b/source/cChunkMap.cpp
index c6220bf76..b8e8b05c6 100644
--- a/source/cChunkMap.cpp
+++ b/source/cChunkMap.cpp
@@ -435,6 +435,56 @@ void cChunkMap::BroadcastMetadata(const cPawn & a_Pawn, const cClientHandle * a_
+void cChunkMap::BroadcastSpawn(cEntity & a_Entity, const cClientHandle * a_Exclude)
+{
+ cCSLock Lock(m_CSLayers);
+ cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), a_Entity.GetChunkY(), a_Entity.GetChunkZ());
+ if (Chunk == NULL)
+ {
+ return;
+ }
+ // It's perfectly legal to broadcast packets even to invalid chunks!
+ Chunk->BroadcastSpawn(a_Entity, a_Exclude);
+}
+
+
+
+
+
+void cChunkMap::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude)
+{
+ cCSLock Lock(m_CSLayers);
+ int ChunkX, ChunkZ;
+ cChunkDef::BlockToChunk(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ);
+ cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ);
+ if ((Chunk == NULL) || !Chunk->IsValid())
+ {
+ return;
+ }
+ Chunk->BroadcastBlockEntity(a_BlockX, a_BlockY, a_BlockZ, a_Exclude);
+}
+
+
+
+
+
+void cChunkMap::SendBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client)
+{
+ cCSLock Lock(m_CSLayers);
+ int ChunkX, ChunkZ;
+ cChunkDef::BlockToChunk(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ);
+ cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ);
+ if ((Chunk == NULL) || !Chunk->IsValid())
+ {
+ return;
+ }
+ Chunk->SendBlockEntity(a_BlockX, a_BlockY, a_BlockZ, a_Client);
+}
+
+
+
+
+
void cChunkMap::UseBlockEntity(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
{
// a_Player rclked block entity at the coords specified, handle it