getDynamicModifiers

Multimap<EntityAttribute, EntityAttributeModifiergetDynamicModifiers(EquipmentSlot slot, ItemStack stack, @Nullable() LivingEntity user)

Add modifiers for any net.minecraft.entity.attribute.EntityAttributes your item should give when equipped, based on the stack.

Appends to either attribute modifier NBT or the result from getAttributeModifiers.The attributes returned from this method will only be applied to an entity when the ItemStack providing the attributes is modified, or the player re-selects the stack in their hotbar.If your attribute relies on data from outside the stack, such as the user's age, you will need to modify the stack in some way to re-assign attributes to the entity.A fix for this may be provided in the future.

Return

The dynamic modifiers to add on top of other modifiers on this stack. If none, return EMPTY.

Parameters

slot

The equipment slot this item is equipped in.

stack

The stack that's equipped.

user

The current user of the tool, if available.

Sources

jvm source
Link copied to clipboard