Circles now use Structure
This commit is contained in:
@@ -3,9 +3,8 @@
|
|||||||
package net.axay.kspigot.structures
|
package net.axay.kspigot.structures
|
||||||
|
|
||||||
import net.axay.kspigot.extensions.geometry.SimpleLocation2D
|
import net.axay.kspigot.extensions.geometry.SimpleLocation2D
|
||||||
import net.axay.kspigot.extensions.geometry.worldOrException
|
import net.axay.kspigot.extensions.geometry.SimpleLocation3D
|
||||||
import net.axay.kspigot.particles.KSpigotParticle
|
import net.axay.kspigot.particles.KSpigotParticle
|
||||||
import org.bukkit.Location
|
|
||||||
import org.bukkit.Material
|
import org.bukkit.Material
|
||||||
import org.bukkit.entity.EntityType
|
import org.bukkit.entity.EntityType
|
||||||
|
|
||||||
@@ -55,39 +54,25 @@ abstract class Circle(val radius: Number) {
|
|||||||
this += SimpleLocation2D(first, second)
|
this += SimpleLocation2D(first, second)
|
||||||
}
|
}
|
||||||
|
|
||||||
final fun buildAtX(loc: Location) {
|
val structure = Structure(
|
||||||
for (it in fillLocations)
|
HashSet<SingleStructureData>().apply {
|
||||||
setAt(Location(loc.world, loc.x, loc.y + it.x, loc.z + it.y))
|
for (it in fillLocations)
|
||||||
}
|
this += SingleStructureData(SimpleLocation3D(it.x, 0, it.y), data)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
final fun buildAtY(loc: Location) {
|
abstract val data: StructureData
|
||||||
for (it in fillLocations)
|
|
||||||
setAt(Location(loc.world, loc.x + it.x, loc.y, loc.z + it.y))
|
|
||||||
}
|
|
||||||
|
|
||||||
final fun buildAtZ(loc: Location) {
|
|
||||||
for (it in fillLocations)
|
|
||||||
setAt(Location(loc.world, loc.x + it.x, loc.y + it.y, loc.z))
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract fun setAt(loc: Location)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class BlockCircle(radius: Number, val material: Material) : Circle(radius) {
|
class MaterialCircle(radius: Number, material: Material) : Circle(radius) {
|
||||||
override fun setAt(loc: Location) {
|
override val data = StructureDataMaterial(material)
|
||||||
loc.block.type = material
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ParticleCircle(radius: Number, val particle: KSpigotParticle) : Circle(radius) {
|
class ParticleCircle(radius: Number, particle: KSpigotParticle) : Circle(radius) {
|
||||||
override fun setAt(loc: Location) {
|
override val data = StructureDataParticle(particle)
|
||||||
particle.spawnAt(loc)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class EntityCircle(radius: Number, val entityType: EntityType) : Circle(radius) {
|
class EntityCircle(radius: Number, entityType: EntityType) : Circle(radius) {
|
||||||
override fun setAt(loc: Location) {
|
override val data = StructureDataEntity(entityType)
|
||||||
loc.worldOrException.spawnEntity(loc, entityType)
|
|
||||||
}
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user