From f97613eafb4a9fc221789ac3a900ada59e9cc8c0 Mon Sep 17 00:00:00 2001 From: NoahTheNerd Date: Mon, 17 Jun 2024 22:28:00 +0200 Subject: [PATCH] Automatically replace spaces with underscores in particle types --- .../kotlin/live/ixnoah/tapactions/actions/WorldActions.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/live/ixnoah/tapactions/actions/WorldActions.kt b/src/main/kotlin/live/ixnoah/tapactions/actions/WorldActions.kt index d550c80..2c25fa3 100644 --- a/src/main/kotlin/live/ixnoah/tapactions/actions/WorldActions.kt +++ b/src/main/kotlin/live/ixnoah/tapactions/actions/WorldActions.kt @@ -11,9 +11,11 @@ object WorldActions { var particlesRendered = 0 private fun actionParticle(params: MutableMap) { if (particlesRendered > 100) return - if (EnumParticleTypes.entries.none { it.name == params["type"]?.uppercase() }) return + val formattedType = params["type"]!!.uppercase().replace(' ', '_') - val particleType = EnumParticleTypes.valueOf(params["type"]!!.uppercase()) + if (EnumParticleTypes.entries.none { it.name == formattedType }) return + + val particleType = EnumParticleTypes.valueOf(formattedType) var pos = Coordinates.parseCoordinates(params["pos"] ?: "~ ~0.15 ~", Minecraft.getMinecraft().thePlayer) if (params["round"] != null) pos = pos.mapValues { (floor(it.value) + 0.5 * it.value.sign) }