From a95ebde6204789cc067fdf586be804acc80ac8ac Mon Sep 17 00:00:00 2001 From: sk89q Date: Sun, 13 Jul 2014 00:53:57 -0700 Subject: [PATCH] Add setYaw, setYaw, and setDirection(yaw, pitch) to Location. --- .../com/sk89q/worldedit/util/Location.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/main/java/com/sk89q/worldedit/util/Location.java b/src/main/java/com/sk89q/worldedit/util/Location.java index e1b6ee487..90ec405be 100644 --- a/src/main/java/com/sk89q/worldedit/util/Location.java +++ b/src/main/java/com/sk89q/worldedit/util/Location.java @@ -162,6 +162,16 @@ public class Location { return yaw; } + /** + * Create a clone of this object with the given yaw. + * + * @param yaw the new yaw + * @return the new instance + */ + public Location setYaw(float yaw) { + return new Location(extent, position, yaw, pitch); + } + /** * Get the pitch in radians. * @@ -171,6 +181,27 @@ public class Location { return pitch; } + /** + * Create a clone of this object with the given pitch. + * + * @param pitch the new yaw + * @return the new instance + */ + public Location setPitch(float pitch) { + return new Location(extent, position, yaw, pitch); + } + + /** + * Create a clone of this object with the given yaw and pitch. + * + * @param yaw the new yaw + * @param pitch the new pitch + * @return the new instance + */ + public Location setDirection(float yaw, float pitch) { + return new Location(extent, position, yaw, pitch); + } + /** * Get the direction vector. *