Search in sources :

Example 51 with AttributeModifier

use of net.minecraft.entity.ai.attributes.AttributeModifier in project Galacticraft by micdoodle8.

the class ItemSwordAsteroids method getItemAttributeModifiers.

@Override
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot) {
    Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot);
    if (equipmentSlot == EntityEquipmentSlot.MAINHAND) {
        multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", this.attackDamageD, 0));
        multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.8D, 0));
    }
    return multimap;
}
Also used : AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier)

Example 52 with AttributeModifier

use of net.minecraft.entity.ai.attributes.AttributeModifier in project Overloaded by CJ-MC-Mods.

the class ItemMultiChestplate method getItemAttributeModifiers.

@Override
@Nonnull
public Multimap<String, AttributeModifier> getItemAttributeModifiers(@Nullable EntityEquipmentSlot equipmentSlot) {
    Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
    if (equipmentSlot == this.armorType) {
        multimap.put(SharedMonsterAttributes.ARMOR.getName(), new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Armor modifier", 100, 0));
        multimap.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Max Health", 100, 0));
        multimap.put(SharedMonsterAttributes.ARMOR_TOUGHNESS.getName(), new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Armor toughness", 100, 0));
    }
    return multimap;
}
Also used : AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier) Nonnull(javax.annotation.Nonnull)

Example 53 with AttributeModifier

use of net.minecraft.entity.ai.attributes.AttributeModifier in project Skree by Skelril.

the class ICustomArmor method getItemAttributeModifiers.

default default Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot) {
    Multimap<String, AttributeModifier> multimap = __superGetItemAttributeModifiers(equipmentSlot);
    if (equipmentSlot == __getSlotType()) {
        multimap.put(SharedMonsterAttributes.ARMOR.getAttributeUnlocalizedName(), new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Armor modifier", (double) __getDamageReductionAmount(), 0));
        multimap.put(SharedMonsterAttributes.ARMOR_TOUGHNESS.getAttributeUnlocalizedName(), new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Armor toughness", (double) __getToughness(), 0));
    }
    return multimap;
}
Also used : AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier)

Example 54 with AttributeModifier

use of net.minecraft.entity.ai.attributes.AttributeModifier in project SilentGems by SilentChaos512.

the class EquipmentTooltips method getToughness.

private float getToughness(ItemStack stack, float defaultValue) {
    if (StackHelper.isEmpty(stack))
        return defaultValue;
    ItemArmor itemArmor = (ItemArmor) stack.getItem();
    EntityEquipmentSlot slot = itemArmor.armorType;
    UUID uuid = ItemArmor.ARMOR_MODIFIERS[slot.getIndex()];
    Multimap<String, AttributeModifier> multimap = stack.getAttributeModifiers(slot);
    for (Entry<String, AttributeModifier> entry : multimap.entries()) {
        String key = entry.getKey();
        AttributeModifier mod = entry.getValue();
        if (key.equals(SharedMonsterAttributes.ARMOR_TOUGHNESS.getName()) && mod.getID().equals(uuid)) {
            return (float) mod.getAmount();
        }
    }
    return 0f;
}
Also used : EntityEquipmentSlot(net.minecraft.inventory.EntityEquipmentSlot) ItemArmor(net.minecraft.item.ItemArmor) UUID(java.util.UUID) AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier)

Example 55 with AttributeModifier

use of net.minecraft.entity.ai.attributes.AttributeModifier in project SilentGems by SilentChaos512.

the class EquipmentTooltips method getProtection.

private float getProtection(ItemStack stack, float defaultValue) {
    if (StackHelper.isEmpty(stack))
        return defaultValue;
    ItemArmor itemArmor = (ItemArmor) stack.getItem();
    EntityEquipmentSlot slot = itemArmor.armorType;
    UUID uuid = ItemArmor.ARMOR_MODIFIERS[slot.getIndex()];
    Multimap<String, AttributeModifier> multimap = stack.getAttributeModifiers(slot);
    for (Entry<String, AttributeModifier> entry : multimap.entries()) {
        String key = entry.getKey();
        AttributeModifier mod = entry.getValue();
        if (key.equals(SharedMonsterAttributes.ARMOR.getName()) && mod.getID().equals(uuid)) {
            return (float) mod.getAmount();
        }
    }
    return 0f;
}
Also used : EntityEquipmentSlot(net.minecraft.inventory.EntityEquipmentSlot) ItemArmor(net.minecraft.item.ItemArmor) UUID(java.util.UUID) AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier)

Aggregations

AttributeModifier (net.minecraft.entity.ai.attributes.AttributeModifier)115 Nonnull (javax.annotation.Nonnull)19 Multimap (com.google.common.collect.Multimap)14 IAttributeInstance (net.minecraft.entity.ai.attributes.IAttributeInstance)11 UUID (java.util.UUID)9 ItemStack (net.minecraft.item.ItemStack)9 IAttribute (net.minecraft.entity.ai.attributes.IAttribute)8 HashMultimap (com.google.common.collect.HashMultimap)6 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)5 Map (java.util.Map)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 EntityEquipmentSlot (net.minecraft.inventory.EntityEquipmentSlot)4 Potion (net.minecraft.potion.Potion)4 PotionEffect (net.minecraft.potion.PotionEffect)4 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)4 Calendar (java.util.Calendar)3 EnergyUpgrade (crazypants.enderio.base.item.darksteel.upgrade.energy.EnergyUpgrade)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 Iterator (java.util.Iterator)2