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

set_attributes loot function doesn't accept an empty list

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w19a
    • 1.20.5 Pre-Release 1, 1.20.6, 24w18a
    • None
    • Confirmed
    • Commands
    • Normal
    • Platform

      Unlike all other loot functions that feature a list, set_attributes does not accept an empty modifiers list.

      This makes it more difficult to remove all attribute modifiers, as you can't simply use an empty list with replace enabled.

      How to reproduce:

      1. Hold an item
      2. Run the following command in chat
        /item modify entity @s weapon {function:set_attributes,modifiers:[],replace:1b}
      3. Notice the error message:
        Failed to parse structure: Not a list: {function:"set_attributes",modifiers:[],replace:1b}; List must have contents
        ...eplace:1b}<--[HERE]
      4. Try the same thing but with set_lore, or any other item function. In this case, mode is used since that is what set_lore uses.
        /item modify entity @s weapon {function:set_lore,lore:[],mode:replace_all}
      5. The command succeeds

            gegy1000 [Mojang] Gegy
            Ellivers Ellivers
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: