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

/data modify: appending or prepending list to another list fails with error message "The specified properties already have these values"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • Minecraft 19w08b, Minecraft 19w09a, Minecraft 19w11a, Minecraft 19w11b
    • None
    • Unconfirmed
    • Commands

      It's not possible to append the contents of a list to another list with /data modify [...] append or prepend. What I'd expect is for them to insert the values in the target list after or before its contents, respectively; however, any attempt to do so fails with the error message Nothing changed, the specified properties already have these values.

      Steps to reproduce

      1. /summon armor_stand ~ ~ ~ {Tags:["test1","test2"]}
      2. /summon armor_stand ~ ~ ~ {Tags:["test3","test4"]}
      3. /data modify entity @e[tag=test1,limit=1] Tags append from entity @e[tag=test3,limit=1] Tags

      P.S.: I don't know if this usage of the command is intended/possible, but either way, this message is misleading, as it incorrectly states that the contents of the target list are already as such. This is clearly not the case as, as it can be seen from the commands above, one entity has the tags test1 and test2, while the other one has test3 and test4.


      EDIT: Turns out what I'm trying to achieve is possible by adding a pair of square brackets to the end of the source parameter (like the following: Tags[]). This probably tells the game to "unpack" the list, grabbing [the list's elements] rather than [the list] itself. The game is trying to add a list to the Tags field, but since it cannot contain a list, it's probably just being stripped, resulting in the same list we began with and causing the error message above.

      Nevertheless, even though there's a cause for this error message, it's still misleading. Since the goal of the new command engine is to be as intuitive as possible, I suggest that either 1) the game accepts a list as a source, unpacking its elements and adding them to the target list, or 2) the error message is changed to something less generic/more descriptive, such as Expected sequence of elements, got: ["test3","test4"]. Something similar is already done if, while using append/prepend, you don't provide a list as the source. For example, if you run:

      /data modify entity @e[tag=test1,limit=1] Tags[] append value test5

      you'll get Expected list, got: "test2", since test2 is not a list it can append test5 to.

      Neither of these solutions should cause a problem, as there's not a single instance in the NBT specification where a list contains other lists (at least not that I know of).

            Unassigned Unassigned
            Bentroen Bentroen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: