summaryrefslogtreecommitdiffstats
path: root/src/Chunk.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2013-12-14 22:00:30 +0100
committerMattes D <github@xoft.cz>2013-12-14 22:00:30 +0100
commit22ee94ffaf2ff1098a77b2e9a2a97040e0d1986e (patch)
tree4299dac2569ac649645a28bbe8aa50f1ba9de246 /src/Chunk.cpp
parentMerge pull request #429 from worktycho/quickfixs (diff)
parentPotentially fixed debug asserts (diff)
downloadcuberite-22ee94ffaf2ff1098a77b2e9a2a97040e0d1986e.tar
cuberite-22ee94ffaf2ff1098a77b2e9a2a97040e0d1986e.tar.gz
cuberite-22ee94ffaf2ff1098a77b2e9a2a97040e0d1986e.tar.bz2
cuberite-22ee94ffaf2ff1098a77b2e9a2a97040e0d1986e.tar.lz
cuberite-22ee94ffaf2ff1098a77b2e9a2a97040e0d1986e.tar.xz
cuberite-22ee94ffaf2ff1098a77b2e9a2a97040e0d1986e.tar.zst
cuberite-22ee94ffaf2ff1098a77b2e9a2a97040e0d1986e.zip
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r--src/Chunk.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 42969bf6d..b3c1896dc 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -2225,6 +2225,38 @@ bool cChunk::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceC
+bool cChunk::DoWithNoteBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cNoteBlockCallback & 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 ((*itr)->GetBlockType() != E_BLOCK_NOTE_BLOCK)
+ {
+ // 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;
+ }
+
+ // The correct block entity is here,
+ if (a_Callback.Item((cNoteEntity *)*itr))
+ {
+ return false;
+ }
+ return true;
+ } // for itr - m_BlockEntitites[]
+
+ // Not found:
+ return false;
+}
+
+
+
+
+
bool cChunk::GetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4)
{
// The blockentity list is locked by the parent chunkmap's CS