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

Function GetTallBirchTreeImage

src/Generating/Trees.cpp:403–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

401
402
403void GetTallBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks)
404{
405 int Height = 9 + (a_Noise.IntNoise3DInt(a_BlockX + 64 * a_Seq, a_BlockY, a_BlockZ) % 3);
406
407 // Prealloc, so that we don't realloc too often later:
408 a_LogBlocks.reserve(Height);
409 a_OtherBlocks.reserve(80);
410
411 // The entire trunk, out of logs:
412 for (int i = Height - 1; i >= 0; --i)
413 {
414 a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_LOG_BIRCH));
415 }
416 int h = a_BlockY + Height;
417
418 // Top layer - just the Plus:
419 PushCoordBlocks(a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
420 a_OtherBlocks.push_back(sSetBlock(a_BlockX, h, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH)); // There's no log at this layer
421 h--;
422
423 // Second layer - log, Plus and maybe Corners:
424 PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
425 PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 1, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
426 h--;
427
428 // Third and fourth layers - BigO2 and maybe 2*Corners:
429 for (int Row = 0; Row < 2; Row++)
430 {
431 PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
432 PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x3fffffff + Row * 0x10000000, a_OtherBlocks, 2, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
433 h--;
434 } // for Row - 2*
435}
436
437
438

Callers 2

Trees.hFile · 0.85
GetTreeImageByBiomeFunction · 0.85

Calls 4

sSetBlockClass · 0.85
PushCoordBlocksFunction · 0.85
PushCornerBlocksFunction · 0.85
IntNoise3DIntMethod · 0.80

Tested by

no test coverage detected