summaryrefslogtreecommitdiffstats
path: root/src/Chunk.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-02-18 21:40:02 +0100
committerTheJumper <maximilian.springer@web.de>2014-02-23 19:50:50 +0100
commit7bc59468832f2eb25f64194ba29da4a821a33866 (patch)
treeb22a6888cc8ff883c227835c426e1d786523d970 /src/Chunk.cpp
parentAdd Skulls/Heads (diff)
downloadcuberite-7bc59468832f2eb25f64194ba29da4a821a33866.tar
cuberite-7bc59468832f2eb25f64194ba29da4a821a33866.tar.gz
cuberite-7bc59468832f2eb25f64194ba29da4a821a33866.tar.bz2
cuberite-7bc59468832f2eb25f64194ba29da4a821a33866.tar.lz
cuberite-7bc59468832f2eb25f64194ba29da4a821a33866.tar.xz
cuberite-7bc59468832f2eb25f64194ba29da4a821a33866.tar.zst
cuberite-7bc59468832f2eb25f64194ba29da4a821a33866.zip
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r--src/Chunk.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index dc683baa5..d386b85f8 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"
@@ -2343,6 +2344,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