In-depth review of Controllers.

Built-in controllers

This is an incomplete list of controllers!

There are many different built-in controllers to get you set up quickly.


A toggleable controller that displays a different Text based on the state of the option.

  • valueFormatter parameter is a function to return Text based on the state of the option. (optional)

  • coloured parameter is a boolean that colours the returned text red or green based on the state. (optional)

To pass extra parameters, you need to construct a BooleanController like so.

.controller(opt -> BooleanControllerBuilder.create(opt)
        .valueFormatter(val -> val ? Component.literal("Amazing") : Component.literal("Not Amazing"))

A toggleable controller that displays a tick box.


There are no optional parameters for this controller.


Replace <Number> with either Double, Float, Integer and Long.

Slider controllers take a minimum, a maximum and a step for the slider in their respected number types.

.controller(opt -> FloatSliderController.create(opt)
        .range(0, 10)
        .valueFormatter(val -> Component.literal(val + " ticks"))) // sliders can also take a formatter

A controller that allows you to cycle through Enum constants.

.controller(opt -> EnumControllerBuilder.create(opt)

Enums can implement the NameableEnum interface to automatically name each constant without a value formatter function.

public interface Alphabet implements NameableEnum {
    public Component getDisplayName() {
        return Component.translatable("mymod.alphabet." + name().toLowerCase());

Or alternatively, just pass a valueFormatter to the controller as usual;

.controller(opt -> EnumControllerBuilder.create(opt)
        .valueFormatter(v -> Component.translatable("mymod.alphabet." +

An input box that allows users to input text as a String. This allows for highlighting text with the keyboard and strings that are longer than the option itself, similarly to Minecraft's EditBox


This controller has no arguments, though its functionality can be extended by creating your own controller, implementing IStringController, more on this here.


A controller that allows users to input colors as RGB hex format, with a preview.

  • allowAlpha parameter adds an alpha channel to the hex format as RGBA.

.controller(opt -> ColorControllerBuilder.create(opt)

Replace <Number> with either Double, Float, Long or Integer.

Similar to StringController, but forces a number format, doubles and floats allow decimals, but longs and integers do not.


It also has a optional range where you can specify the upper and lower bound if necessary. And like usual has a value formatter.

.controller(opt -> <Number>SliderControllerBuilder.create(opt)

Creating a custom Controller

Last updated