summaryrefslogtreecommitdiffstats
path: root/source/Chunk.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/Chunk.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/Chunk.cpp')
-rw-r--r--source/Chunk.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/source/Chunk.cpp b/source/Chunk.cpp
index 6e83d32ea..7e71e9ea7 100644
--- a/source/Chunk.cpp
+++ b/source/Chunk.cpp
@@ -1840,6 +1840,24 @@ bool cChunk::DoWithEntityByID(int a_EntityID, cEntityCallback & a_Callback, bool
+bool cChunk::ForEachBlockEntity(cBlockEntityCallback & a_Callback)
+{
+ // The blockentity list is locked by the parent chunkmap's CS
+ for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2)
+ {
+ ++itr2;
+ if (a_Callback.Item(*itr))
+ {
+ return false;
+ }
+ } // for itr - m_BlockEntitites[]
+ return true;
+}
+
+
+
+
+
bool cChunk::ForEachChest(cChestCallback & a_Callback)
{
// The blockentity list is locked by the parent chunkmap's CS
@@ -1958,6 +1976,32 @@ bool cChunk::ForEachFurnace(cFurnaceCallback & a_Callback)
+bool cChunk::DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback & a_Callback)
+{
+ // The blockentity list is locked by the parent chunkmap's CS
+ for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2)
+ {
+ ++itr2;
+ if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ))
+ {
+ continue;
+ }
+
+ if (a_Callback.Item(*itr))
+ {
+ return false;
+ }
+ return true;
+ } // for itr - m_BlockEntitites[]
+
+ // Not found:
+ return false;
+}
+
+
+
+
+
bool cChunk::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback)
{
// The blockentity list is locked by the parent chunkmap's CS