summaryrefslogtreecommitdiffstats
path: root/src/Chunk.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-08-06 17:14:39 +0200
committerMattes D <github@xoft.cz>2014-08-06 17:14:39 +0200
commiteae42d91f91eadeb9b1d021a685c7cc2b3799ebe (patch)
treecc197b2a677edaa30667e71caae4ee93d5bbd8e5 /src/Chunk.cpp
parentResending fire to the client when the interact cancelled. (diff)
parentFixed style issues (diff)
downloadcuberite-eae42d91f91eadeb9b1d021a685c7cc2b3799ebe.tar
cuberite-eae42d91f91eadeb9b1d021a685c7cc2b3799ebe.tar.gz
cuberite-eae42d91f91eadeb9b1d021a685c7cc2b3799ebe.tar.bz2
cuberite-eae42d91f91eadeb9b1d021a685c7cc2b3799ebe.tar.lz
cuberite-eae42d91f91eadeb9b1d021a685c7cc2b3799ebe.tar.xz
cuberite-eae42d91f91eadeb9b1d021a685c7cc2b3799ebe.tar.zst
cuberite-eae42d91f91eadeb9b1d021a685c7cc2b3799ebe.zip
Diffstat (limited to '')
-rw-r--r--src/Chunk.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index cd7dc698c..a79a485a6 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -2127,6 +2127,41 @@ 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:
+ case E_BLOCK_NOTE_BLOCK:
+ 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