(#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

@ -11,6 +11,7 @@ import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeQuenched;
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeSlowHeal;
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeStormTrooper;
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerArrowShot;
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerFallProtect;
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerGrimReaperSprint;
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerJump;
import WayofTime.bloodmagic.livingArmour.upgrade.*;
@ -32,6 +33,7 @@ import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.ProjectileImpactEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent;
import net.minecraftforge.event.entity.living.LivingHealEvent;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
@ -374,8 +376,32 @@ public class LivingArmourHandler
}
}
}
}
}
// Applies: Softfall
@SubscribeEvent
public static void onPlayerFall(LivingFallEvent event) {
if (event.getEntityLiving() instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if (LivingArmour.hasFullSet(player))
{
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null)
{
StatTrackerFallProtect.incrementCounter(armour, event.getDamageMultiplier() * (event.getDistance() - 3));
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.fallProtect", chestStack);
if (upgrade instanceof LivingArmourUpgradeFallProtect) {
LivingArmourUpgradeFallProtect fallUpgrade = (LivingArmourUpgradeFallProtect) upgrade;
event.setDamageMultiplier(event.getDamageMultiplier() * fallUpgrade.getDamageMultiplier());
}
}
}
}
}
// Applies: Arrow Shot
@SubscribeEvent
public static void onProjectileImpact(ProjectileImpactEvent.Arrow event)