aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/isxander/yacl/api/Controller.java
blob: 198e5dfc13fb821e30bb503ec018d175947953f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package dev.isxander.yacl.api;

import dev.isxander.yacl.api.utils.Dimension;
import dev.isxander.yacl.gui.YACLScreen;
import dev.isxander.yacl.gui.controllers.ControllerWidget;
import net.minecraft.text.Text;
import org.jetbrains.annotations.ApiStatus;

/**
 * Provides a widget to control the option.
 */
public interface Controller<T> {
    /**
     * Gets the dedicated {@link Option} for this controller
     */
    Option<T> option();

    /**
     * Gets the formatted value based on {@link Option#pendingValue()}
     */
    Text formatValue();

    /**
     * Provides a widget to display
     *
     * @param screen parent screen
     */
    @ApiStatus.Internal
    ControllerWidget<?> provideWidget(YACLScreen screen, Dimension<Integer> widgetDimension);
}