Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-277004

Commands which can create any kind of identifiers accept empty strings as identifiers

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Works As Intended
    • None
    • 1.21.1, 24w39a
    • None
    • Confirmed
    • (Unassigned)

      Commands like /attribute, /data merge storage, /scoreboard and others accept empty identifiers, which only work when the command is run from a command block and not through the chat (due to MC-65034).

      How to reproduce:

      1. Execute any of the following example commands through a command block (not in chat):
        /attribute @p generic.max_health modifier add  2 add_value

        /data merge storage  {TestTag:1b}

        /scoreboard objectives add  dummy

        (Note the double space where the identifier would usually go in each one of the above commands.)

      2. Notice that the command block actually succeeds, and that you can interact with the attribute modifier/data storage/scoreboard objective you created by using subsequent commands.

      Expected result:

      A command with an empty identifier specified would fail.

      Observed result:

      A command with an empty identifier succeeds and actually creates an empty identifier.

      Original description:

      What happens:

      The following command works when run in a command block (note that it doesn't work in chat due to MC-65034):

      /attribute @p generic.max_health modifier add  2 add_value

      (Note the extra space between 'add' and '2', which sets the identifier of the modifier to be an empty string)

      On a related note, this command works in both the chat and in a command block, and creates a modifier with the same ID

      /attribute @p generic.max_health modifier add minecraft: 2 add_value

      In either case, the modifier can be removed by running the following command

      /attribute @p generic.max_health modifier remove minecraft:

      But it cannot be removed using this command, even in a command block

      /attribute @p generic.max_health modifier remove 

      (Note the extra space after 'remove')

      What is expected:

      The attribute command should fail to run if no ID is provided, and an empty string should not count as a valid ID. Further, 'minecraft:' and 'example:' should also probably be invalid IDs, as they are only a namespace without an identifier name.

            Unassigned Unassigned
            42Richtofen42 42Richtofen42
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: