When using a FloatFieldController or DoubleFieldController there seems to be an error on how the number is read back from the input field.
Everytime you click on an area that is not the option, the value increases by ^10 with some exceptions.
Another issue is, that you cannot close the config screen, because every time you click on done/save changes, the values are changed.
This bug occours on version '3.1.0+1.20 (Fabric)' and was tested by me and a friend in seperate projects.
edit: version '3.1.1+1.20 (Fabric)' is also affected.
private const val TEST_FLOAT_DEFAULT = 0.00002f
private var testFloat = 0f
private fun buildTestFloat() =
Option.createBuilder<Float>()
.name(Text.of("Float Test"))
.description { it ->
OptionDescription.of(Text.of("""
This is a test option for floats.
It has a default value of $TEST_FLOAT_DEFAULT.
Current value: $it
""".trimIndent()))
}
.binding(TEST_FLOAT_DEFAULT, { testFloat }, { it -> testFloat = it })
.controller { it ->
FloatFieldControllerBuilder.create(it).valueFormatter { Text.literal(it.toString()) }
}.build()
Here I'm using Text.literal(it.toString()) but the results are the same if you use the default formatter or any other.
When using a FloatFieldController or DoubleFieldController there seems to be an error on how the number is read back from the input field. Everytime you click on an area that is not the option, the value increases by ^10 with some exceptions. Another issue is, that you cannot close the config screen, because every time you click on done/save changes, the values are changed.
This bug occours on version '3.1.0+1.20 (Fabric)' and was tested by me and a friend in seperate projects. edit: version '3.1.1+1.20 (Fabric)' is also affected.
Showcase video:
https://github.com/isXander/YetAnotherConfigLib/assets/42215949/fab793d1-9aaf-42df-9dd2-aa9cf03aa6f7
Code from the video (written in Kotlin):
Here I'm using
Text.literal(it.toString())
but the results are the same if you use the default formatter or any other.