Class DialogueFactory.Builder
java.lang.Object
com.pixelmonmod.pixelmon.api.dialogue.DialogueFactory.Builder
- Enclosing class:
- DialogueFactory
A Builder for creating a DialogueInput GUI.
The GUI will be sent to the player when
The following fields are required:
The GUI will be sent to the player when
sendTo(ServerPlayer...)
is called.
The following fields are required:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionacceptedPatterns
(Iterable<Pattern> patterns) Sets the GUI's accepted patterns.acceptedPatterns
(String... patterns) Sets the GUI's accepted patterns.acceptedPatterns
(Pattern... patterns) Sets the GUI's accepted patterns.buttons
(DialogueButton... buttons) Adds buttons for the GUI.buttons
(Iterable<DialogueButton> buttons) Adds buttons for the GUI.Sets the GUI to close when the player presses the escape key.Creates an instance of theInputSettings
class based on the settings specified in this builder.defaultText
(String defaultText) Sets the default text that shows up in the input text box.defaultText
(net.minecraft.network.chat.Component defaultText) Sets the default text that shows up in the input text box.description
(String description) Sets the description of the GUI.description
(net.minecraft.network.chat.Component description) Sets the description of the GUI.Sets the GUI to not close when the player presses the escape key.Hides the input text box.hideUI()
Hides the player's UI when the GUI is open.keepUI()
Keeps the player's UI visible when the GUI is open.maxInputLength
(int maxInputLength) Sets the max length of the input text box.onClose
(Consumer<DialogueInputEvent.ClosedScreen> closeConsumer) Sets the consumer to be called when the player closes the GUI.Adds an accepted pattern that restricts the input text box to only accept alphabetical characters and spaces as input characters.Adds an accepted pattern that restricts the input text box to only accept alphabetical characters as input characters.Adds an accepted pattern that restricts the input text box to only accept alphabetical characters, spaces, and numbers as input characters.Adds an accepted pattern that restricts the input text box to only accept integers as input characters.void
sendTo
(net.minecraft.server.level.ServerPlayer... players) Opens the GUI for the specified players.setCloseOnEscape
(boolean closeOnEscape) Sets the GUI's close on escape setting.setHideUI
(boolean hideUI) Sets the GUI's hide UI setting.setShowInput
(boolean showInput) Sets if the input text box should be visible.Sets the input text box to be visible.Sets the title of the GUI.title
(net.minecraft.network.chat.Component title) Sets the title of the GUI.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
title
Sets the title of the GUI.
This converts the string to aComponent
usingComponent.literal(String)
.
This is a required field.- Parameters:
title
- The title of the GUI.- Returns:
- This builder.
-
title
Sets the title of the GUI.
This is a required field.- Parameters:
title
- The title of the GUI.- Returns:
- This builder.
-
description
Sets the description of the GUI.
This converts the string to aComponent
usingComponent.literal(String)
.
This is a required field.- Parameters:
description
- The description of the GUI.- Returns:
- This builder.
-
description
Sets the description of the GUI.
This is a required field.- Parameters:
description
- The description of the GUI.- Returns:
- This builder.
-
defaultText
Sets the default text that shows up in the input text box.
This converts the string to aComponent
usingComponent.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
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
Sets the max length of the input text box.
This is an optional field.
Default value: 50- Parameters:
maxInputLength
-- Returns:
-
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
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
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
Hides the player's UI when the GUI is open.
This is an optional field.
Default value: false- Returns:
- This 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
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
Sets the input text box to be visible.
This is an optional field.
Default value: true- Returns:
- This builder.
-
hideInput
Hides the input text box.
This is an optional field.
Default value: true- Returns:
- This builder.
-
setShowInput
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
Adds an accepted pattern that restricts the input text box to only accept integers as input characters.- Returns:
- This builder.
-
onlyAlphabeticalInput
Adds an accepted pattern that restricts the input text box to only accept alphabetical characters as input characters.- Returns:
- This 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
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
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
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
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
Adds buttons for the GUI.- Parameters:
buttons
- The buttons to add.- Returns:
- This builder.
-
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
Creates an instance of theInputSettings
class based on the settings specified in this builder.- Returns:
- An instance of the
InputSettings
class.
-