Record Class DialogueButton
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.dialogue.DialogueButton
- Record Components:
uuid
- A unique identifier for this button.text
- The text to display on the button.backgroundColor
- The background color of the button.backgroundHoverColor
- The background color of the button when the user hovers over it.acceptedInputs
- The patterns that the user's input must match.onClick
- The handler for when the user clicks the button.
public record DialogueButton(UUID uuid, net.minecraft.network.chat.Component text, Color backgroundColor, Color backgroundHoverColor, InputPattern[] acceptedInputs, Consumer<DialogueInputEvent.Submitted> onClick)
extends Record
A button that can be added to a Dialogue through
DialogueFactory
to allow the user to submit their input.-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionDialogueButton
(UUID uuid, net.minecraft.network.chat.Component text, Color backgroundColor, Color backgroundHoverColor, InputPattern[] acceptedInputs, Consumer<DialogueInputEvent.Submitted> onClick) Creates an instance of aDialogueButton
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theacceptedInputs
record component.Returns the value of thebackgroundColor
record component.Returns the value of thebackgroundHoverColor
record component.static DialogueButton.Builder
builder()
Creates a newDialogueButton.Builder
for aDialogueButton
.static DialogueButton
decode
(net.minecraft.network.FriendlyByteBuf buffer) Decodes aDialogueButton
from the givenFriendlyByteBuf
.void
encode
(net.minecraft.network.FriendlyByteBuf buffer) Encodes theDialogueButton
into the givenFriendlyByteBuf
.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.onClick()
Returns the value of theonClick
record component.net.minecraft.network.chat.Component
text()
Returns the value of thetext
record component.final String
toString()
Returns a string representation of this record class.uuid()
Returns the value of theuuid
record component.
-
Constructor Details
-
DialogueButton
public DialogueButton(UUID uuid, net.minecraft.network.chat.Component text, Color backgroundColor, Color backgroundHoverColor, InputPattern[] acceptedInputs, Consumer<DialogueInputEvent.Submitted> onClick) Creates an instance of aDialogueButton
record class.- Parameters:
uuid
- the value for theuuid
record componenttext
- the value for thetext
record componentbackgroundColor
- the value for thebackgroundColor
record componentbackgroundHoverColor
- the value for thebackgroundHoverColor
record componentacceptedInputs
- the value for theacceptedInputs
record componentonClick
- the value for theonClick
record component
-
-
Method Details
-
encode
@Internal public void encode(net.minecraft.network.FriendlyByteBuf buffer) Encodes theDialogueButton
into the givenFriendlyByteBuf
.- Parameters:
buffer
- The buffer.
-
decode
Decodes aDialogueButton
from the givenFriendlyByteBuf
.- Parameters:
buffer
- The buffer.- Returns:
- The
DialogueButton
.
-
builder
Creates a newDialogueButton.Builder
for aDialogueButton
.- Returns:
- The
DialogueButton.Builder
.
-
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. All components in this record class are compared withObjects::equals(Object,Object)
. -
uuid
Returns the value of theuuid
record component.- Returns:
- the value of the
uuid
record component
-
text
public net.minecraft.network.chat.Component text()Returns the value of thetext
record component.- Returns:
- the value of the
text
record component
-
backgroundColor
Returns the value of thebackgroundColor
record component.- Returns:
- the value of the
backgroundColor
record component
-
backgroundHoverColor
Returns the value of thebackgroundHoverColor
record component.- Returns:
- the value of the
backgroundHoverColor
record component
-
acceptedInputs
Returns the value of theacceptedInputs
record component.- Returns:
- the value of the
acceptedInputs
record component
-
onClick
Returns the value of theonClick
record component.- Returns:
- the value of the
onClick
record component
-