Fix arrow knockback

This commit is contained in:
AlexTheCoder 2016-08-13 00:19:02 -04:00 committed by cnr
parent d5d8f07085
commit c66e485c9e

View File

@ -545,13 +545,19 @@ public class DamageManager extends MiniPlugin
origin = event.GetDamagerEntity(true).getLocation();
if (event.getKnockbackOrigin() != null)
origin = event.getKnockbackOrigin();
else if (event.GetProjectile() != null)
origin = event.GetProjectile().getLocation();
//Vec
Vector trajectory = UtilAlg.getTrajectory2d(origin, event.GetDamageeEntity().getLocation());
trajectory.multiply(0.6 * knockback);
trajectory.setY(Math.abs(trajectory.getY()));
if (event.GetProjectile() != null && event.getKnockbackOrigin() == null)
{
trajectory = event.GetProjectile().getVelocity();
trajectory.setY(0);
trajectory.multiply(0.37 * knockback / trajectory.length());
trajectory.setY(0.06);
}
//Apply
double vel = 0.2 + trajectory.length() * 0.8;