Added fall distance mitigation to the jump upgrade

This commit is contained in:
WayofTime 2016-04-30 10:39:50 -04:00
parent aba4332699
commit 08de13b482
2 changed files with 19 additions and 0 deletions

View file

@ -5,6 +5,7 @@ Version 2.0.0-35
- Living Armour is now repairable in an anvil with Binding Reagent.
- Started adding in the Alchemy Table... not really started.
- Changed it so that the Mending enchantment consumes the EXP before the Tome of Peritia does
- Added fall distance mitigation to the jump upgrade
------------------------------------------------------
Version 2.0.0-34

View file

@ -1,13 +1,17 @@
package WayofTime.bloodmagic.livingArmour.upgrade;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class LivingArmourUpgradeJump extends LivingArmourUpgrade
{
public static final int[] costs = new int[] { 3, 6, 11, 23, 37, 50, 70, 100, 140, 200 };
public static final double[] jumpModifier = new double[] { 0.10, 0.2, 0.3, 0.4, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5 };
public static final double[] fallModifier = new double[] { 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.75, 0.8, 0.85 };
public LivingArmourUpgradeJump(int level)
{
@ -31,6 +35,20 @@ public class LivingArmourUpgradeJump extends LivingArmourUpgrade
return 10; // Set to here until I can add more upgrades to it.
}
@Override
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
{
if (!world.isRemote)
{
double motionY = player.motionY;
if (motionY < 0)
{
player.fallDistance = (float) Math.max(0, player.fallDistance + motionY * fallModifier[this.level]);
}
}
}
@Override
public int getCostOfUpgrade()
{