Falling damage is now affected by Feather Falling properly.
This commit is contained in:
parent
dab6ca8a5f
commit
6c16d1c816
Binary file not shown.
@ -3333,6 +3333,17 @@ public class GenericFunctions {
|
||||
//We cleared the non-living entities, deal damage to the rest.
|
||||
}
|
||||
|
||||
public static double CalculateFallResistance(LivingEntity l) {
|
||||
int featherfalllv = 0;
|
||||
ItemStack[] equips = l.getEquipment().getArmorContents();
|
||||
for (int i=0;i<equips.length;i++) {
|
||||
if (equips[i]!=null && equips[i].getType()!=Material.AIR && equips[i].containsEnchantment(Enchantment.PROTECTION_FALL)) {
|
||||
featherfalllv+=equips[i].getEnchantmentLevel(Enchantment.PROTECTION_FALL);
|
||||
}
|
||||
}
|
||||
return 1-(featherfalllv*0.01);
|
||||
}
|
||||
|
||||
private static double CalculateBlastResistance(LivingEntity l) {
|
||||
int explosionlv = 0;
|
||||
ItemStack[] equips = l.getEquipment().getArmorContents();
|
||||
|
@ -4135,6 +4135,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
if (ev.getCause()!=DamageCause.CUSTOM) { //This is not handled damage, so apply it.
|
||||
double dmgdealt = ev.getDamage(DamageModifier.BASE);
|
||||
CustomDamage.setupTrueDamage(ev);
|
||||
|
||||
if (ev.getCause()==DamageCause.FALL) {
|
||||
dmgdealt *= GenericFunctions.CalculateFallResistance((LivingEntity)ev.getEntity());
|
||||
}
|
||||
|
||||
CustomDamage.ApplyDamage(dmgdealt, null, (LivingEntity)ev.getEntity(), null, ev.getCause().name(), CustomDamage.TRUEDMG);
|
||||
ev.setCancelled(true);
|
||||
} else
|
||||
|
Loading…
x
Reference in New Issue
Block a user