Let H be an item that gives an attribute A, when held in "any" slot (the main/offhand and armor slots).
Switching H from offhand to mainhand, or armor slots to main/offhand disables A (unexpected behaviour), and switching H from mainhand to offhand, or main/offhand to armor slots does not disable A (expected behaviour).
Item to reproduce:
{{/give @s minecraft:leather_helmet[minecraft:attribute_modifiers={modifiers:[
{name:"armor",amount:1.0d,type:"minecraft:generic.armor",uuid:[I; 0, 0, 0, 0],slot:"any",operation:"add_value"}
]}]}}
Thank you for your report!
We're actually already tracking this issue in MC-97087, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote or any additional information to the main ticket it would be appreciated.
Please be sure to use the search feature before creating a ticket to see if the issue has already been reported.
Quick Links:
📗 Tracker Guidelines | 🛠 Community Support | 📧 Mojang Support | 🔑 Account Support | ✍️ Feedback Discord