-
Bug
-
Resolution: Fixed
-
24w21b
-
None
-
Community Consensus
-
Commands
-
Important
-
Platform
Summary
set_attributes item modifier can add two attribute modifiers for the same attribute with the same ID to an item stack. Although an item stack with two equal modifiers can be created using other means, the item modifier previously did not add two modifiers with the same UUID twice, and this bug is likely due to a coding error.
Steps to Reproduce
- Add the attached data pack.
- Get a carved pumpkin.
- Run the following command:
/item modify entity @s hotbar.0 test:cursed_attribute
- Check the tooltip of the item in the inventory.
Expected Result
Only "+2 Armor" is displayed.
Actual Result
"+1 Armor" and "+2 Armor" are both displayed.
Code analysis
In AttributeModifiersComponent.Entry, an Identifier is compared against EntityAttributeModifier, which always returns false. This makes the check inside AttributeModifiersComponent#with, which should skip duplicate additions, useless.