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
-
Constructor Summary
ConstructorDescriptionInputPattern
(Pattern pattern, net.minecraft.network.chat.Component errorMessage, long errorDuration) Creates an instance of aInputPattern
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic InputPattern.Builder
builder()
Creates a newInputPattern
builder.static InputPattern
decode
(net.minecraft.network.FriendlyByteBuf buffer) Reads anInputPattern
from the givenFriendlyByteBuf
.void
encode
(net.minecraft.network.FriendlyByteBuf buffer) Encodes theInputPattern
into the givenFriendlyByteBuf
.final boolean
Indicates whether some other object is "equal to" this one.long
Returns the value of theerrorDuration
record component.net.minecraft.network.chat.Component
Returns the value of theerrorMessage
record component.final int
hashCode()
Returns a hash code value for this object.static InputPattern
Creates a newInputPattern
with the given pattern and error message.static InputPattern
Creates a newInputPattern
with the given pattern and error message.static InputPattern
Creates a newInputPattern
with the given pattern, error message, and error duration.pattern()
Returns the value of thepattern
record component.final String
toString()
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 aInputPattern
record class.- Parameters:
pattern
- the value for thepattern
record componenterrorMessage
- the value for theerrorMessage
record componenterrorDuration
- the value for theerrorDuration
record component
-
-
Method Details
-
encode
@Internal public void encode(net.minecraft.network.FriendlyByteBuf buffer) Encodes theInputPattern
into the givenFriendlyByteBuf
.- Parameters:
buffer
- The buffer.
-
decode
Reads anInputPattern
from 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 newInputPattern
with 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 newInputPattern
with the given pattern and error message.- Parameters:
pattern
- The pattern.errorMessage
- The error message.- Returns:
- The
InputPattern
.
-
of
Creates a newInputPattern
with the given pattern and error message.- Parameters:
pattern
- The pattern.errorMessage
- The error message.- Returns:
- The
InputPattern
.
-
builder
Creates a newInputPattern
builder.- 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 thepattern
record component.- Returns:
- the value of the
pattern
record component
-
errorMessage
public net.minecraft.network.chat.Component errorMessage()Returns the value of theerrorMessage
record component.- Returns:
- the value of the
errorMessage
record component
-
errorDuration
public long errorDuration()Returns the value of theerrorDuration
record component.- Returns:
- the value of the
errorDuration
record component
-