if (stack.getItem() instanceof ISpecialArmor) { ISpecialArmor armor = (ISpecialArmor) stack.getItem(); prop = armor.getProperties(entity, stack, source, damage / 25D, x).copy(); } else if (stack.getItem() instanceof ItemArmor && !source.isUnblockable()) { ItemArmor armor = (ItemArmor) stack.getItem(); prop = new ArmorProperties(0, armor.damageReduceAmount / 25D, Integer.MAX_VALUE);
amount = ArmorProperties.applyArmor(player, player.inventory.armorInventory, src, amount); if (amount <= 0) { return;
return new ArmorProperties(-1, 0, 0); return new ArmorProperties(-1, 0, 0); damageAmount *= (armourReduction); return new ArmorProperties(-1, damageAmount, maxAbsorption); return new ArmorProperties(-1, source.isUnblockable() ? 1 - remainder : damageAmount, maxAbsorption); return new ArmorProperties(-1, damageAmount * armourPenetrationReduction, maxAbsorption); return new ArmorProperties(-1, damageAmount, maxAbsorption); return new ArmorProperties(-1, 0, 0);
return new ArmorProperties(-1, 0, 0); return new ArmorProperties(-1, 0, 0); damageAmount *= (armourReduction); return new ArmorProperties(-1, damageAmount, maxAbsorption); return new ArmorProperties(-1, damageAmount * armourPenetrationReduction, maxAbsorption); return new ArmorProperties(-1, damageAmount, maxAbsorption); return new ArmorProperties(-1, damageAmount * armourPenetrationReduction, maxAbsorption); return new ArmorProperties(-1, damageAmount, maxAbsorption); return new ArmorProperties(-1, 0, 0);
@Override protected float applyArmorCalculations(DamageSource source, float amount) { if (!source.isUnblockable()) { if (getArmorValueOverride() >= 0) { return super.applyArmorCalculations(source, amount); } else { NonNullList<ItemStack> armor = NonNullList.create(); for (ItemStack armorPiece : getArmorInventoryList()) { armor.add(armorPiece); } float value = ISpecialArmor.ArmorProperties.applyArmor(this, armor, source, amount); if (value > 0.0F && getShieldStack().getItem() instanceof ItemShield) { float absorb = value * ((ItemShield) getShieldStack().getItem()).getArmorBonusValue() / 25F; int dmg = Math.max((int) absorb, 1); getShieldStack().damageItem(dmg, this); value -= absorb; } if (value < 0.0F) return 0; return value; } } return amount; }
@Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { // TODO: Re-implement when Forge fixes this thing. // if (source.damageType.equals("flux")) { // return FLUX; // } else if (source.damageType.equals("fall")) { // if (slot == 0) { // int absorbMax = energyPerDamage > 0 ? 25 * getEnergyStored(armor) / energyPerDamage : 0; // return new ArmorProperties(0, absorbRatio * getArmorMaterial().getDamageReductionAmount(armorType) * 0.25, absorbMax); // } // return FALL; // } else if (source.isUnblockable()) { // int absorbMax = energyPerDamage > 0 ? 25 * getEnergyStored(armor) / energyPerDamage : 0; // return new ArmorProperties(0, absorbRatio * getArmorMaterial().getDamageReductionAmount(armorType) * 0.025, absorbMax); // } int absorbMax = energyPerDamage > 0 ? 25 * getEnergyStored(armor) / energyPerDamage : 0; return new ArmorProperties(0, absorbRatio * getArmorMaterial().getDamageReductionAmount(armorType) * 0.05, absorbMax); // 0.05 = 1 / 20 (max armor) }
@Override public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot) { EntityEquipmentSlot type = ((RMArmor) armor.getItem()).armorType; if (source.isExplosion()) { return new ArmorProperties(1, 1.0D, 500); } if (type == EntityEquipmentSlot.HEAD && source == DamageSource.FALL) { return new ArmorProperties(1, 1.0D, 10); } if (type == EntityEquipmentSlot.HEAD || type == EntityEquipmentSlot.FEET) { return new ArmorProperties(0, 0.2D, 250); } return new ArmorProperties(0, 0.3D, 350); }
@Override public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot) { EntityEquipmentSlot type = ((GemArmorBase) armor.getItem()).armorType; if (source.isExplosion()) { return new ArmorProperties(1, 1.0D, 750); } if (type == EntityEquipmentSlot.FEET && source == DamageSource.FALL) { return new ArmorProperties(1, 1.0D, 15); } if (type == EntityEquipmentSlot.HEAD || type == EntityEquipmentSlot.FEET) { return new ArmorProperties(0, 0.2D, 400); } return new ArmorProperties(0, 0.3D, 500); }
@Override public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot) { EntityEquipmentSlot type = ((DMArmor) armor.getItem()).armorType; if (source.isExplosion()) { return new ArmorProperties(1, 1.0D, 350); } if (type == EntityEquipmentSlot.HEAD && source == DamageSource.FALL) { return new ArmorProperties(1, 1.0D, 5); } if (type == EntityEquipmentSlot.HEAD || type == EntityEquipmentSlot.FEET) { return new ArmorProperties(0, 0.2D, 100); } return new ArmorProperties(0, 0.3D, 150); }
@Override public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot) { double ratio = 0d; // percentage of damage that is removed before normal armor calculations are done. This is actually bad for armor with a high // toughness... if (!source.isUnblockable()) { ArmorMaterial armorMaterial = getMaterial(armor); int damageReductionAmount = armorMaterial.getDamageReductionAmount(armorType) - ArmorMaterial.DIAMOND.getDamageReductionAmount(armorType); if (damageReductionAmount > 0) { // Reduce the damage by 5% for each point of armor we have more than diamond ratio = damageReductionAmount * .05d; // This is just to counter the maximum effective armor (80%) vanilla enforces for normal armor calculations } } return new ArmorProperties(0, ratio, Integer.MAX_VALUE); }
@Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { return new ArmorProperties(0, getDamageReduction(slot, armor) / 25D, Integer.MAX_VALUE); }
@Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { return new ArmorProperties(100, Math.min(1.0, getEnergy(armor) / ratioMaxEnergy) * ratioMax, (int) (getEnergy(armor) / energyPerDamage * 25D)); }
@Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { return new ArmorProperties(0, 0, 0); }
@Override public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot) { if (armor.hasTagCompound()) { if (armor.getTagCompound().hasKey("Plate")) { ExosuitPlate plate = UtilPlates.getPlate(armor.getTagCompound().getString("Plate")); return new ArmorProperties(0, plate.getDamageReductionAmount(armorType, source) / 25.0D, ItemArmor.ArmorMaterial.IRON.getDurability(armorType)); } } return new ArmorProperties(0, ItemArmor.ArmorMaterial.IRON.getDamageReductionAmount(armorType) / 25.0D, ItemArmor.ArmorMaterial.IRON.getDurability(armorType)); }
@Override public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot) { return new ArmorProperties(1, 0.5, 10); // todo: vary on damage source //todo: remove junk data }
@Override public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot) { int max = getMaxAbsorption(armor); if(slot==1||slot==2){ return new ArmorProperties(1,0.8D,max); }else if(slot==0){ return new ArmorProperties(0,0.6D,max); }else if(slot==3){ return new ArmorProperties(0,0.4D,max); } return null; }
@Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { if (source == drown) return new ArmorProperties(0, 0.01D, Integer.MAX_VALUE); else if(source.isUnblockable()) return new ArmorProperties(0, 0, 0); else if (source.getEntity() instanceof EntityGuardian) { return new ArmorProperties(0, 0.04D, Integer.MAX_VALUE); } else return new ArmorProperties(0, 0.4D, Integer.MAX_VALUE); }
@Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { return new ArmorProperties(10, 1.0, 10000); }
@Override public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot) { if(source.isUnblockable()) return new ArmorProperties(0, 0, 0); return new ArmorProperties(0, damageReduceAmount / 25D, armor.getMaxDamage() + 1 - armor.getItemDamage()); }