CubeFaceSet

An immutable set of BlockFace values (of the cube faces BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST, BlockFace.UP, BlockFace.DOWN) stored as a bitmask in a single Byte.

Bit layout (MSB to LSB): 0 | 0 | DOWN | UP | WEST | SOUTH | EAST | NORTH

Constructors

Link copied to clipboard
constructor(data: Int)

Creates a new CubeFaceSet from the lowest six bits of data.

constructor(north: Boolean = false, east: Boolean = false, south: Boolean = false, west: Boolean = false, up: Boolean = false, down: Boolean = false)

Creates a new CubeFaceSet with the faces that are set to true.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val data: Byte

Functions

Link copied to clipboard
infix fun and(other: CubeFaceSet): CubeFaceSet

Returns a new CubeFaceSet that is the intersection of this set and other.

Link copied to clipboard
inline fun <V> associateWith(valueSelector: (BlockFace) -> V): CubeFaceMap<V?>

Returns a CubeFaceMap where each face in this set is associated with the value produced by valueSelector, and all other faces are null.

Link copied to clipboard
operator fun contains(face: BlockFace): Boolean

Checks whether face is contained in this set.

Link copied to clipboard
inline fun forEach(action: (BlockFace) -> Unit)

Runs action for each BlockFace contained in this set.

Link copied to clipboard

Checks whether this set contains no faces.

Link copied to clipboard

Checks whether this set contains at least one face.

Link copied to clipboard
inline fun <V> map(transform: (BlockFace) -> V): List<V>

Returns a list of results from applying transform to each BlockFace in this set.

Link copied to clipboard
operator fun minus(face: BlockFace): CubeFaceSet

Returns a new CubeFaceSet with face removed.

operator fun minus(other: CubeFaceSet): CubeFaceSet

Returns a new CubeFaceSet with all faces in other removed.

Link copied to clipboard
operator fun plus(face: BlockFace): CubeFaceSet

Returns a new CubeFaceSet with face added.

operator fun plus(other: CubeFaceSet): CubeFaceSet

Returns a new CubeFaceSet that is the union of this set and other.

Link copied to clipboard
fun toBlockSideSet(front: BlockFace): BlockSideSet

Converts this CubeFaceSet to a BlockSideSet given the front direction.