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

Item modifier can't copy to other components from storage

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • 24w09a, 24w10a
    • Community Consensus
    • Data Packs

      When using the item_modifiers in a datapack, you can't copy nbt from storage to other components than custom_data.

      Before nbt was copied to the tag of the item. Now it is only copied to custom_data because copy_nbt does not exist anymore

      storage "test": {CMD: 2}

      item_modifiers/set_cmd.json :

      Before Now
      Item:
      /data get @s SelectedItem =
      {... tag: {CustomModelData: 1}} 
      Item:
      /data get @s SelectedItem.components =
      {... "minecraft:custom_model_data": 1} 
      [
       {
        "function": "minecraft:copy_nbt",
        "source":{
         "type": "minecraft:storage",
         "source": "minecraft:test"
        },
        "ops": [
         {
          "source": "CMD",
          "target": "CustomModelData",
          "op": "replace"
         }
        ]
       }
      ]  

      Result:
      /data get @s SelectedItem =

      {... tag: {CustomModelData: 2}}  
      [
       {
        "function": "minecraft:copy_custom_data",
        "source":{
         "type": "minecraft:storage",
         "source": "minecraft:test"
        },
        "ops": [
         {
          "source": "CMD",
          "target": "custom_model_data",
          "op": "replace"
         }
        ]
       }
      ]  

      Result:
      /data get @s SelectedItem.components =

      {... "minecraft:custom_model_data": 1, "minecraft:custom_data": {custom_model_data: 2}} 

       

      Linked below are the 2 datapacks each corresponding with their mc version.
      I created some click events with tellraw to easily see the process (also attached the images with the code & results)
      In the datapack I set the target to "components.custom_model_data" but its still the same result.

        1. code_1.20.4.png
          121 kB
          god_of_sound
        2. code_24w09a.png
          131 kB
          god_of_sound
        3. screenshot-steps-1.20.4.png
          73 kB
          god_of_sound
        4. screenshot-steps-24w09a.png
          86 kB
          god_of_sound

            Unassigned Unassigned
            god_of_sound god_of_sound
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: