MCPcopy Create free account
hub / github.com/cuberite/cuberite / LockedGetBlock

Method LockedGetBlock

src/ChunkMap.cpp:209–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207
208
209bool cChunkMap::LockedGetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta)
210{
211 // We already have m_CSLayers locked since this can be called only from within the tick thread
212 ASSERT(m_CSLayers.IsLockedByCurrentThread());
213
214 int ChunkX, ChunkZ;
215 cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ);
216 cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ);
217 if (Chunk == NULL)
218 {
219 return false;
220 }
221
222 int Index = cChunkDef::MakeIndexNoCheck(a_BlockX, a_BlockY, a_BlockZ);
223 a_BlockType = Chunk->GetBlock(Index);
224 a_BlockMeta = Chunk->GetMeta(Index);
225 return true;
226}
227
228
229

Callers

nothing calls this directly

Calls 3

GetMetaMethod · 0.80
GetBlockMethod · 0.45

Tested by

no test coverage detected