When switching over to the component system, the item modifier "set_nbt" function was replaced with "set_components" and "set_custom_data". However, some functionality was lost here because setting a component replaces the whole component instead of a specific field, and set_custom_data only works on the custom_data component.
This means that an item modifier cannot selectively modify only some fields of a non-custom component, so a lot of useful behavior is lost. Consider an item modifier that alters any spawn egg the player is holding to spawn the mob on the player's team. Before 1.20.5, you could use the modifier:
[
{
"function": "minecraft:set_nbt",
"tag": "{EntityTag:{Team:\"team_1\"}}",
"conditions": [
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"team": "team_1"
}
}
]
}
]
However, a modifier like this is impossible to make in 1.20.5+ because both the team and the mob id are fields in the entity_data component, so the team can't be changed without also changing the entity that is spawned.
In order to fully replace the "set_nbt" function, either the functionality of "set_components" has to be extended, or another function could be added that is similar to "set_custom_data", but for any component.
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.