Class TeleportationHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.LocationfindViableSpawnLocation(org.bukkit.entity.Entity entity, RealPortal destinationPortal) Tries to find an alternative viable spawn location for the specified entityprotected static List<org.bukkit.Location> getDirectionalConeLayer(List<org.bukkit.Location> locations, org.bukkit.util.BlockVector outwards, org.bukkit.util.BlockVector left, org.bukkit.util.BlockVector right, org.bukkit.util.BlockVector up, org.bukkit.util.BlockVector down, int recursionNumber, org.bukkit.Location portalCenter) Gets the next layer in a cone going out from the given set of location in the given direction (outwards)protected static List<org.bukkit.Location> getFloorLocations(int width, org.bukkit.Location corner) Calculate the locations where an entity would have a supported floorprotected static List<org.bukkit.Location> getOccupiedLocations(int width, int height, org.bukkit.Location corner) Calculate the locations an entity will occupy based from a corner location of the entityprotected static booleanisViableSpawnLocation(int width, int height, org.bukkit.Location center) Check whether an entity will be safe when spawning into specified location
-
Method Details
-
findViableSpawnLocation
public static org.bukkit.Location findViableSpawnLocation(org.bukkit.entity.Entity entity, RealPortal destinationPortal) Tries to find an alternative viable spawn location for the specified entity- Parameters:
entity-The entity to be teleported
destinationPortal-The portal the entity is about to exit from
- Returns:
A possible spawn location, or null if no viable location could be found
-
getDirectionalConeLayer
protected static List<org.bukkit.Location> getDirectionalConeLayer(List<org.bukkit.Location> locations, org.bukkit.util.BlockVector outwards, org.bukkit.util.BlockVector left, org.bukkit.util.BlockVector right, org.bukkit.util.BlockVector up, org.bukkit.util.BlockVector down, int recursionNumber, org.bukkit.Location portalCenter) Gets the next layer in a cone going out from the given set of location in the given direction (outwards)- Parameters:
locations-The locations in the previous cone layer
outwards-The direction to place the next player of the cone in
left-The positive or negative direction on the axis (x or z) opposite from forwards
right-The positive or negative direction on the axis (x or z) opposite from forwards
up-The upwards direction along the y-axis
down-The downwards direction along the y-axis
recursionNumber-The number of times this method has been run in the current call chain
portalCenter-The center of the portal the cone is extending from (used for sorting by distance)
- Returns:
The locations part of the next cone layer
-
isViableSpawnLocation
protected static boolean isViableSpawnLocation(int width, int height, org.bukkit.Location center) Check whether an entity will be safe when spawning into specified location- Parameters:
width-The width of the entity
height-The height of the entity
center-The entity's coordinates
- Returns:
True if the entity can be safely teleported to the given location
-
getOccupiedLocations
protected static List<org.bukkit.Location> getOccupiedLocations(int width, int height, org.bukkit.Location corner) Calculate the locations an entity will occupy based from a corner location of the entity- Parameters:
width-The width of the entity
height-The height of the entity
corner-A corner of the entities hit-box where y, x, z coordinates are the lowest
- Returns:
A list of the locations occupied by the entity
-
getFloorLocations
Calculate the locations where an entity would have a supported floor- Parameters:
width-The width of the entity
corner-A corner of the entities hit-box where y, x, z coordinates are the lowest
- Returns:
A list of the locations occupied by the entity
-