As title.
There is a 1 gt delay between applying attribute modifiers to items and the attribute modifiers actually taking effect.
Modifiers applied by command /attribute are not affected.
The attachment is a datapack including some functions to verify the bug.
Steps to reproduce
install the datapack and reload
run
/function test:direct/modify_attributeto see values queried by/attributewith modifiers applied by/attributerun
/function test:item/modify_attributeto see values queried by/attributewith modifiers applied on item by/itemand item modifier file
Note
all selectors in the datapack are
@pin order to simplify the codemodifier is automatically removed after 2 gt
Can confirm.
(In fact it is only one tick delay because it is already applied before the second schedule.)
This bug is because the modifiers on an item is detected and applied only when the player entity is ticked (
detectEquipmentUpdates()inLivingEntity.tick()). So there's a delay.To fix this bug, update modifiers immediately when an item slot is changed, rather than when entity ticking.