From f50c69ee8f604fcf5e971fe346fc9860b297969a Mon Sep 17 00:00:00 2001 From: sk89q Date: Sun, 13 Jul 2014 21:25:28 -0700 Subject: [PATCH] Use Location.getYaw() and getPitch() for converting to Bukkit Locations. --- .../java/com/sk89q/worldedit/bukkit/BukkitAdapter.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/bukkit/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java b/src/bukkit/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java index f949510f1..579ea88ae 100644 --- a/src/bukkit/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java +++ b/src/bukkit/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java @@ -91,16 +91,11 @@ final class BukkitAdapter { public static org.bukkit.Location adapt(Location location) { checkNotNull(location); Vector position = location.toVector(); - Vector direction = location.getDirection(); - final double eyeX = direction.getX(); - final double eyeZ = direction.getZ(); - final float yaw = (float) Math.toDegrees(Math.atan2(-eyeX, eyeZ)); - final double length = Math.sqrt(eyeX * eyeX + eyeZ * eyeZ); - final float pitch = (float) Math.toDegrees(Math.atan2(-direction.getY(), length)); return new org.bukkit.Location( adapt((World) location.getExtent()), position.getX(), position.getY(), position.getZ(), - yaw, pitch); + (float) Math.toDegrees(location.getYaw()), + (float) Math.toDegrees(location.getPitch())); } /**