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
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDialogueButton(UUID uuid, net.minecraft.network.chat.Component text, Color backgroundColor, Color backgroundHoverColor, InputPattern[] acceptedInputs, Consumer<DialogueInputEvent.Submitted> onClick) Creates an instance of aDialogueButtonrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theacceptedInputsrecord component.Returns the value of thebackgroundColorrecord component.Returns the value of thebackgroundHoverColorrecord component.static DialogueButton.Builderbuilder()Creates a newDialogueButton.Builderfor aDialogueButton.static DialogueButtondecode(net.minecraft.network.FriendlyByteBuf buffer) Decodes aDialogueButtonfrom the givenFriendlyByteBuf.voidencode(net.minecraft.network.FriendlyByteBuf buffer) Encodes theDialogueButtoninto the givenFriendlyByteBuf.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.onClick()Returns the value of theonClickrecord component.net.minecraft.network.chat.Componenttext()Returns the value of thetextrecord component.final StringtoString()Returns a string representation of this record class.uuid()Returns the value of theuuidrecord 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 aDialogueButtonrecord class.- Parameters:
uuid- the value for theuuidrecord componenttext- the value for thetextrecord componentbackgroundColor- the value for thebackgroundColorrecord componentbackgroundHoverColor- the value for thebackgroundHoverColorrecord componentacceptedInputs- the value for theacceptedInputsrecord componentonClick- the value for theonClickrecord component
-
-
Method Details
-
encode
@Internal public void encode(net.minecraft.network.FriendlyByteBuf buffer) Encodes theDialogueButtoninto the givenFriendlyByteBuf.- Parameters:
buffer- The buffer.
-
decode
Decodes aDialogueButtonfrom the givenFriendlyByteBuf.- Parameters:
buffer- The buffer.- Returns:
- The
DialogueButton.
-
builder
Creates a newDialogueButton.Builderfor 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 theuuidrecord component.- Returns:
- the value of the
uuidrecord component
-
text
public net.minecraft.network.chat.Component text()Returns the value of thetextrecord component.- Returns:
- the value of the
textrecord component
-
backgroundColor
Returns the value of thebackgroundColorrecord component.- Returns:
- the value of the
backgroundColorrecord component
-
backgroundHoverColor
Returns the value of thebackgroundHoverColorrecord component.- Returns:
- the value of the
backgroundHoverColorrecord component
-
acceptedInputs
Returns the value of theacceptedInputsrecord component.- Returns:
- the value of the
acceptedInputsrecord component
-
onClick
Returns the value of theonClickrecord component.- Returns:
- the value of the
onClickrecord component
-