public interface TeleportHelper
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_HEIGHT
The default height radius to scan for safe locations.
|
static int |
DEFAULT_WIDTH
The default width radius to scan for safe locations.
|
Modifier and Type | Method and Description |
---|---|
Optional<Location<World>> |
getSafeLocation(Location<World> location)
Gets the next safe
Location around the given location. |
Optional<Location<World>> |
getSafeLocation(Location<World> location,
int height,
int width)
Gets the next safe
Location around the given location with a
given tolerance and search radius. |
static final int DEFAULT_HEIGHT
static final int DEFAULT_WIDTH
Optional<Location<World>> getSafeLocation(Location<World> location)
Location
around the given location.
Safe entails that the returned location will not be somewhere that
would harm an Entity
. This method will use the default height and
width for a search area.
It's possible the same location will be returned that was passed in. This means it was safe.
location
- The location to search nearby.Optional.absent()
will be returned.Optional<Location<World>> getSafeLocation(Location<World> location, int height, int width)
Location
around the given location with a
given tolerance and search radius.
Safe entails that the returned location will not be somewhere that
would harm an Entity
.
It's possible the same location will be returned that was passed in. This means it was safe.
location
- The location to search nearby.height
- The radius of blocks on the y-axis to search.width
- The radius of blocks on the x and z-axis to search.Optional.absent()
will be returned