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

Function GetSmallJungleTreeImage

src/Generating/Trees.cpp:740–791  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

738
739
740void GetSmallJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks)
741{
742 // Vines are around the BigO3, but not in the corners; need proper meta for direction
743 static const sMetaCoords Vines[] =
744 {
745 {-2, -4, 1}, {-1, -4, 1}, {0, -4, 1}, {1, -4, 1}, {2, -4, 1}, // North face
746 {-2, 4, 4}, {-1, 4, 4}, {0, 4, 4}, {1, 4, 4}, {2, 4, 4}, // South face
747 {4, -2, 2}, {4, -1, 2}, {4, 0, 2}, {4, 1, 2}, {4, 2, 2}, // East face
748 {-4, -2, 8}, {-4, -1, 8}, {-4, 0, 8}, {-4, 1, 8}, // West face
749 // TODO: proper metas and height: {0, 1, 1}, {0, -1, 4}, {-1, 0, 2}, {1, 1, 8}, // Around the tunk
750 } ;
751
752 int Height = 7 + (a_Noise.IntNoise3DInt(a_BlockX + 5 * a_Seq, a_BlockY, a_BlockZ + 5 * a_Seq) / 5) % 3;
753
754 a_LogBlocks.reserve(Height);
755 a_OtherBlocks.reserve(
756 2 * ARRAYCOUNT(BigO3) + // O3 layer, 2x
757 2 * ARRAYCOUNT(BigO2) + // O2 layer, 2x
758 ARRAYCOUNT(BigO1) + 1 + // Plus on the top
759 Height * ARRAYCOUNT(Vines) + // Vines
760 50 // some safety
761 );
762
763 for (int i = 0; i < Height; i++)
764 {
765 a_LogBlocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_LOG_JUNGLE));
766 }
767 int hei = a_BlockY + Height - 3;
768
769 // Put vines around the lowermost leaves layer:
770 PushSomeColumns(a_BlockX, hei, a_BlockZ, Height, a_Seq, a_Noise, 0x3fffffff, a_OtherBlocks, Vines, ARRAYCOUNT(Vines), E_BLOCK_VINES);
771
772 // The lower two leaves layers are BigO3 with log in the middle and possibly corners:
773 for (int i = 0; i < 2; i++)
774 {
775 PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO3, ARRAYCOUNT(BigO3), E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE);
776 PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 3, E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE);
777 hei++;
778 } // for i - 2*
779
780 // Two layers of BigO2 leaves, possibly with corners:
781 for (int i = 0; i < 1; i++)
782 {
783 PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE);
784 PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 2, E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE);
785 hei++;
786 } // for i - 2*
787
788 // Top plus, all leaves:
789 PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_OtherBlocks, BigO1, ARRAYCOUNT(BigO1), E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE);
790 a_OtherBlocks.push_back(sSetBlock(a_BlockX, hei, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE));
791}
792
793
794

Callers 2

Trees.hFile · 0.85
GetJungleTreeImageFunction · 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