Record Class InputPattern
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.dialogue.InputPattern
- Record Components:
pattern- The regex pattern.errorMessage- The error message to display when the input is invalid.errorDuration- The duration in milliseconds that the error message will display in the display box.
public record InputPattern(Pattern pattern, net.minecraft.network.chat.Component errorMessage, long errorDuration)
extends Record
Represents a pattern that the user's input must match.
This is checked against the user's input when they press a button to submit their input.
This is checked against the user's input when they press a button to submit their input.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionInputPattern(Pattern pattern, net.minecraft.network.chat.Component errorMessage, long errorDuration) Creates an instance of aInputPatternrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic InputPattern.Builderbuilder()Creates a newInputPatternbuilder.static InputPatterndecode(net.minecraft.network.FriendlyByteBuf buffer) Reads anInputPatternfrom the givenFriendlyByteBuf.voidencode(net.minecraft.network.FriendlyByteBuf buffer) Encodes theInputPatterninto the givenFriendlyByteBuf.final booleanIndicates whether some other object is "equal to" this one.longReturns the value of theerrorDurationrecord component.net.minecraft.network.chat.ComponentReturns the value of theerrorMessagerecord component.final inthashCode()Returns a hash code value for this object.static InputPatternCreates a newInputPatternwith the given pattern and error message.static InputPatternCreates a newInputPatternwith the given pattern and error message.static InputPatternCreates a newInputPatternwith the given pattern, error message, and error duration.pattern()Returns the value of thepatternrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
InputPattern
public InputPattern(Pattern pattern, net.minecraft.network.chat.Component errorMessage, long errorDuration) Creates an instance of aInputPatternrecord class.- Parameters:
pattern- the value for thepatternrecord componenterrorMessage- the value for theerrorMessagerecord componenterrorDuration- the value for theerrorDurationrecord component
-
-
Method Details
-
encode
@Internal public void encode(net.minecraft.network.FriendlyByteBuf buffer) Encodes theInputPatterninto the givenFriendlyByteBuf.- Parameters:
buffer- The buffer.
-
decode
Reads anInputPatternfrom the givenFriendlyByteBuf.- Parameters:
buffer- The buffer.- Returns:
- The
InputPattern.
-
of
public static InputPattern of(Pattern pattern, net.minecraft.network.chat.Component errorMessage, long errorDuration) Creates a newInputPatternwith the given pattern, error message, and error duration.- Parameters:
pattern- The pattern.errorMessage- The error message.errorDuration- The duration in milliseconds that the error message will display in the display box.- Returns:
- The
InputPattern.
-
of
Creates a newInputPatternwith the given pattern and error message.- Parameters:
pattern- The pattern.errorMessage- The error message.- Returns:
- The
InputPattern.
-
of
Creates a newInputPatternwith the given pattern and error message.- Parameters:
pattern- The pattern.errorMessage- The error message.- Returns:
- The
InputPattern.
-
builder
Creates a newInputPatternbuilder.- Returns:
-
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 '=='. -
pattern
Returns the value of thepatternrecord component.- Returns:
- the value of the
patternrecord component
-
errorMessage
public net.minecraft.network.chat.Component errorMessage()Returns the value of theerrorMessagerecord component.- Returns:
- the value of the
errorMessagerecord component
-
errorDuration
public long errorDuration()Returns the value of theerrorDurationrecord component.- Returns:
- the value of the
errorDurationrecord component
-