From 589562d5ca0cb1750e047aecc3fd4119619f52ac Mon Sep 17 00:00:00 2001 From: MaPePeR Date: Sat, 7 Mar 2015 16:09:50 +0100 Subject: [PATCH] Only reflect Projectiles that head to the player --- .../common/AlchemicalWizardryEventHooks.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java b/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java index d6c5d97a..ed8dda37 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java @@ -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;