Removing the default attribute modifier component from armor with the "!"prefix in a give command or loot table, does not remove the attribute modifiers that are on armor by default.
To reproduce, run the command:
/give @s minecraft:iron_chestplate[!minecraft:attribute_modifiers]
This will give a player an iron chestplate that still says +6 armor, when the expected behavior is that it gives no armor.
Linked issues
is duplicated by 2
relates to 1
Comments 3
Can confirm in both 1.21-pre1 and also 1.20.6 (in 1.20.6, you can still give yourself an item with removed components by summoning an item entity).
Related note: it also doesn't work if you define attribute_modifiers as an empty array. For example
/give @s iron_chestplate[attribute_modifiers=[]]
This command still returns a chestplate with armor modifiers. In previous versions (1.20.4 and below), running an equivalent command would successfully remove all modifiers. Now, to get armor without any modifiers, you have to specifically define a modifier that does nothing (like adding 0 to your armor).
Technically speaking, the armor points given by armor is not part of the attribute modifiers component, it's part of the item definition in the code. Normally I would say that this issue is probably intended for this reason, but Gegy has self-assigned this issue so it's probably being fixed.