use of net.minecraft.entity.ai.attributes.AttributeModifierManager in project Bookshelf by Darkhax-Minecraft.
the class EnchantmentAttribute method applyModifiers.
protected void applyModifiers(LivingEntity living, int level) {
final AttributeModifierManager attributeMap = living.getAttributes();
for (final Entry<Attribute, AttributeModifier> entry : this.getModifiers(level).entrySet()) {
final ModifiableAttributeInstance modifiable = attributeMap.getInstance(entry.getKey());
if (modifiable != null) {
final AttributeModifier effectModifier = entry.getValue();
modifiable.removeModifier(effectModifier);
modifiable.addPermanentModifier(effectModifier);
}
}
}
Aggregations