BlockFaceUtils

Utilities related to BlockFace.

Functions

Link copied to clipboard
fun determineBlockFace(block: Block, location: Location): BlockFace

Determines the block closest block face of block to the given location.

Link copied to clipboard
fun determineBlockFaceBetween(from: BlockPos, to: BlockPos): BlockFace?

Determines the block face that needs to be used to advance from from to to with step size 1, or null if the two positions are not adjacent.

Link copied to clipboard
fun determineBlockFaceLookingAt(location: Location, maxDistance: Double = 6.0): BlockFace?

Determines the block face an entity with location and direction location is looking at. Stops searching after maxDistance and returns null if no block was found.

Link copied to clipboard
fun toAxis(yaw: Float): Axis

Gets the closest Axis to yaw.

fun toAxis(yaw: Float, pitch: Float): Axis

Gets the closest Axis to yaw and pitch.

Link copied to clipboard
fun toCartesianFace(yaw: Float): BlockFace

Gets the closest cardinal BlockFace (North, East, South, West) to the given yaw.

fun toCartesianFace(yaw: Float, pitch: Float): BlockFace

Gets the closest cartesian BlockFace (North, East, South, West, Up, Down) to the given yaw and pitch.

Link copied to clipboard
fun toFace(axis: Axis, positive: Boolean = true): BlockFace

Converts the given axis to a BlockFace, using the positive flag to determine the direction on the axis.

Link copied to clipboard
fun toRotation(yaw: Float): BlockFace

Gets the closest BlockFace to yaw.