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

Function GetSwampTreeImage

src/Generating/Trees.cpp:608–649  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606
607
608void GetSwampTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks)
609{
610 // Vines are around the BigO3, but not in the corners; need proper meta for direction
611 static const sMetaCoords Vines[] =
612 {
613 {-2, -4, 1}, {-1, -4, 1}, {0, -4, 1}, {1, -4, 1}, {2, -4, 1}, // North face
614 {-2, 4, 4}, {-1, 4, 4}, {0, 4, 4}, {1, 4, 4}, {2, 4, 4}, // South face
615 {4, -2, 2}, {4, -1, 2}, {4, 0, 2}, {4, 1, 2}, {4, 2, 2}, // East face
616 {-4, -2, 8}, {-4, -1, 8}, {-4, 0, 8}, {-4, 1, 8}, {-4, 2, 8}, // West face
617 } ;
618
619 int Height = 3 + (a_Noise.IntNoise3DInt(a_BlockX + 32 * a_Seq, a_BlockY, a_BlockZ + 32 * a_Seq) / 8) % 3;
620
621 a_LogBlocks.reserve(Height);
622 a_OtherBlocks.reserve(2 * ARRAYCOUNT(BigO2) + 2 * ARRAYCOUNT(BigO3) + Height * ARRAYCOUNT(Vines) + 20);
623
624 for (int i = 0; i < Height; i++)
625 {
626 a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_LOG_APPLE));
627 }
628 int hei = a_BlockY + Height - 2;
629
630 // Put vines around the lowermost leaves layer:
631 PushSomeColumns(a_BlockX, hei, a_BlockZ, Height, a_Seq, a_Noise, 0x3fffffff, a_OtherBlocks, Vines, ARRAYCOUNT(Vines), E_BLOCK_VINES);
632
633 // The lower two leaves layers are BigO3 with log in the middle and possibly corners:
634 for (int i = 0; i < 2; i++)
635 {
636 PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO3, ARRAYCOUNT(BigO3), E_BLOCK_LEAVES, E_META_LEAVES_APPLE);
637 PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 3, E_BLOCK_LEAVES, E_META_LEAVES_APPLE);
638 hei++;
639 } // for i - 2*
640
641 // The upper two leaves layers are BigO2 with leaves in the middle and possibly corners:
642 for (int i = 0; i < 2; i++)
643 {
644 PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_APPLE);
645 PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 3, E_BLOCK_LEAVES, E_META_LEAVES_APPLE);
646 a_OtherBlocks.push_back(sSetBlock(a_BlockX, hei, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_APPLE));
647 hei++;
648 } // for i - 2*
649}
650
651
652

Callers 2

Trees.hFile · 0.85
GetTreeImageByBiomeFunction · 0.85

Calls 5

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

Tested by

no test coverage detected