With item_modifiers in datapacks you could use copy_nbt to copy nbt from storage to any tag in an item.
The replacement function copy_custom_data restricts this to only the ccustom_data component instead of any nbt on the item.
example 1.20.4:
You have a storage with data:
{CMD; 2}
You have an item with nbt:
{tag:{CustomModelData: 1}}
With an item modifier you could copy from storage to item, thereby setting the CustomModelData to 2 from CMD
Resulting the item with nbt:
{tag:{CustomModelData: 2}}
example 24w10a:
You have a storage with data:
{CMD; 2}
You have an item with nbt:
{components:{"minecraft:custom_model_data": 1}}
With an item modifier you try to copy from storage to item, you only set the custom_data component now
Resulting the item with nbt:
{components:{"minecraft:custom_model_data": 1, "minecraft:custom_data":{custom_model_data: 2}}}
Install the datapack to the correct version and click the text in order. Result is also shown in images. Image of code is also provided.
This is not a feature request, this was an existing feature that now is broken and breaks a lot of datapacks because no item nbt except custom_data can be modified this way! see MC-269060 for more specific information. I may have failed at explaining the real issue there.
- duplicates
-
MC-269060 Item modifier can't copy to other components from storage
- Resolved