public function getHighestBlockAt($x, $z, $cache = true)
{
if ($cache) {
$h = $this->getHeightMap($x, $z);
if ($h !== 0 and $h !== 127) {
return $h;
}
}
$column = $this->getBlockIdColumn($x, $z);
for ($y = 127; $y >= 0; --$y) {
if ($column[$y] !== "") {
$this->setHeightMap($x, $z, $y);
return $y;
}
}
return 0;
}