diff options
author | luksor111@gmail.com <luksor111@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-12-26 18:16:33 +0100 |
---|---|---|
committer | luksor111@gmail.com <luksor111@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-12-26 18:16:33 +0100 |
commit | 575abe8691bf2f615f17e6212ea5ec6265ffd4ed (patch) | |
tree | d37b31c6eac993b643cf0dccd7d38c2fe316ff04 /source/ChunkMap.cpp | |
parent | Adjusted the protocol framework to support different types of falling block spawning. (diff) | |
download | cuberite-575abe8691bf2f615f17e6212ea5ec6265ffd4ed.tar cuberite-575abe8691bf2f615f17e6212ea5ec6265ffd4ed.tar.gz cuberite-575abe8691bf2f615f17e6212ea5ec6265ffd4ed.tar.bz2 cuberite-575abe8691bf2f615f17e6212ea5ec6265ffd4ed.tar.lz cuberite-575abe8691bf2f615f17e6212ea5ec6265ffd4ed.tar.xz cuberite-575abe8691bf2f615f17e6212ea5ec6265ffd4ed.tar.zst cuberite-575abe8691bf2f615f17e6212ea5ec6265ffd4ed.zip |
Diffstat (limited to 'source/ChunkMap.cpp')
-rw-r--r-- | source/ChunkMap.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/source/ChunkMap.cpp b/source/ChunkMap.cpp index 61ca51ab0..ede16ffa6 100644 --- a/source/ChunkMap.cpp +++ b/source/ChunkMap.cpp @@ -1354,6 +1354,21 @@ bool cChunkMap::ForEachChestInChunk(int a_ChunkX, int a_ChunkZ, cChestCallback & +bool cChunkMap::ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallback & 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->ForEachDispenser(a_Callback); +} + + + + + bool cChunkMap::ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallback & a_Callback) { cCSLock Lock(m_CSLayers); @@ -1387,6 +1402,24 @@ bool cChunkMap::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCa +bool cChunkMap::DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & 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->DoWithDispenserAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); +} + + + + + bool cChunkMap::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback) { int ChunkX, ChunkZ; |