Fix cannon angles

This commit is contained in:
Shaun Bennett 2016-01-26 13:36:30 -06:00
parent 9215d0d3ff
commit 155d8bff1b
1 changed files with 7 additions and 3 deletions

View File

@ -523,11 +523,15 @@ public class Cannon implements Listener
ArmorStand armorStand = (ArmorStand) UtilMath.getFirst(_entities);
double standYaw = Math.toDegrees(armorStand.getHeadPose().getY()) % 360;
double riderYaw = _rider.getLocation().getYaw() % 360;
// riderYaw = 350 and standYaw = 20
// dif should be -30 and not 330
double dif = riderYaw - standYaw;
if (dif > 180) dif -= 360;
if (dif < -180) dif += 360;
double yaw = standYaw + Math.min(dif / 20.f, 5f);
Location pos = armorStand.getLocation();
pos.setYaw((float) yaw);