diff options
author | Alexander Harkness <bearbin@gmail.com> | 2013-11-24 15:37:03 +0100 |
---|---|---|
committer | Alexander Harkness <bearbin@gmail.com> | 2013-11-24 15:37:03 +0100 |
commit | c3cd436ec3526962f0f0698ab2d75774247c340b (patch) | |
tree | af5fa89e891ede194f981399af8b830afc6dec97 /src/ChunkMap.cpp | |
parent | Removed pedantic build and added optimisation to debug builds. (diff) | |
parent | RCONClient: Initial implementation. (diff) | |
download | cuberite-c3cd436ec3526962f0f0698ab2d75774247c340b.tar cuberite-c3cd436ec3526962f0f0698ab2d75774247c340b.tar.gz cuberite-c3cd436ec3526962f0f0698ab2d75774247c340b.tar.bz2 cuberite-c3cd436ec3526962f0f0698ab2d75774247c340b.tar.lz cuberite-c3cd436ec3526962f0f0698ab2d75774247c340b.tar.xz cuberite-c3cd436ec3526962f0f0698ab2d75774247c340b.tar.zst cuberite-c3cd436ec3526962f0f0698ab2d75774247c340b.zip |
Diffstat (limited to 'src/ChunkMap.cpp')
-rw-r--r-- | src/ChunkMap.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index 73a16dbb4..9d55917e5 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -1702,6 +1702,21 @@ bool cChunkMap::DoWithEntityByID(int a_UniqueID, cEntityCallback & a_Callback) +bool cChunkMap::ForEachBlockEntityInChunk(int a_ChunkX, int a_ChunkZ, cBlockEntityCallback & a_Callback) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->ForEachBlockEntity(a_Callback); +} + + + + + bool cChunkMap::ForEachChestInChunk(int a_ChunkX, int a_ChunkZ, cChestCallback & a_Callback) { cCSLock Lock(m_CSLayers); @@ -1777,6 +1792,24 @@ bool cChunkMap::ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallba +bool cChunkMap::DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback & a_Callback) +{ + int ChunkX, ChunkZ; + int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; + cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->DoWithBlockEntityAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); +} + + + + + bool cChunkMap::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback) { int ChunkX, ChunkZ; |