summaryrefslogtreecommitdiffstats
path: root/src/Chunk.cpp
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-08-05 22:48:23 +0200
committerTycho <work.tycho+git@gmail.com>2014-08-05 22:48:23 +0200
commit06942871dde1388284a4fe222040720de3923b03 (patch)
treefb63be31f559ccb37ef0a05fd5148edef270fcfa /src/Chunk.cpp
parentFixed unsigned long comparison to size_t (diff)
downloadcuberite-06942871dde1388284a4fe222040720de3923b03.tar
cuberite-06942871dde1388284a4fe222040720de3923b03.tar.gz
cuberite-06942871dde1388284a4fe222040720de3923b03.tar.bz2
cuberite-06942871dde1388284a4fe222040720de3923b03.tar.lz
cuberite-06942871dde1388284a4fe222040720de3923b03.tar.xz
cuberite-06942871dde1388284a4fe222040720de3923b03.tar.zst
cuberite-06942871dde1388284a4fe222040720de3923b03.zip
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r--src/Chunk.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index cd7dc698c..9e06f58ec 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -2127,6 +2127,40 @@ bool cChunk::DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBloc
+bool cChunk::DoWithRedstonePoweredEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cRedstonePoweredCallback & 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;
+ }
+ switch ((*itr)->GetBlockType())
+ {
+ case E_BLOCK_DROPPER:
+ case E_BLOCK_DISPENSER:
+ break;
+ default:
+ // There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out
+ return false;
+ }
+
+ if (a_Callback.Item((cRedstonePoweredEntity *)*itr))
+ {
+ return false;
+ }
+ return true;
+ } // for itr - m_BlockEntitites[]
+
+ // Not found:
+ return false;
+}
+
+
+
+
bool cChunk::DoWithBeaconAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBeaconCallback & a_Callback)
{
// The blockentity list is locked by the parent chunkmap's CS