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

Method GetBlock

src/ChunkMap.cpp:1144–1171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1142
1143
1144BLOCKTYPE cChunkMap::GetBlock(int a_BlockX, int a_BlockY, int a_BlockZ)
1145{
1146 // First check if it isn't queued in the m_FastSetBlockQueue:
1147 {
1148 int X = a_BlockX, Y = a_BlockY, Z = a_BlockZ;
1149 int ChunkX, ChunkY, ChunkZ;
1150 cChunkDef::AbsoluteToRelative(X, Y, Z, ChunkX, ChunkZ);
1151 ChunkY = 0;
1152 cCSLock Lock(m_CSFastSetBlock);
1153 for (sSetBlockList::iterator itr = m_FastSetBlockQueue.begin(); itr != m_FastSetBlockQueue.end(); ++itr)
1154 {
1155 if ((itr->x == X) && (itr->y == Y) && (itr->z == Z) && (itr->ChunkX == ChunkX) && (itr->ChunkZ == ChunkZ))
1156 {
1157 return itr->BlockType;
1158 }
1159 } // for itr - m_FastSetBlockQueue[]
1160 }
1161 int ChunkX, ChunkZ;
1162 cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ );
1163
1164 cCSLock Lock(m_CSLayers);
1165 cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ);
1166 if ((Chunk != NULL) && Chunk->IsValid())
1167 {
1168 return Chunk->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
1169 }
1170 return 0;
1171}
1172
1173
1174

Callers 6

LockedGetBlockMethod · 0.45
LockedGetBlockTypeMethod · 0.45
ReplaceBlocksMethod · 0.45
ReplaceTreeBlocksMethod · 0.45
GetBlocksMethod · 0.45
DoExplosionAtMethod · 0.45

Calls 3

beginMethod · 0.80
endMethod · 0.80
IsValidMethod · 0.45

Tested by

no test coverage detected