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;
}
Aggregations