private function canCactusStay($x, $y, $z)
{
$b = $this->level->getBlockIdAt($x, $y, $z);
$below = $this->level->getBlockIdAt($x, $y - 1, $z);
foreach (array($this->level->getBlockIdAt($x + 1, $y, $z), $this->level->getBlockIdAt($x - 1, $y, $z), $this->level->getBlockIdAt($x, $y, $z + 1), $this->level->getBlockIdAt($x, $y, $z - 1)) as $adjacent) {
if ($adjacent !== Block::AIR) {
return false;
}
}
return $b === Block::AIR and ($below === Block::SAND or $below === Block::CACTUS);
}