mojira.dev
MC-298010

Dialog templates interfere with macros

The new dialog feature’s templates (such as minecraft:command_template) using macros breaks macro instantiation of dialog command.

To set this up, create a datapack test with a function test containing:

$dialog show @a { \
  "type":"minecraft:simple_input_form", \
  "title": "Test", \
  "inputs":[{ \
    "type": "minecraft:text", \
    "label": "Text", \
    "key": "text" \
  }], \
  "action": { \
    "label": "Submit", \
    "id": "submit", \
    "on_submit": { \
      "type":"minecraft:command_template", \
      "template":"$(cmd) @a \"$(text)\"" \
    } \
  } \
}


Note how cmd is not specified in the dialog, but text is. If you run the following:

data merge storage scratch {cmd:"tellraw"}
function test:test with storage scratch

You’ll get the output:

Failed to instantiate function test:test: Missing argument text to function test:test


This was just an example, I actually want to push state into the dialogs with macros using the initial fields. This currently seems to be impossible. I would suggest using a separate templating syntax, like {{text}} for dialog input.

Linked issues

Comments 2

While drafting this, another identical issue was posted: MC-298009.

In that case, I will resolve this as a duplicate of MC-298009

Gremlite

(Unassigned)

Unconfirmed

(Unassigned)

25w20a

Retrieved