use of net.minecraft.entity.attribute.EntityAttributeModifier in project EnvironmentZ by Globox1997.
the class ColdEffect method onApplied.
@Override
public void onApplied(LivingEntity entity, AttributeContainer attributes, int amplifier) {
EntityAttributeInstance entityAttributeInstance = attributes.getCustomInstance((EntityAttributes.GENERIC_MOVEMENT_SPEED));
if (entityAttributeInstance != null) {
EntityAttributeModifier entityAttributeModifier = new EntityAttributeModifier(this.getTranslationKey(), -0.15D, EntityAttributeModifier.Operation.MULTIPLY_TOTAL);
entityAttributeInstance.removeModifier(entityAttributeModifier);
entityAttributeInstance.addPersistentModifier(new EntityAttributeModifier(COLDNESS, this.getTranslationKey() + " " + entityAttributeModifier.getValue(), this.adjustModifierAmount(amplifier, entityAttributeModifier), entityAttributeModifier.getOperation()));
}
}
use of net.minecraft.entity.attribute.EntityAttributeModifier in project EnvironmentZ by Globox1997.
the class OverheatingEffect method onApplied.
@Override
public void onApplied(LivingEntity entity, AttributeContainer attributes, int amplifier) {
EntityAttributeInstance entityAttributeInstance = attributes.getCustomInstance((EntityAttributes.GENERIC_MOVEMENT_SPEED));
if (entityAttributeInstance != null) {
EntityAttributeModifier entityAttributeModifier = new EntityAttributeModifier(this.getTranslationKey(), -0.15D, EntityAttributeModifier.Operation.MULTIPLY_TOTAL);
entityAttributeInstance.removeModifier(entityAttributeModifier);
entityAttributeInstance.addPersistentModifier(new EntityAttributeModifier(DEHYDRATION, this.getTranslationKey() + " " + entityAttributeModifier.getValue(), this.adjustModifierAmount(0, entityAttributeModifier), entityAttributeModifier.getOperation()));
}
}
use of net.minecraft.entity.attribute.EntityAttributeModifier in project bewitchment by MoriyaShiine.
the class ZephyrHarnessItem method getModifiers.
@Override
public Multimap<EntityAttribute, EntityAttributeModifier> getModifiers(ItemStack stack, SlotReference slot, LivingEntity entity, UUID uuid) {
Multimap<EntityAttribute, EntityAttributeModifier> modifiers = super.getModifiers(stack, slot, entity, uuid);
modifiers.put(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, new EntityAttributeModifier(uuid, "Trinket modifier", 0.1, EntityAttributeModifier.Operation.ADDITION));
return modifiers;
}
use of net.minecraft.entity.attribute.EntityAttributeModifier in project Biome-Makeover by Lemonszz.
the class BMEnchantment method addAttributes.
public boolean addAttributes(LivingEntity entity, ItemStack stack, EquipmentSlot slot, int level) {
if (attributeModifiers.size() <= 0 || stack.isEmpty())
return false;
for (Map.Entry<EntityAttribute, EntityAttributeModifier> attributeEntry : this.attributeModifiers.entrySet()) {
UUID id = MathUtils.uuidFromString(slot.toString());
EntityAttributeInstance entityAttributeInstance = entity.getAttributes().getCustomInstance(attributeEntry.getKey());
if (entityAttributeInstance != null) {
EntityAttributeModifier mod = attributeEntry.getValue();
entityAttributeInstance.removeModifier(mod);
entityAttributeInstance.addTemporaryModifier(new EntityAttributeModifier(id, this.getTranslationKey() + " " + level, this.adjustModifierAmount(level, mod), mod.getOperation()));
}
}
return true;
}
use of net.minecraft.entity.attribute.EntityAttributeModifier in project Biome-Makeover by Lemonszz.
the class BMEnchantment method addAttributeModifier.
protected void addAttributeModifier(EntityAttribute attribute, String uuid, double amount, EntityAttributeModifier.Operation operation) {
EntityAttributeModifier entityAttributeModifier = new EntityAttributeModifier(UUID.fromString(uuid), this::getTranslationKey, amount, operation);
this.attributeModifiers.put(attribute, entityAttributeModifier);
}
Aggregations