Class DialogueFactory.Builder

java.lang.Object
com.pixelmonmod.pixelmon.api.dialogue.DialogueFactory.Builder
Enclosing class:
DialogueFactory

public static class DialogueFactory.Builder extends Object
A Builder for creating a DialogueInput GUI.
The GUI will be sent to the player when sendTo(ServerPlayer...) is called.
The following fields are required:
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • title

      public DialogueFactory.Builder title(String title)
      Sets the title of the GUI.
      This converts the string to a Component using Component.literal(String).
      This is a required field.
      Parameters:
      title - The title of the GUI.
      Returns:
      This builder.
    • title

      public DialogueFactory.Builder title(net.minecraft.network.chat.Component title)
      Sets the title of the GUI.
      This is a required field.
      Parameters:
      title - The title of the GUI.
      Returns:
      This builder.
    • description

      public DialogueFactory.Builder description(String description)
      Sets the description of the GUI.
      This converts the string to a Component using Component.literal(String).
      This is a required field.
      Parameters:
      description - The description of the GUI.
      Returns:
      This builder.
    • description

      public DialogueFactory.Builder description(net.minecraft.network.chat.Component description)
      Sets the description of the GUI.
      This is a required field.
      Parameters:
      description - The description of the GUI.
      Returns:
      This builder.
    • defaultText

      public DialogueFactory.Builder defaultText(String defaultText)
      Sets the default text that shows up in the input text box.
      This converts the string to a Component using Component.literal(String).
      This is an optional field.
      Default value: Component.empty()
      Parameters:
      defaultText - The default text that shows up in the input text box.
      Returns:
      This builder.
    • defaultText

      public DialogueFactory.Builder defaultText(net.minecraft.network.chat.Component defaultText)
      Sets the default text that shows up in the input text box.
      This is an optional field.
      Default value: Component.empty()
      Parameters:
      defaultText - The default text that shows up in the input text box.
      Returns:
      This builder.
    • maxInputLength

      public DialogueFactory.Builder maxInputLength(int maxInputLength)
      Sets the max length of the input text box.
      This is an optional field.
      Default value: 50
      Parameters:
      maxInputLength -
      Returns:
    • closeOnEscape

      public DialogueFactory.Builder closeOnEscape()
      Sets the GUI to close when the player presses the escape key.
      This is an optional field.
      Default value: true
      Returns:
      This builder.
    • disableCloseOnEscape

      public DialogueFactory.Builder disableCloseOnEscape()
      Sets the GUI to not close when the player presses the escape key. Therefore, they will only be able to close the GUI by pressing the submit button.
      This is an optional field.
      Default value: true
      Returns:
      This builder.
    • setCloseOnEscape

      public DialogueFactory.Builder setCloseOnEscape(boolean closeOnEscape)
      Sets the GUI's close on escape setting.
      This is an optional field.
      Default value: true
      Parameters:
      closeOnEscape - Whether the GUI should close when the player presses the escape key.
      Returns:
      This builder.
    • hideUI

      public DialogueFactory.Builder hideUI()
      Hides the player's UI when the GUI is open.
      This is an optional field.
      Default value: false
      Returns:
      This builder.
    • keepUI

      public DialogueFactory.Builder keepUI()
      Keeps the player's UI visible when the GUI is open.
      This is an optional field.
      Default value: false
      Returns:
      This builder.
    • setHideUI

      public DialogueFactory.Builder setHideUI(boolean hideUI)
      Sets the GUI's hide UI setting.
      If this is set to true then the Pixelmon party UI, and the player's hotbar will be hidden.
      This is an optional field.
      Default value: false
      Parameters:
      hideUI - Whether the GUI should hide the player's UI.
      Returns:
      This builder.
    • showInput

      public DialogueFactory.Builder showInput()
      Sets the input text box to be visible.
      This is an optional field.
      Default value: true
      Returns:
      This builder.
    • hideInput

      public DialogueFactory.Builder hideInput()
      Hides the input text box.
      This is an optional field.
      Default value: true
      Returns:
      This builder.
    • setShowInput

      public DialogueFactory.Builder setShowInput(boolean showInput)
      Sets if the input text box should be visible.
      This is an optional field.
      Default value: true
      Parameters:
      showInput - Whether the input text box should be visible.
      Returns:
      This builder.
    • onlyIntegerInput

      public DialogueFactory.Builder onlyIntegerInput()
      Adds an accepted pattern that restricts the input text box to only accept integers as input characters.
      Returns:
      This builder.
    • onlyAlphabeticalInput

      public DialogueFactory.Builder onlyAlphabeticalInput()
      Adds an accepted pattern that restricts the input text box to only accept alphabetical characters as input characters.
      Returns:
      This builder.
    • onlyAlphabeticalAndSpaceInput

      public DialogueFactory.Builder onlyAlphabeticalAndSpaceInput()
      Adds an accepted pattern that restricts the input text box to only accept alphabetical characters and spaces as input characters.
      Returns:
      This builder.
    • onlyAlphaNumericInput

      public DialogueFactory.Builder onlyAlphaNumericInput()
      Adds an accepted pattern that restricts the input text box to only accept alphabetical characters, spaces, and numbers as input characters.
      Returns:
      This builder.
    • acceptedPatterns

      public DialogueFactory.Builder acceptedPatterns(Pattern... patterns)
      Sets the GUI's accepted patterns.
      This is an optional field.
      Default value: None (all text accepted)
      Note: If you add multiple patterns that don't have any overlap, the GUI will not accept any input.
      Parameters:
      patterns - The patterns to accept.
      Returns:
      This builder.
    • acceptedPatterns

      public DialogueFactory.Builder acceptedPatterns(String... patterns)
      Sets the GUI's accepted patterns.
      This is an optional field.
      Default value: None (all text accepted)
      Note: If you add multiple patterns that don't have any overlap, the GUI will not accept any input.
      Parameters:
      patterns - The patterns to accept.
      Returns:
      This builder.
    • acceptedPatterns

      public DialogueFactory.Builder acceptedPatterns(Iterable<Pattern> patterns)
      Sets the GUI's accepted patterns.
      This is an optional field.
      Default value: None (all text accepted)
      Note: If you add multiple patterns that don't have any overlap, the GUI will not accept any input.
      Parameters:
      patterns - The patterns to accept.
      Returns:
      This builder.
    • onClose

      public DialogueFactory.Builder onClose(@Nullable Consumer<DialogueInputEvent.ClosedScreen> closeConsumer)
      Sets the consumer to be called when the player closes the GUI.
      Parameters:
      closeConsumer - The consumer to be called when the player closes the GUI.
      Returns:
      This builder.
    • buttons

      public DialogueFactory.Builder buttons(DialogueButton... buttons)
      Adds buttons for the GUI.
      Parameters:
      buttons - The buttons to add.
      Returns:
      This builder.
    • buttons

      public DialogueFactory.Builder buttons(Iterable<DialogueButton> buttons)
      Adds buttons for the GUI.
      Parameters:
      buttons - The buttons to add.
      Returns:
      This builder.
    • sendTo

      public void sendTo(net.minecraft.server.level.ServerPlayer... players)
      Opens the GUI for the specified players.
      Parameters:
      players - The players to open the GUI for.
    • createSettings

      public InputSettings createSettings()
      Creates an instance of the InputSettings class based on the settings specified in this builder.
      Returns:
      An instance of the InputSettings class.