Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Fix some armor calculations with Forge compat #3216

Merged
merged 1 commit into from
Oct 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,9 @@ public String getName() {
};

public static Optional<List<DamageFunction>> createArmorModifiers(
final EntityLivingBase entityLivingBase, final DamageSource damageSource, double damage) {
final EntityLivingBase entityLivingBase, final DamageSource damageSource, final double damage) {
final Iterable<ItemStack> inventory = entityLivingBase.getArmorInventoryList();
final List<ItemStack> itemStacks = Lists.newArrayList(inventory);
damage *= 25;
// Beware all ye who enter here, for there's nothing but black magic here.
final ArrayList<ISpecialArmor.ArmorProperties> dmgVals = new ArrayList<ISpecialArmor.ArmorProperties>();
for (int x = 0; x < itemStacks.size(); x++) {
Expand Down Expand Up @@ -229,10 +228,12 @@ private static ISpecialArmor.ArmorProperties getProperties(final EntityLivingBas
ISpecialArmor.ArmorProperties prop = null;
if (armorStack.getItem() instanceof ISpecialArmor) {
final ISpecialArmor armor = (ISpecialArmor) armorStack.getItem();
prop = armor.getProperties(base, armorStack, damageSource, damage / 25D, index).copy();
prop = armor.getProperties(base, armorStack, damageSource, damage, index).copy();
} else if (armorStack.getItem() instanceof ItemArmor && !damageSource.isUnblockable()) {
final ItemArmor armor = (ItemArmor) armorStack.getItem();
prop = new ISpecialArmor.ArmorProperties(0, armor.damageReduceAmount / 25D, Integer.MAX_VALUE);
prop = new ISpecialArmor.ArmorProperties(0, 0, Integer.MAX_VALUE);
prop.Armor = armor.damageReduceAmount;
prop.Toughness = armor.toughness;
}
if (prop != null) {
prop.Slot = index;
Expand Down