Search in sources :

Example 76 with AttributeModifier

use of net.minecraft.entity.ai.attributes.AttributeModifier in project Adventurers-Toolbox by the-realest-stu.

the class ItemATPickaxe method getAttributeModifiers.

@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot equipmentSlot, ItemStack stack) {
    Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
    if (equipmentSlot == EntityEquipmentSlot.MAINHAND) {
        multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Tool modifier", (double) 1.0F + this.getAttackDamage(stack), 0));
        multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool modifier", (double) -2.8F, 0));
    }
    return multimap;
}
Also used : AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier)

Example 77 with AttributeModifier

use of net.minecraft.entity.ai.attributes.AttributeModifier in project Adventurers-Toolbox by the-realest-stu.

the class ItemATHandpick method getAttributeModifiers.

@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot equipmentSlot, ItemStack stack) {
    Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
    if (equipmentSlot == EntityEquipmentSlot.MAINHAND) {
        multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Tool modifier", (double) 0.5F + this.getAttackDamage(stack), 0));
        multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool modifier", (double) -2.6F, 0));
        multimap.put(EntityPlayer.REACH_DISTANCE.getName(), new AttributeModifier(BLOCK_REACH_MODIFIER, "Tool modifier", (double) -1F, 0));
    }
    return multimap;
}
Also used : AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier)

Example 78 with AttributeModifier

use of net.minecraft.entity.ai.attributes.AttributeModifier in project Adventurers-Toolbox by the-realest-stu.

the class ItemATMace method getAttributeModifiers.

@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot equipmentSlot, ItemStack stack) {
    Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
    if (equipmentSlot == EntityEquipmentSlot.MAINHAND) {
        multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", (double) 3.5F + this.getAttackDamage(stack), 0));
        multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.6D, 0));
    }
    return multimap;
}
Also used : AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier)

Example 79 with AttributeModifier

use of net.minecraft.entity.ai.attributes.AttributeModifier in project Adventurers-Toolbox by the-realest-stu.

the class SpecialToolAbilityHandler method onToolSwitch.

@SubscribeEvent
public void onToolSwitch(LivingEquipmentChangeEvent event) {
    if (event.getEntityLiving() instanceof EntityPlayer) {
        if (event.getSlot() == EntityEquipmentSlot.MAINHAND) {
            ItemStack from = event.getFrom();
            ItemStack to = event.getTo();
            if (isEnderPearlTool(from)) {
                Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
                multimap.put(EntityPlayer.REACH_DISTANCE.getName(), enderPearlReachModifier);
                event.getEntityLiving().getAttributeMap().removeAttributeModifiers(multimap);
            }
            if (isEnderPearlTool(to)) {
                Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
                multimap.put(EntityPlayer.REACH_DISTANCE.getName(), enderPearlReachModifier);
                event.getEntityLiving().getAttributeMap().applyAttributeModifiers(multimap);
            }
        }
    }
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 80 with AttributeModifier

use of net.minecraft.entity.ai.attributes.AttributeModifier in project Adventurers-Toolbox by the-realest-stu.

the class ItemRock method getAttributeModifiers.

@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot equipmentSlot, ItemStack stack) {
    Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot);
    if (equipmentSlot == EntityEquipmentSlot.MAINHAND) {
        multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", (double) 3.0F, 0));
        multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", (double) -3F, 0));
    }
    return multimap;
}
Also used : 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