use of net.minecraft.entity.attribute.EntityAttribute 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.EntityAttribute 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.EntityAttribute in project artifality by PinkGoosik.
the class WrathElement 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);
}
use of net.minecraft.entity.attribute.EntityAttribute in project artifality by PinkGoosik.
the class IncrementalElement 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);
}
use of net.minecraft.entity.attribute.EntityAttribute in project Biome-Makeover by Lemonszz.
the class BMEnchantment method removeAttributes.
public void removeAttributes(LivingEntity entity, EquipmentSlot slot) {
for (Map.Entry<EntityAttribute, EntityAttributeModifier> attributeEntry : this.attributeModifiers.entrySet()) {
UUID slotID = MathUtils.uuidFromString(slot.toString());
EntityAttributeInstance entityAttributeInstance = entity.getAttributes().getCustomInstance(attributeEntry.getKey());
if (entityAttributeInstance != null) {
EntityAttributeModifier mod = entityAttributeInstance.getModifier(slotID);
if (mod != null)
entityAttributeInstance.removeModifier(mod);
else
System.out.println("ERROR REMOVING MODIFIER: DOESNT EXIST??? : " + entityAttributeInstance.getAttribute().getTranslationKey());
}
}
}
Aggregations