fixed bug where creating a particle with a minecraft: prefix crashes server
This commit is contained in:
@@ -122,12 +122,14 @@ object ManageEmitters {
|
||||
}
|
||||
|
||||
private fun createExec(context: CommandContext<ServerCommandSource>, newEmitterId: String, presetEmitterId: String) {
|
||||
val params = getEmitterDataById(presetEmitterId)
|
||||
val params = getEmitterDataById(presetEmitterId)?.copy()
|
||||
val usedDefault = params == null
|
||||
|
||||
println(params?.modelCurve?.array?.size)
|
||||
|
||||
val result = addToRegister(
|
||||
newEmitterId,
|
||||
if (usedDefault) { EmitterParams.DEFAULT } else { params!! },
|
||||
params ?: EmitterParams.DEFAULT,
|
||||
)
|
||||
|
||||
if (usedDefault && result.second) {
|
||||
|
||||
@@ -29,13 +29,11 @@ fun addToRegister(id: String, params: EmitterParams) : Pair<String, Boolean> {
|
||||
|
||||
for (model in params.modelCurve.array) {
|
||||
val modelModIdRegex = ".*:".toRegex()
|
||||
if (modelModIdRegex.containsMatchIn(model)) { break }
|
||||
else {
|
||||
newModels.add("minecraft:$model")
|
||||
}
|
||||
if (modelModIdRegex.containsMatchIn(model)) { newModels.add(model) }
|
||||
else { newModels.add("minecraft:$model") }
|
||||
}
|
||||
|
||||
params.modelCurve = ParamClasses.StringCurve(newModels.toTypedArray(), params.modelCurve.curve)
|
||||
params.modelCurve.array = newModels.toTypedArray()
|
||||
|
||||
idRegister[id] = params
|
||||
println("BPS - Registered Emitter ID \"$newId\".")
|
||||
|
||||
Reference in New Issue
Block a user