Skip to content

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();

These value formatters are for ValueElement<Boolean>’s.

Returns “ON” for true, and “OFF” for false.

This uses Minecraft’s translation keys options.on and options.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.


Returns “Yes” for true, and “No” for false.


Returns “True” for true, and “False” for false.


Returns “Enabled” for true, and “Disabled” for false.

These value formatters are for ValueElement<Number>’s.

Formats the number with 2 decimal places.


Formats the number with no decimal places.


Formats the number as a percentage.


Returns “Normal” if it is 70 and Quake Pro if it is 110, otherwise it formats the number with no decimal places.


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.