Interface ModifyItemAttributeModifiersCallback
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Stack-aware event for modifying the default attribute modifier component of an item. This should only be used
for items external to your mod, such as vanilla items or items from other mods.
This does not modify the actual attribute modifiers component, instead it adjusts the attributes that are used when applied to an entity or displaying the tooltip.
This is an experimental event, it may not work fully as expected or impact performance. Proceed with caution.
Example: This listener adds max health to all helmets
ModifyItemAttributeModifiersCallback.EVENT.register((stack, builder) -> {
if (stack.isIn(ItemTags.HEAD_ARMOR)) {
builder.add(EntityAttributes.MAX_HEALTH, MODIFIER, AttributeModifierSlot.HEAD);
}
});
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.fabricmc.fabric.api.event.Event<ModifyItemAttributeModifiersCallback> -
Method Summary
Modifier and TypeMethodDescriptionvoidmodifyAttributeModifiers(net.minecraft.item.ItemStack stack, net.minecraft.component.type.AttributeModifiersComponent.Builder builder)
-
Field Details
-
EVENT
-
-
Method Details
-
modifyAttributeModifiers
void modifyAttributeModifiers(net.minecraft.item.ItemStack stack, net.minecraft.component.type.AttributeModifiersComponent.Builder builder)
-