All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jglrxavpok.hephaistos.mca.Coordinates.kt Maven / Gradle / Ivy

There is a newer version: 2.6.1
Show newest version
package org.jglrxavpok.hephaistos.mca

import kotlin.math.floor

fun Int.chunkToRegion() = floor(this / 32.0).toInt()
fun Int.regionToChunk() = this * 32
fun Int.blockToChunk() = floor(this / 16.0).toInt()
fun Int.chunkToBlock() = this shl 4
fun Int.chunkInsideRegion() = this and 31
fun Int.blockInsideChunk() = this and 15
fun Int.blockInsideSection() = this and 15

fun Int.blockToSection() = floor(this / 16.0).toInt().toByte()
fun Int.sectionToBlock() = this * 16




© 2015 - 2024 Weber Informatics LLC | Privacy Policy