public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random)
{
if (!parent::canPlaceObject($level, $x, $y, $z, $random) or $level->getBlockIdAt($x, $y, $z) == Block::WATER or $level->getBlockIdAt($x, $y, $z) == Block::STILL_WATER) {
return false;
}
$base = new Vector3($x, $y, $z);
$this->totalHeight = $this->baseHeight + $random->nextBoundedInt(12);
$availableSpace = $this->getAvailableBlockSpace($level, $base, $base->add(0, $this->totalHeight - 1, 0));
if ($availableSpace > $this->baseHeight or $availableSpace == -1) {
if ($availableSpace != -1) {
$this->totalHeight = $availableSpace;
}
return true;
}
return false;
}