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

Function GetBirchTreeImage

src/Generating/Trees.cpp:347–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

345
346
347void GetBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks)
348{
349 int Height = 5 + (a_Noise.IntNoise3DInt(a_BlockX + 64 * a_Seq, a_BlockY, a_BlockZ) % 3);
350
351 // Prealloc, so that we don't realloc too often later:
352 a_LogBlocks.reserve(Height);
353 a_OtherBlocks.reserve(80);
354
355 // The entire trunk, out of logs:
356 for (int i = Height - 1; i >= 0; --i)
357 {
358 a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_LOG_BIRCH));
359 }
360 int h = a_BlockY + Height;
361
362 // Top layer - just the Plus:
363 PushCoordBlocks(a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
364 a_OtherBlocks.push_back(sSetBlock(a_BlockX, h, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH)); // There's no log at this layer
365 h--;
366
367 // Second layer - log, Plus and maybe Corners:
368 PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
369 PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 1, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
370 h--;
371
372 // Third and fourth layers - BigO2 and maybe 2*Corners:
373 for (int Row = 0; Row < 2; Row++)
374 {
375 PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
376 PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x3fffffff + Row * 0x10000000, a_OtherBlocks, 2, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
377 h--;
378 } // for Row - 2*
379}
380
381
382

Callers 3

GrowTreeFromSaplingMethod · 0.85
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