Moved Boost into the class it belongs to & improved it a bit (#1669)
* Moved Boost into the class it belongs to. Added a vertical flight amplification. Changed the conditions to allow for negative boost. TODO: jumping with boost still feels unnatural (too steep compared to sprint) TODO: vertical movement seems only possible by directly modifying motionY which can escalate quickly * Reformat
This commit is contained in:
parent
268469f078
commit
ab33ead20f
|
@ -77,21 +77,24 @@ public class PotionEventHandlers {
|
|||
}
|
||||
}
|
||||
}
|
||||
// if (eventEntityLiving.isPotionActive(ModPotions.boost))
|
||||
// {
|
||||
// int i = eventEntityLiving.getActivePotionEffect(ModPotions.boost).getAmplifier();
|
||||
// {
|
||||
// float percentIncrease = (i + 1) * 0.05f;
|
||||
//
|
||||
// if (eventEntityLiving instanceof EntityPlayer)
|
||||
// {
|
||||
// EntityPlayer entityPlayer = (EntityPlayer) eventEntityLiving;
|
||||
//
|
||||
// if ((entityPlayer.onGround || entityPlayer.capabilities.isFlying) && entityPlayer.moveForward > 0F)
|
||||
// entityPlayer.moveFlying(0F, 1F, entityPlayer.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) {
|
||||
int amplifier = event.getEntityLiving().getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier();
|
||||
float percentIncrease += (amplifier + 1) * 0.5F;
|
||||
|
||||
boolean isPlayerAndFlying = eventEntityLiving instanceof EntityPlayer && ((EntityPlayer) eventEntityLiving).capabilities.isFlying;
|
||||
if (percentIncrease != 0 && (eventEntityLiving.onGround || isPlayerAndFlying) &&
|
||||
(eventEntityLiving.moveForward != 0 || eventEntityLiving.moveStrafing != 0 || eventEntityLiving.motionY != 0)) {
|
||||
|
||||
eventEntityLiving.travel(eventEntityLiving.moveStrafing * percentIncrease,
|
||||
isPlayerAndFlying ? eventEntityLiving.moveVertical * percentIncrease : 0, // TODO: Vertical movement doesn't seem to be impacted even with excessive values
|
||||
eventEntityLiving.moveForward * percentIncrease);
|
||||
|
||||
if (isPlayerAndFlying && eventEntityLiving.motionY != 0) // TODO: remove when entity.travel() works with vertical movement or a better solution exists.
|
||||
eventEntityLiving.motionY *= (1 + Math.min(percentIncrease, 0.75F)); // if this goes too high, it escalates
|
||||
}
|
||||
}
|
||||
|
||||
List<EntityLivingBase> noGravityList = noGravityListMap.getOrDefault(event.getEntityLiving().getEntityWorld(), Lists.newArrayList());
|
||||
if (noGravityList != null) {
|
||||
if (eventEntityLiving.isPotionActive(RegistrarBloodMagic.SUSPENDED) && !eventEntityLiving.hasNoGravity()) {
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package WayofTime.bloodmagic.util.handler.event;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.util.Constants;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
|
||||
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||
import WayofTime.bloodmagic.item.soul.ItemSentientBow;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeCrippledArm;
|
||||
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeQuenched;
|
||||
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeSlowHeal;
|
||||
|
@ -16,6 +15,7 @@ import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerFallProtect;
|
|||
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerGrimReaperSprint;
|
||||
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerJump;
|
||||
import WayofTime.bloodmagic.livingArmour.upgrade.*;
|
||||
import WayofTime.bloodmagic.util.Constants;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -247,15 +247,8 @@ public class LivingArmourHandler {
|
|||
}
|
||||
}
|
||||
|
||||
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) {
|
||||
int i = event.getEntityLiving().getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier();
|
||||
{
|
||||
percentIncrease += (i + 1) * 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
if (percentIncrease > 0 && (player.onGround || player.capabilities.isFlying) && (Math.abs(player.moveForward) > 0 || Math.abs(player.moveStrafing) > 0)) {
|
||||
player.travel(player.moveStrafing * percentIncrease, 0, player.moveForward * percentIncrease);
|
||||
if (percentIncrease != 0 && (player.onGround || player.capabilities.isFlying) && (Math.abs(player.moveForward) > 0 || Math.abs(player.moveStrafing) > 0)) {
|
||||
player.travel(player.moveStrafing * percentIncrease, player.capabilities.isFlying ? player.moveVertical * percentIncrease : 0, player.moveForward * percentIncrease);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue