public canPlaceObject ( pocketmine\level\ChunkManager $level, $x, $y, $z ) | ||
$level | pocketmine\level\ChunkManager |
public function canPlaceObject(ChunkManager $level, $x, $y, $z)
{
return $level->getBlockIdAt($x, $y, $z) === 87;
}
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) { foreach ($this->oreTypes as $type) { $ore = new ObjectOre($random, $type); for ($i = 0; $i < $ore->type->clusterCount; ++$i) { $x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15); $y = $random->nextRange($ore->type->minHeight, $ore->type->maxHeight); $z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15); if ($ore->canPlaceObject($level, $x, $y, $z)) { $ore->placeObject($level, $x, $y, $z); } } } }