
walkmc.shape.Cube.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of walk-server Show documentation
Show all versions of walk-server Show documentation
A spigot fork to kotlin structure and news.
@file:UseContextualSerialization(Location::class)
package walkmc.shape
import kotlinx.serialization.*
import org.bukkit.*
import walkmc.extensions.*
/**
* Represents a cube util class. This can be used to draw/display particles in a cube.
*/
@Serializable
data class Cube(
var center: Location,
var width: Double,
var length: Double,
var heigth: Double,
var pointsWidth: Int,
var pointsLength: Int,
var pointsHeigth: Int,
) : Shape {
/**
* Returns the path of this shape.
*/
@Transient
override lateinit var path: List
/**
* Generates the [path] and updates their property.
*/
override fun generatePath(): List {
val path = center.generateCubePath(width, length, heigth, pointsWidth, pointsLength, pointsHeigth)
this.path = path
return path
}
}
/**
* Creates a cube representation with this location as center.
*/
fun Location.cube(
width: Double,
length: Double,
heigth: Double,
pointsWidth: Int,
pointsLength: Int,
pointsHeigth: Int,
) = Cube(this, width, length, heigth, pointsWidth, pointsLength, pointsHeigth)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy