Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
learliet opened this issue Sep 6, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request implemented for next release This has been implemented in the current dev build for the next public release

Comments

@learliet
Copy link

learliet commented Sep 6, 2023

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
@learliet learliet added the enhancement New feature or request label Sep 6, 2023
@JorelAli JorelAli self-assigned this Sep 8, 2023
@JorelAli
Copy link
Owner

JorelAli commented Sep 8, 2023

Awesome! I didn't know there was a parameter in the Vec3Argument class, and this finally solves the mystery that I had discovered in one of the CommandAPI's tests for the LocationArgument:

image

Will implement for the next release.

@JorelAli JorelAli added the scheduled for next release This will be implemented for the next public release label Sep 8, 2023
@JorelAli JorelAli added implemented for next release This has been implemented in the current dev build for the next public release and removed scheduled for next release This will be implemented for the next public release labels Sep 8, 2023
@JorelAli
Copy link
Owner

Implemented in 9.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request implemented for next release This has been implemented in the current dev build for the next public release
Projects
None yet
Development

No branches or pull requests

2 participants