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
2 changed files with 22 additions and 26 deletions
|
@ -77,21 +77,24 @@ public class PotionEventHandlers {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (eventEntityLiving.isPotionActive(ModPotions.boost))
|
|
||||||
// {
|
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) {
|
||||||
// int i = eventEntityLiving.getActivePotionEffect(ModPotions.boost).getAmplifier();
|
int amplifier = event.getEntityLiving().getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier();
|
||||||
// {
|
float percentIncrease += (amplifier + 1) * 0.5F;
|
||||||
// float percentIncrease = (i + 1) * 0.05f;
|
|
||||||
//
|
boolean isPlayerAndFlying = eventEntityLiving instanceof EntityPlayer && ((EntityPlayer) eventEntityLiving).capabilities.isFlying;
|
||||||
// if (eventEntityLiving instanceof EntityPlayer)
|
if (percentIncrease != 0 && (eventEntityLiving.onGround || isPlayerAndFlying) &&
|
||||||
// {
|
(eventEntityLiving.moveForward != 0 || eventEntityLiving.moveStrafing != 0 || eventEntityLiving.motionY != 0)) {
|
||||||
// EntityPlayer entityPlayer = (EntityPlayer) eventEntityLiving;
|
|
||||||
//
|
eventEntityLiving.travel(eventEntityLiving.moveStrafing * percentIncrease,
|
||||||
// if ((entityPlayer.onGround || entityPlayer.capabilities.isFlying) && entityPlayer.moveForward > 0F)
|
isPlayerAndFlying ? eventEntityLiving.moveVertical * percentIncrease : 0, // TODO: Vertical movement doesn't seem to be impacted even with excessive values
|
||||||
// entityPlayer.moveFlying(0F, 1F, entityPlayer.capabilities.isFlying ? (percentIncrease / 2.0f) : percentIncrease);
|
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());
|
List<EntityLivingBase> noGravityList = noGravityListMap.getOrDefault(event.getEntityLiving().getEntityWorld(), Lists.newArrayList());
|
||||||
if (noGravityList != null) {
|
if (noGravityList != null) {
|
||||||
if (eventEntityLiving.isPotionActive(RegistrarBloodMagic.SUSPENDED) && !eventEntityLiving.hasNoGravity()) {
|
if (eventEntityLiving.isPotionActive(RegistrarBloodMagic.SUSPENDED) && !eventEntityLiving.hasNoGravity()) {
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
package WayofTime.bloodmagic.util.handler.event;
|
package WayofTime.bloodmagic.util.handler.event;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.BloodMagic;
|
import WayofTime.bloodmagic.BloodMagic;
|
||||||
import WayofTime.bloodmagic.util.Constants;
|
|
||||||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgrade;
|
|
||||||
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
|
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
|
||||||
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
|
||||||
import WayofTime.bloodmagic.item.soul.ItemSentientBow;
|
import WayofTime.bloodmagic.item.soul.ItemSentientBow;
|
||||||
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
import WayofTime.bloodmagic.livingArmour.LivingArmour;
|
||||||
|
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgrade;
|
||||||
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeCrippledArm;
|
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeCrippledArm;
|
||||||
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeQuenched;
|
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeQuenched;
|
||||||
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeSlowHeal;
|
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.StatTrackerGrimReaperSprint;
|
||||||
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerJump;
|
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerJump;
|
||||||
import WayofTime.bloodmagic.livingArmour.upgrade.*;
|
import WayofTime.bloodmagic.livingArmour.upgrade.*;
|
||||||
|
import WayofTime.bloodmagic.util.Constants;
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -247,15 +247,8 @@ public class LivingArmourHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST)) {
|
if (percentIncrease != 0 && (player.onGround || player.capabilities.isFlying) && (Math.abs(player.moveForward) > 0 || Math.abs(player.moveStrafing) > 0)) {
|
||||||
int i = event.getEntityLiving().getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier();
|
player.travel(player.moveStrafing * percentIncrease, player.capabilities.isFlying ? player.moveVertical * percentIncrease : 0, player.moveForward * percentIncrease);
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue