
net.chestmc.common.extensions.Blocks.kt Maven / Gradle / Ivy
package net.chestmc.common.extensions
import org.bukkit.block.Block
import org.bukkit.block.BlockFace
/**
* Gets the repository file of this block. Note that this not creates the repository if not exists.
*/
inline val Block.repository get() = location.repository
/**
* Gets the up relative block of this block.
*/
fun Block.up(distance: Int = 1): Block = getRelative(0, distance, 0)
/**
* Gets the down relative block of this block.
*/
fun Block.down(distance: Int = 1): Block = getRelative(0, -distance, 0)
/**
* Gets the south relative block of this block.
*/
fun Block.south(distance: Int = 1): Block = getRelative(BlockFace.SOUTH, distance)
/**
* Gets the north relative block of this block.
*/
fun Block.north(distance: Int = 1): Block = getRelative(BlockFace.NORTH, distance)
/**
* Gets the east relative location of this location.
*/
fun Block.east(distance: Int = 1): Block = getRelative(BlockFace.EAST, distance)
/**
* Gets the west relative block of this block.
*/
fun Block.west(distance: Int = 1): Block = getRelative(BlockFace.WEST, distance)
/**
* Gets the south west relative block of this block.
*/
fun Block.southwest(distance: Int = 1): Block = getRelative(BlockFace.SOUTH_WEST, distance)
/**
* Gets the north west relative block of this block.
*/
fun Block.northwest(distance: Int = 1): Block = getRelative(BlockFace.NORTH_WEST, distance)
/**
* Gets the south east relative block of this block.
*/
fun Block.southeast(distance: Int = 1): Block = getRelative(BlockFace.SOUTH_EAST, distance)
/**
* Gets the north east relative block of this block.
*/
fun Block.northeast(distance: Int = 1): Block = getRelative(BlockFace.NORTH_EAST, distance)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy