Only reflect Projectiles that head to the player

This commit is contained in:
MaPePeR 2015-03-07 16:09:50 +01:00
parent e21f6941ba
commit 589562d5ca

View file

@ -548,6 +548,14 @@ public class AlchemicalWizardryEventHooks
double delY = projectile.posY - entity.posY;
double delZ = projectile.posZ - entity.posZ;
double angle = (delX*projectile.motionX + delY*projectile.motionY + delZ*projectile.motionZ)/
(Math.sqrt(delX * delX + delY * delY + delZ * delZ)*Math.sqrt(projectile.motionX*projectile.motionX + projectile.motionY* projectile.motionY + projectile.motionZ*projectile.motionZ));
angle = Math.acos(angle);
if (angle < 3*(Math.PI/4)) {
//angle is < 135 degrees
continue;
}
if (throwingEntity != null)
{
delX = -projectile.posX + throwingEntity.posX;