CubeFaceMap

data class CubeFaceMap<out V>(val north: V, val east: V, val south: V, val west: V, val up: V, val down: V)

An immutable map from each BlockFace (of the cube faces BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST, BlockFace.UP, BlockFace.DOWN) to a value of type V. Keys cannot be absent, use null to model absence instead.

Constructors

Link copied to clipboard
constructor(north: V, east: V, south: V, west: V, up: V, down: V)
constructor(all: V)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val down: V
Link copied to clipboard
val east: V
Link copied to clipboard
val north: V
Link copied to clipboard
val south: V
Link copied to clipboard
val up: V
Link copied to clipboard

A list of all non-null values in this map.

Link copied to clipboard
val west: V

Functions

Link copied to clipboard
inline fun filter(filter: (value: V & Any) -> Boolean): CubeFaceMap<V?>

Returns a new CubeFaceMap where values not matching filter are replaced with null.

inline fun filter(filter: (face: BlockFace, value: V & Any) -> Boolean): CubeFaceMap<V?>

Returns a new CubeFaceMap where values not matching filter are replaced with null. The filter also receives the BlockFace.

Link copied to clipboard
inline fun forEach(run: (value: V) -> Unit)

Runs run for each value in this map.

inline fun forEach(run: (face: BlockFace, value: V) -> Unit)

Runs run for each face-value pair in this map.

Link copied to clipboard
inline fun <V : Any> CubeFaceMap<V?>.forEachNonNull(run: (value: V) -> Unit)

Runs run for each non-null value in this CubeFaceMap.

inline fun <V : Any> CubeFaceMap<V?>.forEachNonNull(run: (face: BlockFace, value: V) -> Unit)

Runs run for each non-null value in this CubeFaceMap, providing both the BlockFace and value.

Link copied to clipboard
operator fun get(face: BlockFace): V

Gets the value for the given face.

Link copied to clipboard
inline fun <R> map(map: (value: V) -> R): CubeFaceMap<R>

Returns a new CubeFaceMap with each value transformed by map.

inline fun <R> map(map: (face: BlockFace, value: V) -> R): CubeFaceMap<R>

Returns a new CubeFaceMap with each value transformed by map, which also receives the BlockFace.

Link copied to clipboard
inline fun mapToCubeFaceSet(map: (value: V) -> Boolean): CubeFaceSet

Returns a CubeFaceSet containing all faces for which map returns true.

Link copied to clipboard
fun toBlockSideMap(front: BlockFace): BlockSideMap<V>

Converts this CubeFaceMap to a BlockSideMap given the front direction.

Link copied to clipboard
fun with(face: BlockFace, value: V): CubeFaceMap<V>

Returns a copy of this map with the value for face replaced by value.