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

Data modify not working with Item.tag.Enchantments

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • 1.18.2
    • None
    • Unconfirmed
    • Creative

      Data modify not working with Item.tag.Enchantments

      What I expected to happen was...:

      I wish to add enchantments from a book to a bow (multiple enchantments from multiple books)

      By running the following:

      • tag @e[nbt=\\{Item:{id:"minecraft:bow"}}, limit=1] add test
      • data modify entity @e[tag=test, limit=1] Item.tag.Enchantments set from entity @e[nbt={Item:{tag: {StoredEnchantments: [ {lvl: 2s, id: "minecraft:punch"}

        ,{}]}}},limit=1] Item.tag.StoredEnchantments

      • data modify entity @e[tag=test, limit=1] Item.tag.Enchantments merge from entity @e[nbt={Item:{tag: {StoredEnchantments: [ {lvl: 1s, id: "minecraft:infinity"}

        ,{}]}}},limit=1] Item.tag.StoredEnchantments

      I EXPECT to get a bow with the enchantments from the first enchanted book AND the second, with all the enchantments. If the first book had and[Punch 2, Flame] the second book had [Power 5, Infinity] I EXPECT to get a bow with [Punch 2, Flame, Power 5, Infinity]

      What actually happened was...:

      By running the following:

      • tag @e[nbt=\\{Item:{id:"minecraft:bow"}}, limit=1] add test
      • data modify entity @e[tag=test, limit=1] Item.tag.Enchantments set from entity @e[nbt={Item:{tag: {StoredEnchantments: [ {lvl: 2s, id: "minecraft:punch"}

        ,{}]}}},limit=1] Item.tag.StoredEnchantments

      At This point I get a bow with the first books Enchantments, After this point the next command DOES NOT work as EXPECTED.

      • data modify entity @e[tag=test, limit=1] Item.tag.Enchantments merge from entity @e[nbt={Item:{tag: {StoredEnchantments: [ {lvl: 1s, id: "minecraft:infinity"}

        ,{}]}}},limit=1] Item.tag.StoredEnchantments

      This command when run in a command block gives the output of:

      • Expected list, got {id:"minecraaft:punch",lvl2s}

      and the bow does not get any of the enchants from the 2nd book.

      Inset, append, prepend and merge don't work, changing the Item.tag.Enchantments to Item.tag.Enchantments[] to specify the data type of list does not work either.

      Steps to Reproduce:
      1. Place down a Repeating Unconditional Always Active command block and past in the first command.

      • tag @e[nbt=\\{Item:{id:"minecraft:bow"}}, limit=1] add test

      2. Place down a Chain Conditional Always Active command block and past in the Second command, make sure the command blocks are linked into each other.

      • data modify entity @e[tag=test, limit=1] Item.tag.Enchantments set from entity @e[nbt={Item:{tag: {StoredEnchantments: [ {lvl: 2s, id: "minecraft:punch"}

        ,{}]}}},limit=1] Item.tag.StoredEnchantments

      3. Place down a Chain Conditional Always Active command block and past in the Third command, make sure the command blocks are linked into each other.

      • data modify entity @e[tag=test, limit=1] Item.tag.Enchantments merge from entity @e[nbt={Item:{tag: {StoredEnchantments: [ {lvl: 1s, id: "minecraft:infinity"}

        ,{}]}}},limit=1] Item.tag.StoredEnchantments

      4, Now give yourself a normal undamaged bow, a enchanted book with the following enchants (Power 5, Punch 2) and another enchanted book with the following enchants (Infinity, Flame) 

      5. Drop both enchanted books and the bow on the ground (preferably near each other)

      6. upone picking up both the books and the bow inspect the bow to see the enchants and view the error in the 3rd command block

        1. MC_Bug_Report_1.png
          MC_Bug_Report_1.png
          79 kB
        2. MC_Bug_Report_2.png
          MC_Bug_Report_2.png
          82 kB
        3. MC_Bug_Report_3.png
          MC_Bug_Report_3.png
          99 kB
        4. MC_Bug_Report_4.png
          MC_Bug_Report_4.png
          53 kB
        5. MC_Bug_Report_5.png
          MC_Bug_Report_5.png
          73 kB
        6. MC_Bug_Report_6.png
          MC_Bug_Report_6.png
          42 kB

            Unassigned Unassigned
            GingerNinger2962 GingerNinger2962
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: