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

Method GenFinish

src/Generating/StructGen.cpp:57–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55// cStructGenTrees:
56
57void cStructGenTrees::GenFinish(cChunkDesc & a_ChunkDesc)
58{
59 int ChunkX = a_ChunkDesc.GetChunkX();
60 int ChunkZ = a_ChunkDesc.GetChunkZ();
61
62 cChunkDesc WorkerDesc(ChunkX, ChunkZ);
63
64 // Generate trees:
65 for (int x = 0; x <= 2; x++)
66 {
67 int BaseX = ChunkX + x - 1;
68 for (int z = 0; z <= 2; z++)
69 {
70 int BaseZ = ChunkZ + z - 1;
71
72 cChunkDesc * Dest;
73
74 if ((x != 1) || (z != 1))
75 {
76 Dest = &WorkerDesc;
77 WorkerDesc.SetChunkCoords(BaseX, BaseZ);
78
79 m_BiomeGen->GenBiomes (BaseX, BaseZ, WorkerDesc.GetBiomeMap());
80 m_HeightGen->GenHeightMap (BaseX, BaseZ, WorkerDesc.GetHeightMap());
81 m_CompositionGen->ComposeTerrain(WorkerDesc);
82 // TODO: Free the entity lists
83 }
84 else
85 {
86 Dest = &a_ChunkDesc;
87 }
88
89 int NumTrees = GetNumTrees(BaseX, BaseZ, Dest->GetBiomeMap());
90
91 sSetBlockVector OutsideLogs, OutsideOther;
92 for (int i = 0; i < NumTrees; i++)
93 {
94 GenerateSingleTree(BaseX, BaseZ, i, *Dest, OutsideLogs, OutsideOther);
95 }
96
97 sSetBlockVector IgnoredOverflow;
98 IgnoredOverflow.reserve(OutsideOther.size());
99 ApplyTreeImage(ChunkX, ChunkZ, a_ChunkDesc, OutsideOther, IgnoredOverflow);
100 IgnoredOverflow.clear();
101 IgnoredOverflow.reserve(OutsideLogs.size());
102 ApplyTreeImage(ChunkX, ChunkZ, a_ChunkDesc, OutsideLogs, IgnoredOverflow);
103 } // for z
104 } // for x
105
106 // Update the heightmap:
107 for (int x = 0; x < cChunkDef::Width; x++)
108 {
109 for (int z = 0; z < cChunkDef::Width; z++)
110 {
111 for (int y = cChunkDef::Height - 1; y >= 0; y--)
112 {
113 if (a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR)
114 {

Callers

nothing calls this directly

Calls 15

SetChunkCoordsMethod · 0.80
GenBiomesMethod · 0.80
sizeMethod · 0.80
clearMethod · 0.80
IntNoise2DIntMethod · 0.80
GetOriginXMethod · 0.80
GetOriginZMethod · 0.80
GetOriginYMethod · 0.80
GetMaxHeightMethod · 0.80
IntNoise3DIntMethod · 0.80
CubicNoise3DMethod · 0.80
CubicNoise2DMethod · 0.80

Tested by

no test coverage detected