Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Dialog

From SAS Gaming Wiki

Template:Exclusive Dialogs are simple Template:Ws that can display information and receive Minecraft:player input.

Usage

Dialogs can be displayed to Minecraft:players using the Template:Cmd command by server Minecraft:operators while in gameplay. Additionally, they can be displayed through a Template:Cd action in a Minecraft:text component or another dialog (see Template:Slink). They can also be configured for the Minecraft:pause menu and when pressing the Template:Control hotkey (see Template:Slink).

Dialogs enable various forms of interaction with the game, including:

  • Sending messages or information using Minecraft:text components, including rich text formatting and clickable links (excluding type nbt, score and selector<ref name="no-component-resolution">Template:Bug</ref>);
  • Receiving player input through input control fields such as textbox, toggle, slider, and option selection;
  • Executing Minecraft:commands via action buttons (privileged commands can only be executed by server operators); and
  • Navigating between multiple dialogs using nested structures.

Dialogs mostly comprise of these three elements, however their exact contents are dependent of the type:

  • Header, which contains the title and warning button;
  • Body elements, which may be labels, inputs, buttons, and submit actions (scrollable if needed); and
  • Optional footer, which may contain confirmation buttons and submit actions.

When a dialog window opens, player Minecraft:controls are disabled temporarily until the user exits the window through an exit action button, the Template:W (Template:Key), or the warning button next to the dialog's title (which returns the user back to the Minecraft:title screen). In Minecraft:singleplayer, a dialog can be configured to pause the game, in which case the game also Minecraft:autosaves.

Definition

Dialog can be defined in Minecraft:data packs, as part of the directory structure below.

Template:Data pack directory

Dialog formatTemplate:Anchor

Dialogs have different structure depending on their type, which is specified by Template:Nbt tag. The structure below applies to every dialog types:

  • *: If parent field is written, this field is required.
  • Template:Nbt The root tag.
    • Template:Nbt*: One of dialog types from the minecraft:dialog_type registry:
      • minecraft:notice
      • minecraft:confirmation
      • minecraft:multi_action
      • minecraft:server_links
      • minecraft:dialog_list<section begin="json format common" />
    • Template:NbtTemplate:NbtTemplate:Nbt*: Screen title, text component. Should be always visible on screen, no matter the specific type.
    • Template:NbtTemplate:NbtTemplate:Nbt: Name to be used for a button leading to this dialog (for example, on the Minecraft:pause menu), optional text component. If not present, title will be used instead.
    • Template:NbtTemplate:Nbt: Optional list of body elements or a single body element. See Template:Slink.
    • Template:Nbt: Optional list of input controls. See Template:Slink.
    • Template:Nbt: Can dialog be dismissed with Escape key. Defaults to true.
    • Template:Nbt: If the dialog screen should pause the game in single-player mode. Defaults to true.
    • Template:Nbt: An additional operation performed on the dialog after click or submit actions. Defaults to close. Can be one of the following:
      • close: Closes the dialog and returns to the previous non-dialog screen (if any).
      • none: Does nothing, i.e. keeps the current dialog screen open (only available if Template:Nbt is false to avoid locking the game in single-player mode).
      • wait_for_response: Replace the current dialog with a "Waiting for Response" screen.<section end="json format common" />
    • Other fields depending on Template:Nbt, see below.

notice

File:Notice dialog.png
A Template:Cd dialog type.

A dialog screen with a single action button in footer, specified by Template:Nbt. By default, the exit action (which returns the player back to gameplay) is the same Template:Nbt button.

confirmation

File:Confirmation dialog.png
A Template:Cd dialog type.

A dialog screen with two action buttons in footer, specified by Template:Nbt and Template:Nbt. By default, the exit action is Template:Nbt button.

multi_action

File:Multi action dialog.png
A Template:Cd dialog type.

A dialog screen with a scrollable list of action buttons arranged in columns. If Template:Nbt is present, a button for it will appear in the footer, otherwise the footer is not present. Template:Nbt is also used for the Escape action.

server_links

File:Server links dialog.png
An empty Template:Cd dialog type.

A dialog screen with scrollable list of Minecraft:server links, arranged in columns. If Template:Nbt is present, a button for it will appear in the footer, otherwise the footer is not present. Template:Nbt is also used for the Escape action.

dialog_list

