diff --git a/src/main/java/com/wayoftime/bloodmagic/core/RegistrarBloodMagicLivingArmor.java b/src/main/java/com/wayoftime/bloodmagic/core/RegistrarBloodMagicLivingArmor.java index 0f0d9bae..2ce63e79 100644 --- a/src/main/java/com/wayoftime/bloodmagic/core/RegistrarBloodMagicLivingArmor.java +++ b/src/main/java/com/wayoftime/bloodmagic/core/RegistrarBloodMagicLivingArmor.java @@ -35,7 +35,7 @@ import java.util.stream.Collectors; * - [ ] Grave Digger * - [ ] Grim Reaper Sprint * - [ ] Health boost - * - [-] Jump + * - [x] Jump * - [ ] Knockback Resist * - [ ] Melee Damage * - [ ] Night Sight diff --git a/src/main/java/com/wayoftime/bloodmagic/core/living/LivingStatusWatcher.java b/src/main/java/com/wayoftime/bloodmagic/core/living/LivingStatusWatcher.java index ea70b694..0de0c644 100644 --- a/src/main/java/com/wayoftime/bloodmagic/core/living/LivingStatusWatcher.java +++ b/src/main/java/com/wayoftime/bloodmagic/core/living/LivingStatusWatcher.java @@ -3,8 +3,10 @@ package com.wayoftime.bloodmagic.core.living; import com.wayoftime.bloodmagic.BloodMagic; import com.wayoftime.bloodmagic.core.RegistrarBloodMagicLivingArmor; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.DamageSource; import net.minecraft.util.math.Vec3d; import net.minecraftforge.event.entity.living.LivingEvent; +import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -22,12 +24,33 @@ public class LivingStatusWatcher { return; int level = stats.getLevel(RegistrarBloodMagicLivingArmor.UPGRADE_JUMP.getKey()); - player.motionY += 0.05 * level; + double jumpBonus = RegistrarBloodMagicLivingArmor.UPGRADE_JUMP.getBonusValue("jump", level).doubleValue(); + player.motionY += jumpBonus; if (level >= 3) { Vec3d lookVec = player.getLookVec(); - player.motionX += player.motionX == 0 ? 0 : lookVec.x * 0.07D * level; - player.motionZ += player.motionZ == 0 ? 0 : lookVec.z * 0.07D * level; + player.motionX += player.motionX == 0 ? 0 : lookVec.x * jumpBonus; + player.motionZ += player.motionZ == 0 ? 0 : lookVec.z * jumpBonus; } } + + @SubscribeEvent + public static void onDamage(LivingHurtEvent event) { + if (!(event.getEntity() instanceof EntityPlayer)) + return; + + if (event.getSource() != DamageSource.FALL) + return; + + EntityPlayer player = (EntityPlayer) event.getEntity(); + LivingStats stats = LivingUtil.applyNewExperience(player, RegistrarBloodMagicLivingArmor.UPGRADE_JUMP, 1); + if (stats == null) + return; + + int level = stats.getLevel(RegistrarBloodMagicLivingArmor.UPGRADE_JUMP.getKey()); + double fallBonus = RegistrarBloodMagicLivingArmor.UPGRADE_JUMP.getBonusValue("fall", level).doubleValue(); + float oldAmount = event.getAmount(); + float newAmount = oldAmount * Math.max(1F - (float) fallBonus, 0F); + event.setAmount(newAmount); + } } diff --git a/src/main/java/com/wayoftime/bloodmagic/core/living/LivingUpgrade.java b/src/main/java/com/wayoftime/bloodmagic/core/living/LivingUpgrade.java index 75b6dc5f..8b1a9582 100644 --- a/src/main/java/com/wayoftime/bloodmagic/core/living/LivingUpgrade.java +++ b/src/main/java/com/wayoftime/bloodmagic/core/living/LivingUpgrade.java @@ -64,7 +64,7 @@ public class LivingUpgrade { @Nonnull public Number getBonusValue(String id, int level) { - return bonuses.getOrDefault(id, Bonus.DEFAULT).modifiers.get(level); + return bonuses.getOrDefault(id, Bonus.DEFAULT).modifiers.get(level - 1); } public LivingUpgrade withAttributeProvider(IAttributeProvider attributeProvider) { diff --git a/src/main/resources/data/living_armor/jump.json b/src/main/resources/data/living_armor/jump.json index be8a516b..57865813 100644 --- a/src/main/resources/data/living_armor/jump.json +++ b/src/main/resources/data/living_armor/jump.json @@ -1,9 +1,41 @@ { "id": "bloodmagic:jump", "levels": [ - { "xp": 10, "cost": 1 }, - { "xp": 20, "cost": 5 }, - { "xp": 30, "cost": 25 }, - { "xp": 40, "cost": 125 } - ] + { "xp": 10, "cost": 3 }, + { "xp": 20, "cost": 6 }, + { "xp": 30, "cost": 11 }, + { "xp": 40, "cost": 23 }, + { "xp": 40, "cost": 37 }, + { "xp": 40, "cost": 50 }, + { "xp": 40, "cost": 70 }, + { "xp": 40, "cost": 100 }, + { "xp": 40, "cost": 140 }, + { "xp": 40, "cost": 200 } + ], + "bonuses": { + "jump": [ + 0.1, + 0.2, + 0.3, + 0.4, + 0.5, + 0.7, + 0.75, + 0.9, + 1.1, + 1.3 + ], + "fall": [ + 0.1, + 0.2, + 0.3, + 0.4, + 0.5, + 0.6, + 0.7, + 0.75, + 0.8, + 0.85 + ] + } } \ No newline at end of file