addOffset

fun Location.addOffset(x: Double = 0.0, y: Double = 0.0, z: Double = 0.0): Location

Creates a new Location with the specified offsets added to this Location's coordinates.

This function clones the current Location and adds the specified x, y, and z offsets. All parameters are optional and default to 0.0.

Example:

val original = Location(world, 10.0, 64.0, -20.0)
val offset = original.addOffset(x = 5.0, y = 10.0) // (15.0, 74.0, -20.0)

Return

A new Location with the offsets applied

Parameters

x

The x-coordinate offset to add (default: 0.0)

y

The y-coordinate offset to add (default: 0.0)

z

The z-coordinate offset to add (default: 0.0)