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

Method ComposeTerrain

src/Generating/EndGen.cpp:185–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183
184
185void cEndGen::ComposeTerrain(cChunkDesc & a_ChunkDesc)
186{
187 if (IsChunkOutsideRange(a_ChunkDesc.GetChunkX(), a_ChunkDesc.GetChunkZ()))
188 {
189 a_ChunkDesc.FillBlocks(E_BLOCK_AIR, 0);
190 return;
191 }
192
193 PrepareState(a_ChunkDesc.GetChunkX(), a_ChunkDesc.GetChunkZ());
194
195 int MaxY = std::min((int)(1.75 * m_IslandSizeY + 1), cChunkDef::Height - 1);
196 for (int z = 0; z < cChunkDef::Width; z++)
197 {
198 for (int x = 0; x < cChunkDef::Width; x++)
199 {
200 for (int y = MaxY; y > 0; y--)
201 {
202 if (m_NoiseArray[y * 17 * 17 + z * 17 + x] <= 0)
203 {
204 a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_END_STONE, 0);
205 }
206 else
207 {
208 a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_AIR, 0);
209 }
210 } // for y
211 } // for x
212 } // for z
213}
214
215
216

Callers 2

DoGenerateMethod · 0.45
GenFinishMethod · 0.45

Calls 4

FillBlocksMethod · 0.80
GetChunkXMethod · 0.45
GetChunkZMethod · 0.45
SetBlockTypeMetaMethod · 0.45

Tested by

no test coverage detected