summaryrefslogtreecommitdiffstats
path: root/source/ChunkMap.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-11-20 21:53:29 +0100
committermadmaxoft <github@xoft.cz>2013-11-20 21:53:29 +0100
commita5c2d639c612031331a668a483339f3025c7041f (patch)
tree8268a6d541765ca1ac681344f4d5c37c80740674 /source/ChunkMap.cpp
parentIgnoring SDF files. (diff)
downloadcuberite-a5c2d639c612031331a668a483339f3025c7041f.tar
cuberite-a5c2d639c612031331a668a483339f3025c7041f.tar.gz
cuberite-a5c2d639c612031331a668a483339f3025c7041f.tar.bz2
cuberite-a5c2d639c612031331a668a483339f3025c7041f.tar.lz
cuberite-a5c2d639c612031331a668a483339f3025c7041f.tar.xz
cuberite-a5c2d639c612031331a668a483339f3025c7041f.tar.zst
cuberite-a5c2d639c612031331a668a483339f3025c7041f.zip
Diffstat (limited to 'source/ChunkMap.cpp')
-rw-r--r--source/ChunkMap.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/source/ChunkMap.cpp b/source/ChunkMap.cpp
index 73a16dbb4..9d55917e5 100644
--- a/source/ChunkMap.cpp
+++ b/source/ChunkMap.cpp
@@ -1702,6 +1702,21 @@ bool cChunkMap::DoWithEntityByID(int a_UniqueID, cEntityCallback & a_Callback)
+bool cChunkMap::ForEachBlockEntityInChunk(int a_ChunkX, int a_ChunkZ, cBlockEntityCallback & a_Callback)
+{
+ cCSLock Lock(m_CSLayers);
+ cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ);
+ if ((Chunk == NULL) && !Chunk->IsValid())
+ {
+ return false;
+ }
+ return Chunk->ForEachBlockEntity(a_Callback);
+}
+
+
+
+
+
bool cChunkMap::ForEachChestInChunk(int a_ChunkX, int a_ChunkZ, cChestCallback & a_Callback)
{
cCSLock Lock(m_CSLayers);
@@ -1777,6 +1792,24 @@ bool cChunkMap::ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallba
+bool cChunkMap::DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback & a_Callback)
+{
+ int ChunkX, ChunkZ;
+ int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ;
+ cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ);
+ cCSLock Lock(m_CSLayers);
+ cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ);
+ if ((Chunk == NULL) && !Chunk->IsValid())
+ {
+ return false;
+ }
+ return Chunk->DoWithBlockEntityAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
+}
+
+
+
+
+
bool cChunkMap::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback)
{
int ChunkX, ChunkZ;