diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-02-18 21:40:02 +0100 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-02-18 21:40:02 +0100 |
commit | 52c41f886927cf62ed592ba7fec974eee6b16844 (patch) | |
tree | a8479e65d606e2bcdf092501f30a43b778917d13 /src/Chunk.cpp | |
parent | Add Skulls/Heads (diff) | |
download | cuberite-52c41f886927cf62ed592ba7fec974eee6b16844.tar cuberite-52c41f886927cf62ed592ba7fec974eee6b16844.tar.gz cuberite-52c41f886927cf62ed592ba7fec974eee6b16844.tar.bz2 cuberite-52c41f886927cf62ed592ba7fec974eee6b16844.tar.lz cuberite-52c41f886927cf62ed592ba7fec974eee6b16844.tar.xz cuberite-52c41f886927cf62ed592ba7fec974eee6b16844.tar.zst cuberite-52c41f886927cf62ed592ba7fec974eee6b16844.zip |
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r-- | src/Chunk.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp index c66dae7b4..8b03732f3 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -19,6 +19,7 @@ #include "BlockEntities/JukeboxEntity.h" #include "BlockEntities/NoteEntity.h" #include "BlockEntities/SignEntity.h" +#include "BlockEntities/SkullEntity.h" #include "Entities/Pickup.h" #include "Item.h" #include "Noise.h" @@ -2311,6 +2312,38 @@ bool cChunk::DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCom +bool cChunk::DoWithSkullBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cSkullBlockCallback & 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_HEAD) + { + // 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((cSkullEntity *)*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 |