getCenterBlockLocation

fun Location.getCenterBlockLocation(xOffset: Double, yOffset: Double, zOffset: Double): Location

Calculates the center of the block for the given location, with optional offsets.

This method returns a new Location object centered within the current block, applying the given offsets on the x, y, and z axes. The pitch, yaw, and direction of the current location are retained in the resulting location.

Return

A Location object representing the center of the block with the applied offsets.

Parameters

xOffset

The offset to apply along the x-axis relative to the block's center.

yOffset

The offset to apply along the y-axis relative to the block's center.

zOffset

The offset to apply along the z-axis relative to the block's center.


fun Location.getCenterBlockLocation(): Location

Returns a Location object that represents the center of the block of the current location. The method adjusts the current location's coordinates to align it to the exact center of the block it belongs to.

This method includes optional offsets in the x, y, and z axes, which can be used to shift the center position accordingly.

Receiver

The current Location object.

Return

A new Location object representing the adjusted center block location.