Search in sources :

Example 61 with DamageSource

use of net.minecraft.util.DamageSource in project Wurst-MC-1.12 by Wurst-Imperium.

the class AutoArmorMod method getArmorValue.

private int getArmorValue(ItemArmor item, ItemStack stack) {
    int armorPoints = item.damageReduceAmount;
    int prtPoints = 0;
    int armorToughness = (int) WItem.getArmorToughness(item);
    int armorType = item.getArmorMaterial().getDamageReductionAmount(WEntityEquipmentSlot.LEGS);
    if (useEnchantments.isChecked()) {
        Enchantment protection = WEnchantments.PROTECTION;
        int prtLvl = WEnchantments.getEnchantmentLevel(protection, stack);
        EntityPlayerSP player = WMinecraft.getPlayer();
        DamageSource dmgSource = DamageSource.causePlayerDamage(player);
        prtPoints = protection.calcModifierDamage(prtLvl, dmgSource);
    }
    return armorPoints * 5 + prtPoints * 3 + armorToughness + armorType;
}
Also used : DamageSource(net.minecraft.util.DamageSource) Enchantment(net.minecraft.enchantment.Enchantment) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP)

Aggregations

DamageSource (net.minecraft.util.DamageSource)61 EntityLivingBase (net.minecraft.entity.EntityLivingBase)29 EntityPlayer (net.minecraft.entity.player.EntityPlayer)29 Entity (net.minecraft.entity.Entity)28 ItemStack (net.minecraft.item.ItemStack)15 BlockPos (net.minecraft.util.math.BlockPos)11 World (net.minecraft.world.World)10 IBlockState (net.minecraft.block.state.IBlockState)9 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)9 ArrayList (java.util.ArrayList)8 List (java.util.List)8 Item (net.minecraft.item.Item)8 EnchantmentHelper (net.minecraft.enchantment.EnchantmentHelper)7 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)7 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)7 MobEffects (net.minecraft.init.MobEffects)6 EntityEquipmentSlot (net.minecraft.inventory.EntityEquipmentSlot)6 EntityDamageSourceIndirect (net.minecraft.util.EntityDamageSourceIndirect)6 MathHelper (net.minecraft.util.math.MathHelper)6 Collection (java.util.Collection)5