Record Class TextInput
java.lang.Object
java.lang.Record
net.minecraft.server.dialog.input.TextInput
- All Implemented Interfaces:
InputControl
public record TextInput(int width, Component label, boolean labelVisible, String initial, int maxLength, Optional<TextInput.MultilineOptions> multiline)
extends Record
implements InputControl
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
The field for theinitial
record component.private final Component
The field for thelabel
record component.private final boolean
The field for thelabelVisible
record component.static final com.mojang.serialization.MapCodec
<TextInput> private final int
The field for themaxLength
record component.private final Optional
<TextInput.MultilineOptions> The field for themultiline
record component.private final int
The field for thewidth
record component. -
Constructor Summary
ConstructorsConstructorDescriptionTextInput
(int width, Component label, boolean labelVisible, String initial, int maxLength, Optional<TextInput.MultilineOptions> multiline) Creates an instance of aTextInput
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.initial()
Returns the value of theinitial
record component.label()
Returns the value of thelabel
record component.boolean
Returns the value of thelabelVisible
record component.com.mojang.serialization.MapCodec
<TextInput> mapCodec()
int
Returns the value of themaxLength
record component.Returns the value of themultiline
record component.final String
toString()
Returns a string representation of this record class.int
width()
Returns the value of thewidth
record component.
-
Field Details
-
width
private final int widthThe field for thewidth
record component. -
label
The field for thelabel
record component. -
labelVisible
private final boolean labelVisibleThe field for thelabelVisible
record component. -
initial
The field for theinitial
record component. -
maxLength
private final int maxLengthThe field for themaxLength
record component. -
multiline
The field for themultiline
record component. -
MAP_CODEC
-
-
Constructor Details
-
TextInput
public TextInput(int width, Component label, boolean labelVisible, String initial, int maxLength, Optional<TextInput.MultilineOptions> multiline) Creates an instance of aTextInput
record class.- Parameters:
width
- the value for thewidth
record componentlabel
- the value for thelabel
record componentlabelVisible
- the value for thelabelVisible
record componentinitial
- the value for theinitial
record componentmaxLength
- the value for themaxLength
record componentmultiline
- the value for themultiline
record component
-
-
Method Details
-
mapCodec
- Specified by:
mapCodec
in interfaceInputControl
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
width
public int width()Returns the value of thewidth
record component.- Returns:
- the value of the
width
record component
-
label
Returns the value of thelabel
record component.- Returns:
- the value of the
label
record component
-
labelVisible
public boolean labelVisible()Returns the value of thelabelVisible
record component.- Returns:
- the value of the
labelVisible
record component
-
initial
Returns the value of theinitial
record component.- Returns:
- the value of the
initial
record component
-
maxLength
public int maxLength()Returns the value of themaxLength
record component.- Returns:
- the value of the
maxLength
record component
-
multiline
Returns the value of themultiline
record component.- Returns:
- the value of the
multiline
record component
-