Package-level declarations

This package contains the core functionality of the library besides map and cell representation, mostly centering around the Location class.

Types

Link copied to clipboard
interface Axis
Link copied to clipboard
data class Dimension(val width: Int, val height: Int, val depth: Int)

Represents a dimension in a 3-dimensional space. This class is immutable.

Link copied to clipboard
@Serializable
data class ImmutableLocation(val x: Int, val y: Int, val z: Int) : Location
Link copied to clipboard
interface Locatable

Represents an entity that is able to be located in a 3-dimensional space.

Link copied to clipboard
@Serializable
sealed interface Location

Represents a location in the map grid. The location is represented by its x, y and z coordinates.

Link copied to clipboard
class LocationBuilder(startX: Int = 0, startY: Int = 0, startZ: Int = 0)

A builder for creating locations. This builder can be used to create immutable and mutable locations with the given x, y and z coordinates.

Link copied to clipboard
interface Movable : Locatable

This interface represents an object that can be moved around in a 3-dimensional space. It extends Locatable and adds a location property that can be changed. It also, at every point in time, is located at the location specified.

Link copied to clipboard
@Serializable
data class MutableLocation(var x: Int, var y: Int, var z: Int) : Location

Properties

Link copied to clipboard
const val X_BITS: Int = 20
Link copied to clipboard
const val X_MASK: Long
Link copied to clipboard
const val Y_BITS: Int = 20
Link copied to clipboard
const val Y_MASK: Long
Link copied to clipboard
const val Z_BITS: Int = 20
Link copied to clipboard
const val Z_MASK: Long

Functions

Link copied to clipboard
fun Array<Any?>.clear()

Clears all elements in this array by setting them to null.

fun Array<Array<Any?>>.clear()

Clears all elements in this 2-dimensional array by setting them to null.

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

Creates a new immutable location with the given x, y and z coordinates.

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
fun Int.pow(exponent: Int): Int

Calculates the power of this integer to the given exponent. This is a shorthand for this.toDouble().pow(exponent.toDouble()).toInt().