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

Method RandomFillRelCuboid

src/Generating/ChunkDesc.cpp:496–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

494
495
496void cChunkDesc::RandomFillRelCuboid(
497 int a_MinX, int a_MaxX,
498 int a_MinY, int a_MaxY,
499 int a_MinZ, int a_MaxZ,
500 BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta,
501 int a_RandomSeed, int a_ChanceOutOf10k
502)
503{
504 cNoise Noise(a_RandomSeed);
505 int MinX = std::max(a_MinX, 0);
506 int MinY = std::max(a_MinY, 0);
507 int MinZ = std::max(a_MinZ, 0);
508 int MaxX = std::min(a_MaxX, cChunkDef::Width - 1);
509 int MaxY = std::min(a_MaxY, cChunkDef::Height - 1);
510 int MaxZ = std::min(a_MaxZ, cChunkDef::Width - 1);
511
512 for (int y = MinY; y <= MaxY; y++)
513 {
514 for (int z = MinZ; z <= MaxZ; z++)
515 {
516 for (int x = MinX; x <= MaxX; x++)
517 {
518 int rnd = (Noise.IntNoise3DInt(x, y, z) / 7) % 10000;
519 if (rnd <= a_ChanceOutOf10k)
520 {
521 SetBlockTypeMeta(x, y, z, a_BlockType, a_BlockMeta);
522 }
523 }
524 } // for z
525 } // for y
526}
527
528
529

Callers 2

ProcessChunkMethod · 0.45
PlaceTracksMethod · 0.45

Calls 1

IntNoise3DIntMethod · 0.80

Tested by

no test coverage detected