Mojira Archive
MC-269060

Item modifier can't copy to other components from storage

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.

Invalid

god_of_sound

2024-03-03, 10:12 AM

2024-07-21, 12:56 AM

2024-03-08, 08:08 AM

2

2

Community Consensus

Data Packs

components, item, modifiers

24w09a, 24w10a

-