diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-12-14 17:52:22 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-12-14 17:52:22 +0100 |
commit | 95be80cdb5322720e7c9fbd13ec2692288afd931 (patch) | |
tree | 67c1bbcf1ebe887521d7c24dc5c2a2a84e5d3494 /src/Chunk.cpp | |
parent | Update Core (diff) | |
download | cuberite-95be80cdb5322720e7c9fbd13ec2692288afd931.tar cuberite-95be80cdb5322720e7c9fbd13ec2692288afd931.tar.gz cuberite-95be80cdb5322720e7c9fbd13ec2692288afd931.tar.bz2 cuberite-95be80cdb5322720e7c9fbd13ec2692288afd931.tar.lz cuberite-95be80cdb5322720e7c9fbd13ec2692288afd931.tar.xz cuberite-95be80cdb5322720e7c9fbd13ec2692288afd931.tar.zst cuberite-95be80cdb5322720e7c9fbd13ec2692288afd931.zip |
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r-- | src/Chunk.cpp | 32 |
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 |