BlockSideMap

data class BlockSideMap<out V>(val front: V, val left: V, val back: V, val right: V, val top: V, val bottom: V)

An immutable map from each BlockSide to a value of type V. Keys cannot be absent, use null to model absence instead.

Constructors

Link copied to clipboard
constructor(front: V, left: V, back: V, right: V, top: V, bottom: V)
constructor(all: V)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val back: V
Link copied to clipboard
val bottom: V
Link copied to clipboard
val front: V
Link copied to clipboard
val left: V
Link copied to clipboard
val right: V
Link copied to clipboard
val top: V
Link copied to clipboard

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

Functions

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

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

inline fun filter(filter: (side: BlockSide, value: V & Any) -> Boolean): BlockSideMap<V?>

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

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

Runs run for each value in this map.

inline fun forEach(run: (side: BlockSide, value: V) -> Unit)

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

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

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

inline fun <V : Any> BlockSideMap<V?>.forEachNonNull(run: (side: BlockSide, value: V) -> Unit)

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

Link copied to clipboard
operator fun get(side: BlockSide): V

Gets the value for the given side.

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

Returns a new BlockSideMap with each value transformed by map.

inline fun <R> map(map: (side: BlockSide, value: V) -> R): BlockSideMap<R>

Returns a new BlockSideMap with each value transformed by map, which also receives the BlockSide.

Link copied to clipboard
inline fun mapToBlockSideSet(map: (value: V) -> Boolean): BlockSideSet

Returns a BlockSideSet containing all sides for which map returns true.

Link copied to clipboard
fun toCubeFaceMap(front: BlockFace): CubeFaceMap<V>

Converts this BlockSideMap to a CubeFaceMap given the front direction.

Link copied to clipboard
fun with(side: BlockSide, value: V): BlockSideMap<V>

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