private function canSugarcaneStay($x, $y, $z)
{
$b = $this->level->getBlockIdAt($x, $y, $z);
$below = $this->level->getBlockIdAt($x, $y - 1, $z);
$water = false;
foreach (array($this->level->getBlockIdAt($x + 1, $y - 1, $z), $this->level->getBlockIdAt($x - 1, $y - 1, $z), $this->level->getBlockIdAt($x, $y - 1, $z + 1), $this->level->getBlockIdAt($x, $y - 1, $z - 1)) as $adjacent) {
if ($adjacent === Block::WATER or $adjacent === Block::STILL_WATER) {
$water = true;
break;
}
}
return $b === Block::AIR and (($below === Block::SAND or $below === Block::GRASS) and $water or $below === Block::SUGARCANE_BLOCK);
}