summaryrefslogtreecommitdiffstats
path: root/src/SetChunkData.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-08-30 12:21:39 +0200
committerHowaner <franzi.moos@googlemail.com>2014-08-30 12:21:39 +0200
commit80bd0a54579cbe5188d42bf8e1e51724d19a6fcf (patch)
tree39ded239dea2d76854283a47b3f29cc12b8801e1 /src/SetChunkData.cpp
parentAdded speed entity effect. (diff)
parentcChunk: Fixed the Coords param. (diff)
downloadcuberite-80bd0a54579cbe5188d42bf8e1e51724d19a6fcf.tar
cuberite-80bd0a54579cbe5188d42bf8e1e51724d19a6fcf.tar.gz
cuberite-80bd0a54579cbe5188d42bf8e1e51724d19a6fcf.tar.bz2
cuberite-80bd0a54579cbe5188d42bf8e1e51724d19a6fcf.tar.lz
cuberite-80bd0a54579cbe5188d42bf8e1e51724d19a6fcf.tar.xz
cuberite-80bd0a54579cbe5188d42bf8e1e51724d19a6fcf.tar.zst
cuberite-80bd0a54579cbe5188d42bf8e1e51724d19a6fcf.zip
Diffstat (limited to '')
-rw-r--r--src/SetChunkData.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/SetChunkData.cpp b/src/SetChunkData.cpp
index af6ad1251..97903074a 100644
--- a/src/SetChunkData.cpp
+++ b/src/SetChunkData.cpp
@@ -5,6 +5,7 @@
#include "Globals.h"
#include "SetChunkData.h"
+#include "BlockEntities/BlockEntity.h"
@@ -116,3 +117,35 @@ void cSetChunkData::CalculateHeightMap(void)
+
+void cSetChunkData::RemoveInvalidBlockEntities(void)
+{
+ for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end();)
+ {
+ BLOCKTYPE EntityBlockType = (*itr)->GetBlockType();
+ BLOCKTYPE WorldBlockType = cChunkDef::GetBlock(m_BlockTypes, (*itr)->GetRelX(), (*itr)->GetPosY(), (*itr)->GetRelZ());
+ if (EntityBlockType != WorldBlockType)
+ {
+ // Bad blocktype, remove the block entity:
+ LOGD("Block entity blocktype mismatch at {%d, %d, %d}: entity for blocktype %s(%d) in block %s(%d). Deleting the block entity.",
+ (*itr)->GetPosX(), (*itr)->GetPosY(), (*itr)->GetPosZ(),
+ ItemTypeToString(EntityBlockType).c_str(), EntityBlockType,
+ ItemTypeToString(WorldBlockType).c_str(), WorldBlockType
+ );
+ cBlockEntityList::iterator itr2 = itr;
+ itr2++;
+ m_BlockEntities.erase(itr);
+ delete *itr;
+ itr = itr2;
+ }
+ else
+ {
+ // Good blocktype, keep the block entity:
+ ++itr;
+ }
+ } // for itr - m_BlockEntities[]
+}
+
+
+
+