summaryrefslogtreecommitdiffstats
path: root/src/Chunk.cpp
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-01-18 14:16:47 +0100
committerandrew <xdotftw@gmail.com>2014-01-18 14:16:47 +0100
commit9a9b51a5134d8afd8f089d247c59668bd7da695d (patch)
tree74be5c51628307a8ddf8ce39a0236dfb511c7941 /src/Chunk.cpp
parentMerge pull request #552 from worktycho/c++11 (diff)
downloadcuberite-9a9b51a5134d8afd8f089d247c59668bd7da695d.tar
cuberite-9a9b51a5134d8afd8f089d247c59668bd7da695d.tar.gz
cuberite-9a9b51a5134d8afd8f089d247c59668bd7da695d.tar.bz2
cuberite-9a9b51a5134d8afd8f089d247c59668bd7da695d.tar.lz
cuberite-9a9b51a5134d8afd8f089d247c59668bd7da695d.tar.xz
cuberite-9a9b51a5134d8afd8f089d247c59668bd7da695d.tar.zst
cuberite-9a9b51a5134d8afd8f089d247c59668bd7da695d.zip
Diffstat (limited to '')
-rw-r--r--src/Chunk.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 0735c8144..a72464ec3 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -1298,6 +1298,7 @@ void cChunk::CreateBlockEntities(void)
switch (BlockType)
{
case E_BLOCK_CHEST:
+ case E_BLOCK_COMMAND_BLOCK:
case E_BLOCK_DISPENSER:
case E_BLOCK_DROPPER:
case E_BLOCK_ENDER_CHEST:
@@ -1425,6 +1426,7 @@ void cChunk::SetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType,
switch (a_BlockType)
{
case E_BLOCK_CHEST:
+ case E_BLOCK_COMMAND_BLOCK:
case E_BLOCK_DISPENSER:
case E_BLOCK_DROPPER:
case E_BLOCK_ENDER_CHEST:
@@ -2268,6 +2270,38 @@ bool cChunk::DoWithNoteBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cNoteBl
+bool cChunk::DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCommandBlockCallback & 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_COMMAND_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((cCommandBlockEntity *)*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