From 49813550b4018a44c83182dfb251fc9855943d6d Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Sun, 30 Nov 2014 14:20:41 +0100 Subject: [PATCH] Change battlesign-blocking to actually require you to look at the arrow + reflection speed depends on how much you looked at it (+buffed) --- .../java/tconstruct/tools/TinkerToolEvents.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/tconstruct/tools/TinkerToolEvents.java b/src/main/java/tconstruct/tools/TinkerToolEvents.java index 51ece884..4c2342d5 100644 --- a/src/main/java/tconstruct/tools/TinkerToolEvents.java +++ b/src/main/java/tconstruct/tools/TinkerToolEvents.java @@ -229,15 +229,25 @@ public class TinkerToolEvents { if (source.isProjectile()) { + Entity projectile = source.getSourceOfDamage(); + Vec3 motion = Vec3.createVectorHelper(projectile.motionX, projectile.motionY, projectile.motionZ); + Vec3 look = player.getLookVec(); + + // this gives a factor of how much we're looking at the incoming arrow + double strength = -look.dotProduct(motion.normalize()); + // we're looking away. oh no. + if(strength < 0.1) + return; + // no damage, hooraaay event.setCanceled(true); - Entity projectile = source.getSourceOfDamage(); - double speed = projectile.motionX*projectile.motionX + projectile.motionY*projectile.motionY + projectile.motionZ*projectile.motionZ; speed = Math.sqrt(speed); - Vec3 look = player.getLookVec(); + speed = (speed+2)*strength; + + // now we simply set the look vector with the speed and get our new vector! projectile.motionX = look.xCoord * speed;