Interface DialogInput
- All Known Implementing Classes:
DialogInput.Bool, DialogInput.NumberRange, DialogInput.SingleOption, DialogInput.Text
public sealed interface DialogInput
permits DialogInput.Text, DialogInput.Bool, DialogInput.SingleOption, DialogInput.NumberRange
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordA checkbox, mapping to the vanillaminecraft:booleancontrol.static final recordA slider between two numbers.static final recordA drop-down of preset options.static final recordA text field. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault width of an input control.static final intLargest width the client accepts for an input control. -
Method Summary
Modifier and TypeMethodDescriptionstatic DialogInput.Boolcheckbox(String key, ComponentLike label) Creates an unchecked checkbox sendingtrueorfalse.key()Returns the identifier the submitted value is sent under.label()Returns the label displayed to the left of the control.numberRange(String key, ComponentLike label, float start, float end) Starts building a number slider.singleOption(String key, ComponentLike label) Starts building a preset option selection.static DialogInput.Text.Buildertext(String key, ComponentLike label) Starts building a single line text field.
-
Field Details
-
MAX_WIDTH
static final int MAX_WIDTHLargest width the client accepts for an input control.- Since:
- 0.1.0
- See Also:
-
DEFAULT_WIDTH
static final int DEFAULT_WIDTHDefault width of an input control.- Since:
- 0.1.0
- See Also:
-
-
Method Details
-
text
Starts building a single line text field.- Parameters:
key- the identifier the value is sent underlabel- the label displayed next to the field- Returns:
- a fresh builder
- Since:
- 0.1.0
-
checkbox
Creates an unchecked checkbox sendingtrueorfalse.- Parameters:
key- the identifier the value is sent underlabel- the label displayed next to the checkbox- Returns:
- the input control
- Since:
- 0.1.0
-
singleOption
@Contract("_, _ -> new") static DialogInput.SingleOption.Builder singleOption(String key, ComponentLike label) Starts building a preset option selection.- Parameters:
key- the identifier the value is sent underlabel- the label displayed next to the control- Returns:
- a fresh builder
- Since:
- 0.1.0
-
numberRange
@Contract("_, _, _, _ -> new") static DialogInput.NumberRange.Builder numberRange(String key, ComponentLike label, float start, float end) Starts building a number slider.- Parameters:
key- the identifier the value is sent underlabel- the label displayed next to the sliderstart- the lowest value of the sliderend- the highest value of the slider- Returns:
- a fresh builder
- Since:
- 0.1.0
-
key
String key()Returns the identifier the submitted value is sent under.Only letters, digits and
_are allowed, so that the key is usable as a macro argument.- Returns:
- the identifier the submitted value is sent under
- Since:
- 0.1.0
-
label
Component label()Returns the label displayed to the left of the control.- Returns:
- the label displayed to the left of the control
- Since:
- 0.1.0
-