Skip to content

Add option to toggle integer centering in LocationArgument and Location2DArgument #487

@learliet

Description

@learliet

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestimplemented for next releaseThis has been implemented in the current dev build for the next public release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions