diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 6cffda15..f55ff742 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -633,4 +633,39 @@ public class Location implements Cloneable, ConfigurationSerializable {
return new Location(world, NumberConversions.toDouble(args.get("x")), NumberConversions.toDouble(args.get("y")), NumberConversions.toDouble(args.get("z")), NumberConversions.toFloat(args.get("yaw")), NumberConversions.toFloat(args.get("pitch")));
}
+
+ /**
+ * Normalizes the given yaw angle to a value between +/-180
+ * degrees.
+ *
+ * @param yaw the yaw in degrees
+ * @return the normalized yaw in degrees
+ * @see Location#getYaw()
+ */
+ public static float normalizeYaw(float yaw) {
+ yaw %= 360.0f;
+ if (yaw >= 180.0f) {
+ yaw -= 360.0f;
+ } else if (yaw < -180.0f) {
+ yaw += 360.0f;
+ }
+ return yaw;
+ }
+
+ /**
+ * Normalizes the given pitch angle to a value between +/-90
+ * degrees.
+ *
+ * @param pitch the pitch in degrees
+ * @return the normalized pitch in degrees
+ * @see Location#getPitch()
+ */
+ public static float normalizePitch(float pitch) {
+ if (pitch > 90.0f) {
+ pitch = 90.0f;
+ } else if (pitch < -90.0f) {
+ pitch = -90.0f;
+ }
+ return pitch;
+ }
}
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 6d32ef71..a1e74cb0 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -105,6 +105,19 @@ public interface Entity extends Metadatable, CommandSender, Nameable {
@NotNull
public World getWorld();
+ /**
+ * Sets the entity's rotation.
+ *
+ * Note that if the entity is affected by AI, it may override this rotation. + * + * @param yaw the yaw + * @param pitch the pitch + * @throws UnsupportedOperationException if used for players + * @deprecated draft API + */ + @Deprecated + public void setRotation(float yaw, float pitch); + /** * Teleports this entity to the given location. If this entity is riding a * vehicle, it will be dismounted prior to teleportation.