File:Dialog list dialog.png
A Template:Cd type dialog with all dialog types.

A dialog screen with scrollable list of buttons leading directly to other dialogs, arranged in columns. Titles of those buttons will be taken from Template:Nbt fields of targeted dialogs. If Template:Nbt is present, a button for it will appear in the footer, otherwise the footer is not present. Template:Nbt is also used for the Escape action.

Body formatTemplate:Anchor

All dialogs have a list of body elements describing contents between title and actions or inputs.

plain_message

A multiline label.

item

An item with optional description. It appears like it is in the Minecraft:inventory slot when the mouse hovers over the item. The size does not scale even if width and height are set to other values than the default. If the description is present, then it appears next to the right side of the item.

Input control formatTemplate:Anchor

File:Input controls dialog.png
All input controls on a dialog.

Input controls are used to receive certain information from the players. These information can be used with the associated Template:Nbt tag, for example, when an action button is clicked, the Template:Nbt can be used to reference information stored on that input control, either when running a command with Minecraft:macro substitution, or a custom NBT tag sent to the Minecraft:server (see Template:Slink).

All input control types have a label field.

  • Template:Nbt: The input control
    • Template:Nbt*: One of dialog types from the minecraft:input_control_type registry:
      • minecraft:text
      • minecraft:boolean
      • minecraft:single_option
      • minecraft:number_range

<section begin="input control common" />**Template:Nbt*: String identifier of value used when submitting data, must be a valid template argument (letters, digits and _).

text

A basic, single line, text input.

Output values:

  • As template substitution: contents with special characters escaped using escape sequences to fit into an Minecraft:SNBT string.
  • As tag: a string tag with contents without modification.

boolean

A checkbox.

Output values:

  • As template substitution: Template:Nbt when checked, Template:Nbt when unchecked.
  • As tag: 1b when checked, 0b when unchecked.

single_option

A preset option selection.

number_range

A number slider.

Output values:

  • As template substitution: text representation of current value.
    • Whole numbers will be sent without decimal point.
  • As tag: a float tag with current value.
  • Template:Nbt: The input control
    • Template:Nbt*: minecraft:number_range
    • Template:Nbt inherit/dialog/input control
    • Template:Nbt: A translation key to be used for building label (first argument is contents of label field, second argument is current value). Defaults to options.generic_value.
    • Template:Nbt: Value between 1 and 1024 — The width of the input. Defaults to 200.
    • Template:Nbt*: The minimum number of the slider.
    • Template:Nbt*: The maximum number of the slider.
    • Template:Nbt: Step size (If present, only values of <math>initial + <any integer> * step</math> will be allowed. If absent, any value from the range is allowed).
    • Template:Nbt: The initial increment value of the slider. Defaults to the middle of the range.

Action formatTemplate:Anchor

Static action types

Static actions are actions that don't depend on the value of an input field. They are identical to text component events (except for open_file). They use the same format but with the action tag replaced with type.

For example, when using show_dialog, entry for action button will look like: <syntaxhighlight lang="json"> {

   "label": "Show dialog label",
   "action": {
       "type": "show_dialog",
       "dialog": "custom:my_dialog"
   }

} </syntaxhighlight> {{#lst:Text component format|click_events}}

Dynamic action types

Can be used in conjunction with input controls.

dynamic/run_command

This action will build a run_command event using a provided macro template (example: /say $(message) if you have a text input with an ID message)

dynamic/custom

This method will build a minecraft:custom event using all input values.

All input contents will be sent together inside a Template:Nbt compound tag, with tag value of each input put under id from key field of that input.

Additional static fields can be added to payload.

Dialog tag

Template:Main A Minecraft:data pack can apply one or more dialogs to the Minecraft:pause screen and the Template:Control hotkey using the Template:Tag link and Template:Tag link tags. If multiple dialogs are applied to the same method, the built-in minecraft:custom_options or minecraft:quick_actions dialog is shown instead which by default feature a list of all dialogs in the respective tags, using the Template:Nbt tag in the dialogs.

History

Template:HistoryTable

References

Template:Reflist

Navigation

Template:Navbox Java Edition technical

Minecraft:de:Dialogdefinition Minecraft:ja:ダイアログ Minecraft:pt:Diálogo Minecraft:ru:Диалог Minecraft:zh:对话框定义格式