(#1415) Soft Fall / fallProtect Implementation (#1536)

* Fixed softFall / fallProtect upgrade for living armour. Previously it
relied on regular armor properties, which fall damage bypasses by being
marked is unblockable. Created a method subscribed to onPlayerFall which
applies the damage multiplier and the fallProtect stat-tracker. Removed
the armorProperties method of LivingAmourUpgradeFallProtect.java and
replaced it with getDamageMultiplier.

* Fixed formatting issues. [1+1 vs 1 + 1, 1.0F instead of 1.0f]
This commit is contained in:
Phil 2019-02-08 22:34:41 -05:00 committed by Nick Ignoffo
parent 2c49be1bdd
commit 28b5caa5aa
2 changed files with 31 additions and 9 deletions

View file

@ -8,19 +8,15 @@ import net.minecraft.util.DamageSource;
public class LivingArmourUpgradeFallProtect extends LivingArmourUpgrade {
public static final int[] costs = new int[]{2, 5, 9, 15, 25};
public static final double[] protectionLevel = new double[]{0.2, 0.4, 0.6, 0.8, 1};
public static final float[] protectionLevel = new float[]{0.2F, 0.4F, 0.6F, 0.8F, 1F};
public LivingArmourUpgradeFallProtect(int level) {
super(level);
}
@Override
public double getArmourProtection(EntityLivingBase wearer, DamageSource source) {
if (source.equals(DamageSource.FALL)) {
return protectionLevel[this.level];
}
return 0;
public float getDamageMultiplier() {
return 1 - protectionLevel[this.level];
}
@Override