Value Formatters
A value formatter is an interface ValueFormatter<T> that accepts a ValueElement<T> and returns its value formatted as Minecraft Text.
Example:
ToggleButton.builder() .value(true) .valueFormatter(ValueFormatters.BOOLEAN_ENABLED_DISABLED) .build();Boolean value formatters
Section titled “Boolean value formatters”These value formatters are for ValueElement<Boolean>’s.
BOOLEAN_MINECRAFT_ON_OFF
Section titled “BOOLEAN_MINECRAFT_ON_OFF”Returns “ON” for true, and “OFF” for false.
This uses Minecraft’s translation keys options.on and options.off.
BOOLEAN_ON_OFF
Section titled “BOOLEAN_ON_OFF”Returns “On” for true, and “Off” for false.
This uses Bento GUI’s translation keys text.bento_gui.on and text.bento_gui.off.
BOOLEAN_YES_NO
Section titled “BOOLEAN_YES_NO”Returns “Yes” for true, and “No” for false.
BOOLEAN_TRUE_FALSE
Section titled “BOOLEAN_TRUE_FALSE”Returns “True” for true, and “False” for false.
BOOLEAN_ENABLED_DISABLED
Section titled “BOOLEAN_ENABLED_DISABLED”Returns “Enabled” for true, and “Disabled” for false.
Number value formatters
Section titled “Number value formatters”These value formatters are for ValueElement<Number>’s.
NUMBER_TWO_DECIMAL
Section titled “NUMBER_TWO_DECIMAL”Formats the number with 2 decimal places.
NUMBER_NO_DECIMAL
Section titled “NUMBER_NO_DECIMAL”Formats the number with no decimal places.
NUMBER_PERCENT
Section titled “NUMBER_PERCENT”Formats the number as a percentage.
NUMBER_MINECRAFT_FOV
Section titled “NUMBER_MINECRAFT_FOV”Returns “Normal” if it is 70 and Quake Pro if it is 110, otherwise it formats the number with no decimal places.
NUMBER_MINERAFT_BRIGHTNESS
Section titled “NUMBER_MINERAFT_BRIGHTNESS”Returns “Moody” if it is 0, “Default” if it is 50, and “Bright” if it is 100, otherwise it formats the number with no decimal places.