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

Method GenFinish

src/Generating/POCPieceGenerator.cpp:195–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193
194
195void cPOCPieceGenerator::GenFinish(cChunkDesc & a_ChunkDesc)
196{
197 int BlockX = a_ChunkDesc.GetChunkX() * cChunkDef::Width;
198 int BlockZ = a_ChunkDesc.GetChunkZ() * cChunkDef::Width;
199 if (
200 (BlockX + 16 < m_Bounds.p1.x) || (BlockX > m_Bounds.p2.x) || // X coords out of bounds of the generated structure
201 (BlockZ + 16 < m_Bounds.p1.z) || (BlockZ > m_Bounds.p2.z) // Z coords out of bounds of the generated structure
202 )
203 {
204 return;
205 }
206
207 // Imprint each piece in the chunk:
208 for (cPlacedPieces::const_iterator itr = m_Pieces.begin(), end = m_Pieces.end(); itr != end; ++itr)
209 {
210 const Vector3i & Pos = (*itr)->GetCoords();
211 Vector3i Size = (*itr)->GetPiece().GetSize();
212 if (((*itr)->GetNumCCWRotations() % 2) == 1)
213 {
214 std::swap(Size.x, Size.z);
215 }
216 if (
217 (Pos.x >= BlockX + 16) || (Pos.x + Size.x - 1 < BlockX) ||
218 (Pos.z >= BlockZ + 16) || (Pos.z + Size.z - 1 < BlockZ)
219 )
220 {
221 // This piece doesn't intersect the chunk
222 continue;
223 }
224
225 ((cPOCPiece &)(*itr)->GetPiece()).ImprintInChunk(a_ChunkDesc, Pos, (*itr)->GetNumCCWRotations());
226 } // for itr - m_Pieces[]
227 a_ChunkDesc.UpdateHeightmap();
228}
229
230
231

Callers

nothing calls this directly

Calls 8

beginMethod · 0.80
endMethod · 0.80
GetNumCCWRotationsMethod · 0.80
ImprintInChunkMethod · 0.80
GetChunkXMethod · 0.45
GetChunkZMethod · 0.45
GetSizeMethod · 0.45
UpdateHeightmapMethod · 0.45

Tested by

no test coverage detected