Attributes won't work in main hand if they were in offhand
The bug
An attribute on an item will not be effective if switched from offhand to main hand.
How to reproduce
- Use the following command:
/give @s stone{AttributeModifiers:[{AttributeName:generic.movement_speed,Amount:1,UUID:[I;1,2,3,4]}]} - Take the item in hand
- Press the F key once to switch the item to secondary hand
- Press the F key again to switch the item back to main hand
→
The attribute change is no longer applied
Examples
- Example 1:
- Example 2: Attributes won't work in main hand if they were in offhand.mp4

Additional note
This allows a player to chose if he or if he doesn't want he attribute being applied.
i.e. It's not possible to create strong weapons with an attribute counterpart (-health or -speed for example) which is pretty bad for mapmakers.
2016-02-14, 05:17 PM
2024-05-27, 05:40 PM
2024-05-27, 05:40 PM
27
7
attribute, item, main-hand, off-hand
Minecraft 16w06a - 24w20a
Minecraft 16w06a, Minecraft 1.9 Pre-Release 1, Minecraft 1.9 Pre-Release 2, Minecraft 1.10.2, Minecraft 16w33a, Minecraft 16w35a, Minecraft 16w36a, Minecraft 16w40a, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 1.12, Minecraft 1.12.1, Minecraft 1.13.1, Minecraft 1.14.3, 1.15.2, 1.16 Release Candidate 1, 1.16, 1.16.1, 20w28a, 20w30a, 1.16.2 Pre-release 1, 1.16.2 Release Candidate 1, 1.16.2 Release Candidate 2, 1.16.2, 1.16.3 Release Candidate 1, 1.16.3, 1.16.4 Pre-release 1, 1.16.4 Pre-release 2, 1.16.4 Release Candidate 1, 1.16.4, 20w46a, 20w48a, 20w51a, 21w03a, 1.16.5, 21w05a, 21w05b, 21w06a, 21w07a, 21w11a, 1.17 Pre-release 2, 1.17, 1.18.1, 1.18.2, 22w15a, 1.19, 1.19.2, 1.19.4, 1.20 Pre-release 7, 1.20.3 Release Candidate 1, 1.20.4, 24w10a, 1.20.5, 1.20.6, 24w20a