Search in sources :

Example 71 with AttributeModifier

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

the class ItemDagger method getAttributeModifiers.

/**
 * Gets a map of item attribute modifiers, used by ItemSword to increase hit damage.
 */
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
    Multimap<String, AttributeModifier> multimap = super.getAttributeModifiers(slot, stack);
    if (slot == EntityEquipmentSlot.MAINHAND) {
        multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", (double) this.toolMaterial.getAttackDamage() + 2.5D, 0));
        multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", 0D, 0));
    }
    return multimap;
}
Also used : AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier)

Example 72 with AttributeModifier

use of net.minecraft.entity.ai.attributes.AttributeModifier in project Cavern2 by kegare.

the class ItemSwordCavenic method getAttributeModifiers.

@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
    Multimap<String, AttributeModifier> map = super.getAttributeModifiers(slot, stack);
    if (slot == EntityEquipmentSlot.MAINHAND) {
        map.removeAll(SharedMonsterAttributes.ATTACK_SPEED.getName());
        map.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -1.0000000953674316D, 0));
    }
    return map;
}
Also used : AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier)

Example 73 with AttributeModifier

use of net.minecraft.entity.ai.attributes.AttributeModifier in project ClaySoldiersMod by SanAndreasP.

the class UpgradeShearBlade method onAttackSuccess.

@Override
public void onAttackSuccess(ISoldier<?> soldier, ISoldierUpgradeInst upgradeInst, Entity target) {
    NBTTagCompound nbt = upgradeInst.getNbtData();
    if (nbt.getBoolean("firstHit")) {
        this.resetFirstHit(soldier, upgradeInst);
        ClaySoldiersMod.proxy.spawnParticle(EnumParticle.CRITICAL, target.world.provider.getDimension(), target.posX, target.posY + target.getEyeHeight(), target.posZ);
    }
    byte uses = (byte) (nbt.getByte("uses") - 1);
    if (uses < 1) {
        AttributeModifier modifier = upgradeInst.getUpgradeType() == EnumUpgradeType.MAIN_HAND ? BLADE_DMG_1 : BLADE_DMG_2;
        soldier.getEntity().getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).removeModifier(modifier);
        soldier.destroyUpgrade(upgradeInst.getUpgrade(), upgradeInst.getUpgradeType(), false);
        soldier.getEntity().playSound(SoundEvents.ENTITY_ITEM_BREAK, 0.8F, 0.8F + MiscUtils.RNG.randomFloat() * 0.4F);
    } else {
        nbt.setByte("uses", uses);
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier)

Example 74 with AttributeModifier

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

the class ItemATHammer 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) 9.0F + this.getAttackDamage(stack), 0));
        multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool modifier", (double) -3.5F, 0));
    }
    return multimap;
}
Also used : AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier)

Example 75 with AttributeModifier

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

the class ItemATHoe 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", 0.0F, 0));
        multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", (double) -(3.0 - this.getHarvestLevel(stack)), 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