private function getHighestWorkableBlock($x, $z) { for ($y = 127; $y >= 0; --$y) { $b = $this->level->getBlockIdAt($x, $y, $z); if ($b !== Block::AIR and $b !== Block::LEAVES and $b !== Block::LEAVES2) { break; } } return $y === 0 ? -1 : ++$y; }