Skip to content

Commit

Permalink
Automatically replace spaces with underscores in particle types
Browse files Browse the repository at this point in the history
  • Loading branch information
ixnoahlive committed Jun 17, 2024
1 parent 409e1ac commit f97613e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ object WorldActions {
var particlesRendered = 0
private fun actionParticle(params: MutableMap<String, String>) {
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) }
Expand Down

0 comments on commit f97613e

Please sign in to comment.