[SOLVED]How would I get a 'space' that's safe around a player?

So How would I get check the area around a player for a safe spot to spawn something? Say a cow?

here’s what I have

public class trial{
    public getSpace(final Player player, final int radius){
        final int radius = 10;
        return //something here something here//.distance(player.getLocation().getPosition()) <= radius;
    }
}

I think the TeleportHelper might be what you’re looking for

Sponge.getGame().getTeleportHelper().getSafeLocation(...)

1 Like

OK and that safe space could be used for spawing entire then right? :smiley:

Yes, that method just returns Optional<Location<World>>, returning a location if a one safe exists.. You can use it to spawn in cows and whatever else to that location no problem.

1 Like