walkmc.shape.Sphere.kt Maven / Gradle / Ivy
@file:UseContextualSerialization(Location::class)
package walkmc.shape
import kotlinx.serialization.*
import org.bukkit.*
import walkmc.extensions.*
/**
* Represents a sphere util class. This can be used to draw/display particles in a sphere.
*/
@Serializable
data class Sphere(
var center: Location,
var radius: Double,
var points: 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.generateSpherePath(radius, points)
this.path = path
return path
}
}
/**
* Creates a sphere representation with this location as center.
*/
fun Location.sphere(radius: Double, points: Int) = Sphere(this, radius, points)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy