use of net.minecraft.entity.ai.attributes.AttributeModifier in project BloodMagic by WayofTime.
the class LivingArmourUpgradeMeleeDecrease method getAttributeModifiers.
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers() {
Multimap<String, AttributeModifier> modifierMap = HashMultimap.create();
String name = getUniqueIdentifier() + "-DamageModifier1";
modifierMap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(UUID.nameUUIDFromBytes(StringUtils.getBytesUtf8(name)), "DamageModifier1", meleeDamage[this.level], 1));
return modifierMap;
}
use of net.minecraft.entity.ai.attributes.AttributeModifier in project Minechem by iopleke.
the class PolytoolItem method getAttributeModifiers.
@Override
public Multimap getAttributeModifiers(ItemStack stack) {
Multimap multimap = HashMultimap.create();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", getSwordStr(stack), 0));
return multimap;
}
use of net.minecraft.entity.ai.attributes.AttributeModifier 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);
}
}
}
use of net.minecraft.entity.ai.attributes.AttributeModifier in project ArsMagica2 by Mithion.
the class BuffStatModifiers method applyOrRemoveScalingModifiersForBuff.
private void applyOrRemoveScalingModifiersForBuff(EntityLivingBase entity, int potionID, IAttribute attribute, AttributeModifier... modifiers) {
IAttributeInstance inst = entity.getEntityAttribute(attribute);
if (inst == null) {
return;
}
AttributeModifier currentModifier = inst.getModifier(modifiers[0].getID());
if (entity.isPotionActive(potionID)) {
int magnitude = entity.getActivePotionEffect(Potion.potionTypes[potionID]).getAmplifier();
AttributeModifier modifier = modifiers[Math.min(magnitude, modifiers.length - 1)];
if (currentModifier != modifier) {
if (currentModifier != null) {
inst.removeModifier(currentModifier);
}
inst.applyModifier(modifier);
}
} else {
if (currentModifier != null) {
inst.removeModifier(currentModifier);
}
}
}
use of net.minecraft.entity.ai.attributes.AttributeModifier in project ArsMagica2 by Mithion.
the class BuffStatModifiers method clearAllModifiers.
private void clearAllModifiers(EntityLivingBase entity, KeyValuePair<IAttribute, AttributeModifier>... modifiers) {
for (KeyValuePair<IAttribute, AttributeModifier> entry : modifiers) {
IAttributeInstance inst = entity.getEntityAttribute(entry.getKey());
if (inst == null)
continue;
AttributeModifier currentModifier = inst.getModifier(entry.getValue().getID());
if (currentModifier == entry.getValue()) {
inst.removeModifier(currentModifier);
}
}
}
Aggregations