Add option to toggle integer centering in LocationArgument and Location2DArgument
learliet opened this issue · comments
Description
Currently, the CommandAPI's LocationType.PRECISE_POSITION
uses Vec3Argument.vec3()
. This causes integer values to be centered, which may not always be desired. It seems that the Vec3Argument
has a boolean option called "centerIntegers" that determines whether or not it performs the correction.
It would be beneficial to utilize this option, allowing for straightforward offset arguments that accept three numbers without any modifications. This enhancement would align with the behavior of the delta argument in the vanilla particle command.
Expected code
No response
Extra details
A temporary workaround for developers who ran into the same issue:
val delta = args[0] as Location
val deltaNew = args.getRaw(0)!!.split(" ").map {
if (it.contains('.')) null else it.toDoubleOrNull()
}.toMutableList()
delta.x = deltaNew[0] ?: delta.x
delta.y = deltaNew[1] ?: delta.y
delta.z = deltaNew[2] ?: delta.z
Implemented in 9.2.0.