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.
  • 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 a DialogueButton record class.
      Parameters:
      uuid - the value for the uuid record component
      text - the value for the text record component
      backgroundColor - the value for the backgroundColor record component
      backgroundHoverColor - the value for the backgroundHoverColor record component
      acceptedInputs - the value for the acceptedInputs record component
      onClick - the value for the onClick record component
  • Method Details

    • encode

      @Internal public void encode(net.minecraft.network.FriendlyByteBuf buffer)
      Encodes the DialogueButton into the given FriendlyByteBuf.
      Parameters:
      buffer - The buffer.
    • decode

      @Internal public static DialogueButton decode(net.minecraft.network.FriendlyByteBuf buffer)
      Decodes a DialogueButton from the given FriendlyByteBuf.
      Parameters:
      buffer - The buffer.
      Returns:
      The DialogueButton.
    • builder

      public static DialogueButton.Builder builder()
      Returns:
      The DialogueButton.Builder.
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • uuid

      public UUID uuid()
      Returns the value of the uuid record component.
      Returns:
      the value of the uuid record component
    • text

      public net.minecraft.network.chat.Component text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • backgroundColor

      public Color backgroundColor()
      Returns the value of the backgroundColor record component.
      Returns:
      the value of the backgroundColor record component
    • backgroundHoverColor

      public Color backgroundHoverColor()
      Returns the value of the backgroundHoverColor record component.
      Returns:
      the value of the backgroundHoverColor record component
    • acceptedInputs

      public InputPattern[] acceptedInputs()
      Returns the value of the acceptedInputs record component.
      Returns:
      the value of the acceptedInputs record component
    • onClick

      Returns the value of the onClick record component.
      Returns:
      the value of the onClick record component