I've been using getHighestBlock as methods to get the ground, but the maps I use have glass domes, which players spawn on. How can I skip the glass?
(This is probably very inconvenient) Uhhhh I think the world height is 256 so get players position in a variable. Run a loop which checks the players position but the the Y position starting from 256, until a block (which isn’t air, glass, water etc) keep taking away the Y by 1 till a valid block is found then return that block position
PHP: public function getCustomRoof(Player $player){ $position = $player->getPosition(); $count = 256; $check = true; while($check){ $position->y = $count; $block = $player->getLevel()->getBlock($position); if($block->getId() != 20 && $block->getId() != 0){ //block isnt glass or air :p - add water/laval(stationary/flowing) $check = false; } else{ $count--; } } return $position; } I haven't tested this, try this I guess....
y=256 is one block outside the world, replace $count's value with (Level::Y_MAX - 1) or you could do something like PHP: $y = Level::Y_MAX;while(--$y >= 0){ $position->y = $y;}