34 private array $oreTypes = [];
36 public function populate(
ChunkManager $world,
int $chunkX,
int $chunkZ,
Random $random) :
void{
37 foreach($this->oreTypes as $type){
38 $ore =
new ObjectOre($random, $type);
39 for($i = 0; $i < $ore->type->clusterCount; ++$i){
40 $x = $random->
nextRange($chunkX << Chunk::COORD_BIT_SIZE, ($chunkX << Chunk::COORD_BIT_SIZE) + Chunk::EDGE_LENGTH - 1);
41 $y = $random->
nextRange($ore->type->minHeight, $ore->type->maxHeight);
42 $z = $random->
nextRange($chunkZ << Chunk::COORD_BIT_SIZE, ($chunkZ << Chunk::COORD_BIT_SIZE) + Chunk::EDGE_LENGTH - 1);
43 if($ore->canPlaceObject($world, $x, $y, $z)){
44 $ore->placeObject($world, $x, $y, $z);
54 $this->oreTypes = $types;