From 51c236d105e1444fae9378005a6aaeb4c29b4335 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Sun, 9 Nov 2014 12:26:38 -0500 Subject: [PATCH 1/4] Add degree-based rotations --- src/main/java/org/bukkit/Rotation.java | 18 ++++++++++++++---- src/main/java/org/bukkit/entity/ItemFrame.java | 9 +++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/bukkit/Rotation.java b/src/main/java/org/bukkit/Rotation.java index dfdb0e5a13..99e31fdd27 100644 --- a/src/main/java/org/bukkit/Rotation.java +++ b/src/main/java/org/bukkit/Rotation.java @@ -10,21 +10,31 @@ public enum Rotation { /** * No rotation */ - NONE, + NONE(0), /** * Rotated clockwise by 90 degrees */ - CLOCKWISE, + CLOCKWISE(90), /** * Flipped upside-down, a 180 degree rotation */ - FLIPPED, + FLIPPED(180), /** * Rotated counter-clockwise by 90 degrees */ - COUNTER_CLOCKWISE, + COUNTER_CLOCKWISE(270), ; + private int degree; + + private Rotation(int degree) { + this.degree = degree; + } + + public int getDegree() { + return degree; + } + private static final Rotation [] rotations = values(); /** diff --git a/src/main/java/org/bukkit/entity/ItemFrame.java b/src/main/java/org/bukkit/entity/ItemFrame.java index 8b86815d2d..60b9a6f3f1 100644 --- a/src/main/java/org/bukkit/entity/ItemFrame.java +++ b/src/main/java/org/bukkit/entity/ItemFrame.java @@ -35,5 +35,14 @@ public interface ItemFrame extends Hanging { * @param rotation the new rotation * @throws IllegalArgumentException if rotation is null */ + @Deprecated public void setRotation(Rotation rotation) throws IllegalArgumentException; + + /** + * Set the rotation of the frame's item, in degrees + * + * @param rotation the new rotation (0 degrees is north) + * @throws IllegalArgumentException if rotation is invalid + */ + public void setRotation(int rotation) throws IllegalArgumentException; } From e67169afa027f659fd9260eee7cc72cf5c04730a Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Sun, 9 Nov 2014 12:38:15 -0500 Subject: [PATCH 2/4] time --- src/main/java/org/bukkit/Rotation.java | 6 +++--- src/main/java/org/bukkit/entity/ItemFrame.java | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/bukkit/Rotation.java b/src/main/java/org/bukkit/Rotation.java index 99e31fdd27..1dc8830826 100644 --- a/src/main/java/org/bukkit/Rotation.java +++ b/src/main/java/org/bukkit/Rotation.java @@ -25,13 +25,13 @@ public enum Rotation { COUNTER_CLOCKWISE(270), ; - private int degree; + private double degree; - private Rotation(int degree) { + private Rotation(double degree) { this.degree = degree; } - public int getDegree() { + public double getDegree() { return degree; } diff --git a/src/main/java/org/bukkit/entity/ItemFrame.java b/src/main/java/org/bukkit/entity/ItemFrame.java index 60b9a6f3f1..17d5214db3 100644 --- a/src/main/java/org/bukkit/entity/ItemFrame.java +++ b/src/main/java/org/bukkit/entity/ItemFrame.java @@ -41,8 +41,10 @@ public interface ItemFrame extends Hanging { /** * Set the rotation of the frame's item, in degrees * + * Values will be rounded to the closest 45-degree interval + * * @param rotation the new rotation (0 degrees is north) * @throws IllegalArgumentException if rotation is invalid */ - public void setRotation(int rotation) throws IllegalArgumentException; + public void setRotation(double rotation) throws IllegalArgumentException; } From ef66262f80dde7ba96c16492f2dfb95019d093e4 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Sun, 9 Nov 2014 15:05:45 -0500 Subject: [PATCH 3/4] Fixed up --- src/main/java/org/bukkit/Rotation.java | 11 ++++++----- src/main/java/org/bukkit/entity/ItemFrame.java | 11 +++++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/bukkit/Rotation.java b/src/main/java/org/bukkit/Rotation.java index 1dc8830826..e265456df2 100644 --- a/src/main/java/org/bukkit/Rotation.java +++ b/src/main/java/org/bukkit/Rotation.java @@ -5,6 +5,7 @@ *

* It represents how something is viewed, as opposed to cardinal directions. */ +@Deprecated public enum Rotation { /** @@ -25,14 +26,14 @@ public enum Rotation { COUNTER_CLOCKWISE(270), ; - private double degree; + private double rotation; - private Rotation(double degree) { - this.degree = degree; + private Rotation(double rotation) { + this.rotation = rotation; } - public double getDegree() { - return degree; + public double getRotation() { + return rotation; } private static final Rotation [] rotations = values(); diff --git a/src/main/java/org/bukkit/entity/ItemFrame.java b/src/main/java/org/bukkit/entity/ItemFrame.java index 17d5214db3..11677ccae1 100644 --- a/src/main/java/org/bukkit/entity/ItemFrame.java +++ b/src/main/java/org/bukkit/entity/ItemFrame.java @@ -27,8 +27,16 @@ public interface ItemFrame extends Hanging { * * @return the direction */ + @Deprecated public Rotation getRotation(); + /** + * Get the rotation of the frame's item + * + * @return the rotation, in degrees + */ + public double getRotationAngle(); + /** * Set the rotation of the frame's item * @@ -44,7 +52,6 @@ public interface ItemFrame extends Hanging { * Values will be rounded to the closest 45-degree interval * * @param rotation the new rotation (0 degrees is north) - * @throws IllegalArgumentException if rotation is invalid */ - public void setRotation(double rotation) throws IllegalArgumentException; + public void setRotationAngle(double rotation); } From 4b384811ef5b41c4d60566f242c728f32a00678c Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Tue, 11 Nov 2014 16:32:56 -0500 Subject: [PATCH 4/4] Added deprecated JavaDoc --- src/main/java/org/bukkit/Rotation.java | 2 ++ src/main/java/org/bukkit/entity/ItemFrame.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/main/java/org/bukkit/Rotation.java b/src/main/java/org/bukkit/Rotation.java index e265456df2..a519318936 100644 --- a/src/main/java/org/bukkit/Rotation.java +++ b/src/main/java/org/bukkit/Rotation.java @@ -4,6 +4,8 @@ * An enum to specify a rotation based orientation, like that on a clock. *

* It represents how something is viewed, as opposed to cardinal directions. + * + * @deprecated This does not handle the various degrees of rotation available */ @Deprecated public enum Rotation { diff --git a/src/main/java/org/bukkit/entity/ItemFrame.java b/src/main/java/org/bukkit/entity/ItemFrame.java index 11677ccae1..006ffca980 100644 --- a/src/main/java/org/bukkit/entity/ItemFrame.java +++ b/src/main/java/org/bukkit/entity/ItemFrame.java @@ -25,6 +25,7 @@ public interface ItemFrame extends Hanging { /** * Get the rotation of the frame's item * + * @deprecated This does not handle the various degrees of rotation available. * @return the direction */ @Deprecated @@ -41,6 +42,7 @@ public interface ItemFrame extends Hanging { * Set the rotation of the frame's item * * @param rotation the new rotation + * @deprecated This does not handle the various degrees of rotation available. * @throws IllegalArgumentException if rotation is null */ @Deprecated