Search in sources :

Example 6 with EntityAttribute

use of net.minecraft.entity.attribute.EntityAttribute in project artifality by PinkGoosik.

the class LunarElement method onInit.

@Override
public void onInit(LivingEntity entity, World world) {
    Multimap<EntityAttribute, EntityAttributeModifier> attributes;
    ImmutableMultimap.Builder<EntityAttribute, EntityAttributeModifier> builder = ImmutableMultimap.builder();
    builder.put(EntityAttributes.GENERIC_MAX_HEALTH, new EntityAttributeModifier("Element modifier", 15, EntityAttributeModifier.Operation.ADDITION));
    attributes = builder.build();
    entity.getAttributes().addTemporaryModifiers(attributes);
    entity.heal(15);
}
Also used : EntityAttribute(net.minecraft.entity.attribute.EntityAttribute) ImmutableMultimap(com.google.common.collect.ImmutableMultimap) EntityAttributeModifier(net.minecraft.entity.attribute.EntityAttributeModifier)

Example 7 with EntityAttribute

use of net.minecraft.entity.attribute.EntityAttribute in project artifality by PinkGoosik.

the class LifeElement method onInit.

@Override
public void onInit(LivingEntity entity, World world) {
    Multimap<EntityAttribute, EntityAttributeModifier> attributes;
    ImmutableMultimap.Builder<EntityAttribute, EntityAttributeModifier> builder = ImmutableMultimap.builder();
    builder.put(EntityAttributes.GENERIC_MAX_HEALTH, new EntityAttributeModifier("Element modifier", 30, EntityAttributeModifier.Operation.ADDITION));
    attributes = builder.build();
    entity.getAttributes().addTemporaryModifiers(attributes);
    entity.heal(30);
}
Also used : EntityAttribute(net.minecraft.entity.attribute.EntityAttribute) ImmutableMultimap(com.google.common.collect.ImmutableMultimap) EntityAttributeModifier(net.minecraft.entity.attribute.EntityAttributeModifier)

Aggregations

EntityAttribute (net.minecraft.entity.attribute.EntityAttribute)7 EntityAttributeModifier (net.minecraft.entity.attribute.EntityAttributeModifier)7 ImmutableMultimap (com.google.common.collect.ImmutableMultimap)4 Map (java.util.Map)2 UUID (java.util.UUID)2 EntityAttributeInstance (net.minecraft.entity.attribute.EntityAttributeInstance)2