Update Circle.kt
This commit is contained in:
@@ -7,6 +7,7 @@ import net.axay.kspigot.extensions.geometry.SimpleLocation3D
|
|||||||
import net.axay.kspigot.particles.KSpigotParticle
|
import net.axay.kspigot.particles.KSpigotParticle
|
||||||
import org.bukkit.Material
|
import org.bukkit.Material
|
||||||
import org.bukkit.entity.EntityType
|
import org.bukkit.entity.EntityType
|
||||||
|
import kotlin.time.seconds
|
||||||
|
|
||||||
private fun circleEdgeLocations(radius: Number) = HashSet<SimpleLocation2D>().apply {
|
private fun circleEdgeLocations(radius: Number) = HashSet<SimpleLocation2D>().apply {
|
||||||
|
|
||||||
@@ -53,8 +54,13 @@ abstract class Circle(val radius: Number) {
|
|||||||
|
|
||||||
HashSet<SimpleLocation2D>().apply {
|
HashSet<SimpleLocation2D>().apply {
|
||||||
while (currentRadius >= 0) {
|
while (currentRadius >= 0) {
|
||||||
this += circleEdgeLocations(currentRadius)
|
this += circleEdgeLocations(currentRadius).mapTo(HashSet()) {
|
||||||
currentRadius -= 0.5
|
mutableSetOf(it).apply {
|
||||||
|
this += SimpleLocation2D(it.x + when { it.x >= 1 -> -1; it.x <= -1 -> 1; else -> 0 }, it.y)
|
||||||
|
this += SimpleLocation2D(it.x, it.y + when { it.y >= 1 -> -1; it.y <= -1 -> 1; else -> 0 })
|
||||||
|
}
|
||||||
|
}.flatten()
|
||||||
|
currentRadius--
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user