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

Method ReplaceTreeBlocks

src/ChunkMap.cpp:1363–1391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1361
1362
1363void cChunkMap::ReplaceTreeBlocks(const sSetBlockVector & a_Blocks)
1364{
1365 cCSLock Lock(m_CSLayers);
1366 for (sSetBlockVector::const_iterator itr = a_Blocks.begin(); itr != a_Blocks.end(); ++itr)
1367 {
1368 cChunkPtr Chunk = GetChunk(itr->ChunkX, ZERO_CHUNK_Y, itr->ChunkZ );
1369 if ((Chunk == NULL) || !Chunk->IsValid())
1370 {
1371 continue;
1372 }
1373 switch (Chunk->GetBlock(itr->x, itr->y, itr->z))
1374 {
1375 CASE_TREE_OVERWRITTEN_BLOCKS:
1376 {
1377 Chunk->SetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta);
1378 break;
1379 }
1380 case E_BLOCK_LEAVES:
1381 case E_BLOCK_NEW_LEAVES:
1382 {
1383 if ((itr->BlockType == E_BLOCK_LOG) || (itr->BlockType == E_BLOCK_NEW_LOG))
1384 {
1385 Chunk->SetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta);
1386 }
1387 break;
1388 }
1389 }
1390 } // for itr - a_Blocks[]
1391}
1392
1393
1394

Callers 1

GrowTreeImageMethod · 0.80

Calls 5

beginMethod · 0.80
endMethod · 0.80
IsValidMethod · 0.45
GetBlockMethod · 0.45
SetBlockMethod · 0.45

Tested by

no test coverage detected