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.
Linked issues
Attachments
Comments 3
Thank you for your report!
We're tracking this issue in MC-269060, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
-- I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.
Please attach a datapack, video and steps to reproduce this issue.