mostly reindents
This commit is contained in:
@@ -34,10 +34,11 @@ object GiveEmitterTool {
|
||||
}
|
||||
|
||||
dispatcher.register(
|
||||
command.then(
|
||||
itemNameArg.then(
|
||||
itemTypeArg.then(
|
||||
emitterIdSuggestion.executes { context ->
|
||||
command
|
||||
.then(itemNameArg
|
||||
.then(itemTypeArg
|
||||
.then(emitterIdSuggestion
|
||||
.executes { context ->
|
||||
val name = StringArgumentType.getString(context, "Item Name")
|
||||
val item = ItemStackArgumentType.getItemStackArgument(context, "Item Type")
|
||||
val emitterId = StringArgumentType.getString(context, "Emitter ID")
|
||||
|
||||
@@ -15,8 +15,7 @@ object KillAllEmitters {
|
||||
.requires { source -> source.hasPermissionLevel(4) }
|
||||
|
||||
dispatcher.register(
|
||||
command
|
||||
.executes { context ->
|
||||
command.executes { context ->
|
||||
for (emitter in ALL_PARTICLE_EMITTERS) {
|
||||
emitter.kill()
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.bytedice.bde_particles.commands
|
||||
|
||||
import com.bytedice.bde_particles.InterpolationCurves
|
||||
import com.bytedice.bde_particles.particles.SpawningShape
|
||||
import com.bytedice.bde_particles.particles.updateSingleParam
|
||||
import com.bytedice.bde_particles.particles.*
|
||||
import com.mojang.brigadier.Command
|
||||
import com.mojang.brigadier.arguments.BoolArgumentType
|
||||
import com.mojang.brigadier.arguments.FloatArgumentType
|
||||
@@ -125,50 +124,41 @@ class ArgConfigEmitterKeys {
|
||||
class ArgConfigParticleKeys {
|
||||
fun shape() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
return CommandManager.literal("shape")
|
||||
.then(
|
||||
CommandManager.literal("circle")
|
||||
.then(
|
||||
CommandManager.argument("Radius", FloatArgumentType.floatArg())
|
||||
.then(CommandManager.literal("circle")
|
||||
.then(CommandManager.argument("Radius", FloatArgumentType.floatArg())
|
||||
.executes { context ->
|
||||
val particleIndex = IntegerArgumentType.getInteger(context, "Particle Index")
|
||||
val radius = FloatArgumentType.getFloat(context, "Radius")
|
||||
val feedback = argUpdateParticleParam(context, particleIndex, "shape", SpawningShape.Circle(radius))
|
||||
val feedback = argUpdateParticleParam(context, particleIndex, "shape", SpawningShape.CIRCLE(radius))
|
||||
context.source.sendFeedback( { feedback }, false)
|
||||
Command.SINGLE_SUCCESS
|
||||
}
|
||||
)
|
||||
)
|
||||
.then(
|
||||
CommandManager.literal("rect")
|
||||
.then(
|
||||
CommandManager.argument("Width", FloatArgumentType.floatArg())
|
||||
.then(
|
||||
CommandManager.argument("Height", FloatArgumentType.floatArg())
|
||||
.then(CommandManager.literal("rect")
|
||||
.then(CommandManager.argument("Width", FloatArgumentType.floatArg())
|
||||
.then(CommandManager.argument("Height", FloatArgumentType.floatArg())
|
||||
.executes { context ->
|
||||
val particleIndex = IntegerArgumentType.getInteger(context, "Particle Index")
|
||||
val w = FloatArgumentType.getFloat(context, "Width")
|
||||
val h = FloatArgumentType.getFloat(context, "Height")
|
||||
val feedback = argUpdateParticleParam(context, particleIndex, "shape", SpawningShape.Rect(Vector2f(w, h)))
|
||||
val feedback = argUpdateParticleParam(context, particleIndex, "shape", SpawningShape.RECT(Vector2f(w, h)))
|
||||
context.source.sendFeedback( { feedback }, false)
|
||||
Command.SINGLE_SUCCESS
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
.then(
|
||||
CommandManager.literal("cube")
|
||||
.then(
|
||||
CommandManager.argument("X", FloatArgumentType.floatArg())
|
||||
.then(
|
||||
CommandManager.argument("Y", FloatArgumentType.floatArg())
|
||||
.then(
|
||||
CommandManager.argument("Z", FloatArgumentType.floatArg())
|
||||
.then(CommandManager.literal("cube")
|
||||
.then(CommandManager.argument("X", FloatArgumentType.floatArg())
|
||||
.then(CommandManager.argument("Y", FloatArgumentType.floatArg())
|
||||
.then(CommandManager.argument("Z", FloatArgumentType.floatArg())
|
||||
.executes { context ->
|
||||
val particleIndex = IntegerArgumentType.getInteger(context, "Particle Index")
|
||||
val x = FloatArgumentType.getFloat(context, "X")
|
||||
val y = FloatArgumentType.getFloat(context, "Y")
|
||||
val z = FloatArgumentType.getFloat(context, "Z")
|
||||
val feedback = argUpdateParticleParam(context, particleIndex, "shape", SpawningShape.Cube(Vector3f(x, y, z)))
|
||||
val feedback = argUpdateParticleParam(context, particleIndex, "shape", SpawningShape.CUBE(Vector3f(x, y, z)))
|
||||
context.source.sendFeedback( { feedback }, false)
|
||||
Command.SINGLE_SUCCESS
|
||||
}
|
||||
@@ -176,14 +166,12 @@ class ArgConfigParticleKeys {
|
||||
)
|
||||
)
|
||||
)
|
||||
.then(
|
||||
CommandManager.literal("sphere")
|
||||
.then(
|
||||
CommandManager.argument("Radius", FloatArgumentType.floatArg())
|
||||
.then(CommandManager.literal("sphere")
|
||||
.then(CommandManager.argument("Radius", FloatArgumentType.floatArg())
|
||||
.executes { context ->
|
||||
val particleIndex = IntegerArgumentType.getInteger(context, "Particle Index")
|
||||
val radius = FloatArgumentType.getFloat(context, "Radius")
|
||||
val feedback = argUpdateParticleParam(context, particleIndex, "shape", SpawningShape.Sphere(radius))
|
||||
val feedback = argUpdateParticleParam(context, particleIndex, "shape", SpawningShape.SPHERE(radius))
|
||||
context.source.sendFeedback( { feedback }, false)
|
||||
Command.SINGLE_SUCCESS
|
||||
}
|
||||
@@ -192,8 +180,7 @@ class ArgConfigParticleKeys {
|
||||
}
|
||||
fun blockCurve() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
return CommandManager.literal("blockCurve")
|
||||
.then(
|
||||
CommandManager.argument("Array (separate by comma)", StringArgumentType.string())
|
||||
.then(CommandManager.argument("Array (separate by comma)", StringArgumentType.string())
|
||||
.executes { context ->
|
||||
val particleIndex = IntegerArgumentType.getInteger(context, "Particle Index")
|
||||
val typeValue = StringArgumentType.getString(context, "Array (separate by comma)")
|
||||
@@ -206,8 +193,7 @@ class ArgConfigParticleKeys {
|
||||
}
|
||||
fun rotRandom() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
return CommandManager.literal("rotRandom")
|
||||
.then(
|
||||
argPairVector3f()
|
||||
.then(argPairVector3f()
|
||||
.executes { context ->
|
||||
val particleIndex = IntegerArgumentType.getInteger(context, "Particle Index")
|
||||
val vectors = x1x2ToPairVector3f(context)
|
||||
@@ -220,8 +206,7 @@ class ArgConfigParticleKeys {
|
||||
}
|
||||
fun rotVelRandom() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
return CommandManager.literal("rotVelRandom")
|
||||
.then(
|
||||
argPairVector3f()
|
||||
.then(argPairVector3f()
|
||||
.executes { context ->
|
||||
val particleIndex = IntegerArgumentType.getInteger(context, "Particle Index")
|
||||
val vectors = x1x2ToPairVector3f(context)
|
||||
@@ -234,8 +219,7 @@ class ArgConfigParticleKeys {
|
||||
}
|
||||
fun sizeRandom() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
return CommandManager.literal("sizeRandom")
|
||||
.then(
|
||||
argPairVector3f()
|
||||
.then(argPairVector3f()
|
||||
.executes { context ->
|
||||
val particleIndex = IntegerArgumentType.getInteger(context, "Particle Index")
|
||||
val vectors = x1x2ToPairVector3f(context)
|
||||
@@ -248,8 +232,7 @@ class ArgConfigParticleKeys {
|
||||
}
|
||||
fun uniformSize() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
return CommandManager.literal("uniformSize")
|
||||
.then(
|
||||
CommandManager.argument("Bool", BoolArgumentType.bool())
|
||||
.then(CommandManager.argument("Bool", BoolArgumentType.bool())
|
||||
.executes { context ->
|
||||
val particleIndex = IntegerArgumentType.getInteger(context, "Particle Index")
|
||||
val uniform = BoolArgumentType.getBool(context, "Bool")
|
||||
@@ -261,8 +244,7 @@ class ArgConfigParticleKeys {
|
||||
}
|
||||
fun velRandom() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
return CommandManager.literal("velRandom")
|
||||
.then(
|
||||
argPairVector3f()
|
||||
.then(argPairVector3f()
|
||||
.executes { context ->
|
||||
val particleIndex = IntegerArgumentType.getInteger(context, "Particle Index")
|
||||
val vectors = x1x2ToPairVector3f(context)
|
||||
@@ -273,16 +255,15 @@ class ArgConfigParticleKeys {
|
||||
}
|
||||
)
|
||||
}
|
||||
fun forceFields() {} // TODO: how?
|
||||
fun forceFields() {} // TODO
|
||||
fun gravity() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
return CommandManager.literal("gravity")
|
||||
.then(
|
||||
argVector3f()
|
||||
.then(argVector3f("X", "Y", "Z")
|
||||
.executes { context ->
|
||||
val particleIndex = IntegerArgumentType.getInteger(context, "Particle Index")
|
||||
val x1 = FloatArgumentType.getFloat(context, "Min X")
|
||||
val y1 = FloatArgumentType.getFloat(context, "Min Y")
|
||||
val z1 = FloatArgumentType.getFloat(context, "Min Z")
|
||||
val x1 = FloatArgumentType.getFloat(context, "X")
|
||||
val y1 = FloatArgumentType.getFloat(context, "Y")
|
||||
val z1 = FloatArgumentType.getFloat(context, "Z")
|
||||
|
||||
val feedback = argUpdateParticleParam(context, particleIndex, "gravity", Vector3f(x1, y1, z1))
|
||||
context.source.sendFeedback({ feedback }, false)
|
||||
@@ -292,8 +273,7 @@ class ArgConfigParticleKeys {
|
||||
}
|
||||
fun drag() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
return CommandManager.literal("drag")
|
||||
.then(
|
||||
CommandManager.argument("Float", FloatArgumentType.floatArg())
|
||||
.then(CommandManager.argument("Float", FloatArgumentType.floatArg())
|
||||
.executes { context ->
|
||||
val particleIndex = IntegerArgumentType.getInteger(context, "Particle Index")
|
||||
val value = FloatArgumentType.getFloat(context, "Float")
|
||||
@@ -305,8 +285,7 @@ class ArgConfigParticleKeys {
|
||||
}
|
||||
fun minVel() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
return CommandManager.literal("minVel")
|
||||
.then(
|
||||
CommandManager.argument("Float", FloatArgumentType.floatArg())
|
||||
.then(CommandManager.argument("Float", FloatArgumentType.floatArg())
|
||||
.executes { context ->
|
||||
val particleIndex = IntegerArgumentType.getInteger(context, "Particle Index")
|
||||
val value = FloatArgumentType.getFloat(context, "Float")
|
||||
@@ -372,7 +351,7 @@ class ArgConfigParticleKeys {
|
||||
}
|
||||
|
||||
|
||||
fun argPairVector3f() : RequiredArgumentBuilder<ServerCommandSource, Float> {
|
||||
fun argPairVector3f(): RequiredArgumentBuilder<ServerCommandSource, Float> {
|
||||
return CommandManager.argument("Min X", FloatArgumentType.floatArg())
|
||||
.then(CommandManager.argument("Min Y", FloatArgumentType.floatArg())
|
||||
.then(CommandManager.argument("Min Z", FloatArgumentType.floatArg())
|
||||
@@ -386,10 +365,10 @@ fun argPairVector3f() : RequiredArgumentBuilder<ServerCommandSource, Float> {
|
||||
}
|
||||
|
||||
|
||||
fun argVector3f() : RequiredArgumentBuilder<ServerCommandSource, Float> {
|
||||
return CommandManager.argument("Min X", FloatArgumentType.floatArg())
|
||||
.then(CommandManager.argument("Min Y", FloatArgumentType.floatArg())
|
||||
.then(CommandManager.argument("Min Z", FloatArgumentType.floatArg()))
|
||||
fun argVector3f(xName: String, yName: String, zName: String) : RequiredArgumentBuilder<ServerCommandSource, Float> {
|
||||
return CommandManager.argument(xName, FloatArgumentType.floatArg())
|
||||
.then(CommandManager.argument(yName, FloatArgumentType.floatArg())
|
||||
.then(CommandManager.argument(zName, FloatArgumentType.floatArg()))
|
||||
)
|
||||
}
|
||||
|
||||
@@ -398,8 +377,7 @@ val curves = arrayOf("LINEAR", "SQRT", "EXPONENT", "CUBIC", "SINE", "COSINE", "I
|
||||
|
||||
fun argCurve() : RequiredArgumentBuilder<ServerCommandSource, Float> {
|
||||
return argPairVector3f()
|
||||
.then(
|
||||
CommandManager.argument("Curve", StringArgumentType.string())
|
||||
.then(CommandManager.argument("Curve", StringArgumentType.string())
|
||||
.suggests { _, builder ->
|
||||
curves.forEach { builder.suggest(it) }
|
||||
CompletableFuture.completedFuture(builder.build())
|
||||
@@ -434,3 +412,100 @@ fun x1x2ToPairVector3f(context: CommandContext<ServerCommandSource>) : Pair<Vect
|
||||
val z2 = FloatArgumentType.getFloat(context, "Max Z")
|
||||
return Pair(Vector3f(x1, y1, z1), Vector3f(x2, y2, z2))
|
||||
}
|
||||
|
||||
|
||||
fun argAddForceField() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
return CommandManager.literal("add")
|
||||
.then(CommandManager.argument("Name", StringArgumentType.string())
|
||||
.then(argVector3f("X Pos", "Y Pos", "Z Pos")
|
||||
.then(CommandManager.argument("Min Force", FloatArgumentType.floatArg())
|
||||
.then(CommandManager.argument("Max Force", FloatArgumentType.floatArg())
|
||||
.then(CommandManager.literal("Sphere")
|
||||
.then(CommandManager.argument("Radius", FloatArgumentType.floatArg())
|
||||
.executes { context -> forceFieldAddSphereExec(context) }
|
||||
)
|
||||
)
|
||||
.then(CommandManager.literal("cube")
|
||||
.then(argVector3f("X Size", "Y Size", "Z Size")
|
||||
.then(argVector3f("X Force", "Y Force", "Z Force")
|
||||
.executes { context -> forceFieldAddCubeExec(context) }
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fun forceFieldAddSphereExec(context: CommandContext<ServerCommandSource>) : Int {
|
||||
val particleIndex = IntegerArgumentType.getInteger(context, "Particle Index")
|
||||
val radius = FloatArgumentType.getFloat(context, "Radius")
|
||||
val emitterIdVal = StringArgumentType.getString(context, "Registered Emitter ID")
|
||||
|
||||
val shape = ForceFieldShape.SPHERE(radius)
|
||||
val forceField = forceFieldGenericParams(context, shape)
|
||||
|
||||
val currentParams = getEmitterParams(emitterIdVal)
|
||||
val forceFields = currentParams!!.particleTypes[particleIndex].forceFields
|
||||
|
||||
val feedback = argUpdateParticleParam(
|
||||
context,
|
||||
particleIndex,
|
||||
"forceFields",
|
||||
forceFields.toMutableList().add(forceField)
|
||||
)
|
||||
|
||||
context.source.sendFeedback({ feedback }, false)
|
||||
Command.SINGLE_SUCCESS
|
||||
|
||||
return Command.SINGLE_SUCCESS
|
||||
}
|
||||
|
||||
|
||||
fun forceFieldAddCubeExec(context: CommandContext<ServerCommandSource>) : Int {
|
||||
val particleIndex = IntegerArgumentType.getInteger(context, "Particle Index")
|
||||
val xSize = FloatArgumentType.getFloat(context, "X Size")
|
||||
val ySize = FloatArgumentType.getFloat(context, "Y Size")
|
||||
val zSize = FloatArgumentType.getFloat(context, "Z Size")
|
||||
val xForce = FloatArgumentType.getFloat(context, "X Force")
|
||||
val yForce = FloatArgumentType.getFloat(context, "Y Force")
|
||||
val zForce = FloatArgumentType.getFloat(context, "Z Force")
|
||||
val emitterIdVal = StringArgumentType.getString(context, "Registered Emitter ID")
|
||||
|
||||
val shape = ForceFieldShape.CUBE(Vector3f(xSize, ySize, zSize), Vector3f(xForce, yForce, zForce))
|
||||
val forceField = forceFieldGenericParams(context, shape)
|
||||
|
||||
val currentParams = getEmitterParams(emitterIdVal)
|
||||
val forceFields = currentParams!!.particleTypes[particleIndex].forceFields
|
||||
|
||||
val feedback = argUpdateParticleParam(
|
||||
context,
|
||||
particleIndex,
|
||||
"forceFields",
|
||||
forceFields.toMutableList().add(forceField)
|
||||
)
|
||||
|
||||
context.source.sendFeedback({ feedback }, false)
|
||||
Command.SINGLE_SUCCESS
|
||||
|
||||
return Command.SINGLE_SUCCESS
|
||||
}
|
||||
|
||||
|
||||
fun forceFieldGenericParams(context: CommandContext<ServerCommandSource>, shape: ForceFieldShape) : ForceField {
|
||||
val name = StringArgumentType.getString(context, "Name")
|
||||
val posX = FloatArgumentType.getFloat(context, "X Pos")
|
||||
val posY = FloatArgumentType.getFloat(context, "Y Pos")
|
||||
val posZ = FloatArgumentType.getFloat(context, "Z Pos")
|
||||
val minForce = FloatArgumentType.getFloat(context, "Min Force")
|
||||
val maxForce = FloatArgumentType.getFloat(context, "Max Force")
|
||||
|
||||
return ForceField(
|
||||
name,
|
||||
Vector3f(posX, posY, posZ),
|
||||
Pair(minForce, maxForce),
|
||||
shape
|
||||
)
|
||||
}
|
||||
@@ -88,12 +88,8 @@ val particleConfigKeys = ArgConfigParticleKeys()
|
||||
// output -> register new emitter with a preset
|
||||
fun argCreate() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
return CommandManager.literal("create")
|
||||
.then(
|
||||
// [emitter id]
|
||||
CommandManager.argument("Emitter ID", StringArgumentType.string())
|
||||
.then(
|
||||
// [preset emitter id]
|
||||
emitterIdSuggestion
|
||||
.then(CommandManager.argument("Emitter ID", StringArgumentType.string())
|
||||
.then(emitterIdSuggestion
|
||||
.executes { context ->
|
||||
val emitterIdVal = StringArgumentType.getString(context, "Emitter ID")
|
||||
val emitterPresetVal = StringArgumentType.getString(context, "Registered Emitter ID") ?: "DEFAULT"
|
||||
@@ -136,9 +132,7 @@ fun argCreate() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
// output -> removes the particle with that id
|
||||
fun argRemove() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
return CommandManager.literal("remove")
|
||||
.then(
|
||||
// [emitter id]
|
||||
emitterIdSuggestion
|
||||
.then(emitterIdSuggestion
|
||||
.executes { context ->
|
||||
val emitterIdVal = StringArgumentType.getString(context, "Registered Emitter ID") ?: "NULL"
|
||||
val isRemoved = removeFromEmitterRegister(emitterIdVal)
|
||||
@@ -184,9 +178,7 @@ fun argList() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
// output -> give player a command block with the particle params (should be paste-able in kotlin)
|
||||
fun argCopy() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
return CommandManager.literal("copy")
|
||||
.then(
|
||||
// [emitter id]
|
||||
emitterIdSuggestion
|
||||
.then(emitterIdSuggestion
|
||||
.executes { context ->
|
||||
val emitterIdVal = StringArgumentType.getString(context, "Registered Emitter ID")
|
||||
val commandBlock = makeCommandBlock(
|
||||
@@ -226,18 +218,15 @@ fun argCopy() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
// output -> update the selected parameter of the selected emitter id to the new value
|
||||
fun argConfig() : LiteralArgumentBuilder<ServerCommandSource> {
|
||||
return CommandManager.literal("config")
|
||||
.then(
|
||||
emitterIdSuggestion
|
||||
.then(
|
||||
CommandManager.literal("EMITTER")
|
||||
.then(emitterIdSuggestion
|
||||
.then(CommandManager.literal("EMITTER")
|
||||
.then(emitterConfigKeys.maxCount())
|
||||
.then(emitterConfigKeys.spawnsPerTick())
|
||||
.then(emitterConfigKeys.loopDur())
|
||||
.then(emitterConfigKeys.loopDelay())
|
||||
.then(emitterConfigKeys.loopCount())
|
||||
)
|
||||
.then(
|
||||
CommandManager.argument("Particle Index", IntegerArgumentType.integer())
|
||||
.then(CommandManager.argument("Particle Index", IntegerArgumentType.integer())
|
||||
.suggests { context, builder ->
|
||||
val emitterId = StringArgumentType.getString(context, "Registered Emitter ID")
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.bytedice.bde_particles.particles
|
||||
|
||||
data class ForceField (
|
||||
val x: Float = 0.0f,
|
||||
val y: Float = 0.0f,
|
||||
val z: Float = 0.0f,
|
||||
val minForce: Float = 0.0f,
|
||||
val maxForce: Float = 0.0f,
|
||||
val shape: ForceFieldShape = ForceFieldShape.Sphere()
|
||||
)
|
||||
import org.joml.Vector3f
|
||||
|
||||
data class ForceField (
|
||||
val name: String = "DEFAULT",
|
||||
val pos: Vector3f = Vector3f(0.0f, 0.0f, 0.0f),
|
||||
val force: Pair<Float, Float> = Pair(0.0f, 1.0f),
|
||||
val shape: ForceFieldShape = ForceFieldShape.SPHERE()
|
||||
)
|
||||
@@ -42,21 +42,21 @@ class Particle(private val particleParams: ParticleParams) {
|
||||
val newSpawnPos: Vector3f
|
||||
|
||||
when (shape) {
|
||||
is SpawningShape.Circle -> {
|
||||
is SpawningShape.CIRCLE -> {
|
||||
val posInCircle = randomInCircle(shape.radius)
|
||||
newSpawnPos = Vector3f(posInCircle.x, 0.0f, posInCircle.y)
|
||||
}
|
||||
|
||||
is SpawningShape.Sphere -> {
|
||||
is SpawningShape.SPHERE -> {
|
||||
newSpawnPos = randomInSphere(shape.radius)
|
||||
}
|
||||
|
||||
is SpawningShape.Rect -> {
|
||||
is SpawningShape.RECT -> {
|
||||
val posInRect = randomInRect(shape.size)
|
||||
newSpawnPos = Vector3f(posInRect.x, 0.0f, posInRect.y)
|
||||
}
|
||||
|
||||
is SpawningShape.Cube -> {
|
||||
is SpawningShape.CUBE -> {
|
||||
newSpawnPos = randomInCube(shape.size)
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.joml.Vector3f
|
||||
* @param sizeCurve A curve which the size gets multiplied by during the particle's lifetime.
|
||||
*/
|
||||
data class ParticleParams (
|
||||
var shape: SpawningShape? = SpawningShape.Circle(3.0f),
|
||||
var shape: SpawningShape? = SpawningShape.CIRCLE(3.0f),
|
||||
var blockCurve: Array<String> = arrayOf("minecraft:shroomlight", "minecraft:orange_concrete", "minecraft:orange_stained_glass", "minecraft:gray_stained_glass", "minecraft:light_gray_stained_glass"),
|
||||
var rotRandom: Pair<Vector3f, Vector3f> = Pair(Vector3f(0.0f, 0.0f, 0.0f), Vector3f(360.0f, 360.0f, 360.0f)),
|
||||
var rotVelRandom: Pair<Vector3f, Vector3f> = Pair(Vector3f(-0.2f, -0.2f, -0.2f), Vector3f(0.2f, 0.2f, 0.2f)),
|
||||
|
||||
@@ -4,20 +4,15 @@ import org.joml.Vector2f
|
||||
import org.joml.Vector3f
|
||||
|
||||
sealed class SpawningShape {
|
||||
data class Circle(val radius: Float = 1.0f) : SpawningShape()
|
||||
data class Rect (val size: Vector2f = Vector2f(1.0f, 1.0f)) : SpawningShape()
|
||||
data class Cube (val size: Vector3f = Vector3f(1.0f, 1.0f, 1.0f)) : SpawningShape()
|
||||
data class Sphere(val radius: Float = 1.0f) : SpawningShape()
|
||||
data class CIRCLE(val radius: Float = 1.0f) : SpawningShape()
|
||||
data class RECT (val size: Vector2f = Vector2f(1.0f, 1.0f)) : SpawningShape()
|
||||
data class CUBE (val size: Vector3f = Vector3f(1.0f, 1.0f, 1.0f)) : SpawningShape()
|
||||
data class SPHERE(val radius: Float = 1.0f) : SpawningShape()
|
||||
}
|
||||
|
||||
sealed class ForceFieldShape {
|
||||
data class Sphere(
|
||||
val pos: Vector3f = Vector3f(0.0f, 0.0f, 0.0f),
|
||||
val radius: Float = 1.0f
|
||||
) : ForceFieldShape()
|
||||
|
||||
data class Rect(
|
||||
val pos: Vector3f = Vector3f(0.0f, 0.0f, 0.0f),
|
||||
data class SPHERE(val radius: Float = 1.0f) : ForceFieldShape()
|
||||
data class CUBE(
|
||||
val size: Vector3f = Vector3f(1.0f, 1.0f, 1.0f),
|
||||
val forceDir: Vector3f = Vector3f(0.0f, 0.0f, 0.0f) // 0.0 on all means from center
|
||||
) : ForceFieldShape()
|
||||
|
||||
Reference in New Issue
Block a user