MutableLocation

@Serializable
data class MutableLocation(var x: Int, var y: Int, var z: Int) : Location(source)

Constructors

Link copied to clipboard
constructor(x: Int, y: Int, z: Int)

Properties

Link copied to clipboard
open override var x: Int

Represents the x (length) coordinate of the location.

Link copied to clipboard
open override var y: Int

Represents the y (height) coordinate of the location.

Link copied to clipboard
open override var z: Int

Represents the z (width) coordinate of the location.

Functions

Link copied to clipboard
open override fun distanceSquared(other: Location): Int

Calculates the squared distance between this location and another location. This is useful for comparing distances without the need to calculate the square root. The squared distance is calculated as follows: (x2-x1 )^2 + (y2-y1)^2 + (z2-z1)^2.

Link copied to clipboard
open override fun distanceTo(other: Location): Double

Calculates the distance between this location and another location. This is useful for calculating the actual distance between two locations. The distance is calculated as follows: sqrt((x2-x1 )^2 + (y2-y1)^2 + (z2-z1)^2) and therefore yields the exact same result as the square root of distanceSquared.

Link copied to clipboard
open operator fun div(other: Int): Location
open operator override fun div(other: Location): Location
Link copied to clipboard
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open fun immutable(): Location

Creates an immutable copy of this location. This is useful for ensuring that the location cannot be modified. If any modification operations are called on the returned location, a new instance will be created but the original location will remain unchanged.

Link copied to clipboard
open operator override fun minus(other: Location): Location
Link copied to clipboard

Modifies this location by applying the given block to it. The block is used to modify the location's x, y and z coordinates. If this location is an instance of MutableLocation, the coordinates will be modified directly. Otherwise, a new instance of ImmutableLocation will be created with the modified coordinates.

Link copied to clipboard
open operator override fun plus(other: Location): Location
Link copied to clipboard
open operator fun rem(other: Int): Location
open operator override fun rem(other: Location): Location
Link copied to clipboard
open operator fun times(other: Int): Location
open operator override fun times(other: Location): Location