Commits

Fabian Faßbender authored b6c156daa6d
Support the new Rotation values.
No tags

src/main/java/org/bukkit/Rotation.java

Modified
4 4 * An enum to specify a rotation based orientation, like that on a clock.
5 5 * <p>
6 6 * It represents how something is viewed, as opposed to cardinal directions.
7 7 */
8 8 public enum Rotation {
9 9
10 10 /**
11 11 * No rotation
12 12 */
13 13 NONE,
14 + /**
15 + * Rotated clockwise by 45 degrees
16 + */
17 + CLOCKWISE_45,
14 18 /**
15 19 * Rotated clockwise by 90 degrees
16 20 */
17 21 CLOCKWISE,
22 + /**
23 + * Rotated clockwise by 135 degrees
24 + */
25 + CLOCKWISE_135,
18 26 /**
19 27 * Flipped upside-down, a 180 degree rotation
20 28 */
21 29 FLIPPED,
30 + /**
31 + * Flipped upside-down + 45 degree rotation
32 + */
33 + FLIPPED_45,
22 34 /**
23 35 * Rotated counter-clockwise by 90 degrees
24 36 */
25 37 COUNTER_CLOCKWISE,
38 + /**
39 + * Rotated counter-clockwise by 45 degrees
40 + */
41 + COUNTER_CLOCKWISE_45
26 42 ;
27 43
28 44 private static final Rotation [] rotations = values();
29 45
30 46 /**
31 47 * Rotate clockwise by 90 degrees.
32 48 *
33 49 * @return the relative rotation
34 50 */
35 51 public Rotation rotateClockwise() {
36 - return rotations[(this.ordinal() + 1) & 0x3];
52 + return rotations[(this.ordinal() + 1) & 0x7];
37 53 }
38 54
39 55 /**
40 56 * Rotate counter-clockwise by 90 degrees.
41 57 *
42 58 * @return the relative rotation
43 59 */
44 60 public Rotation rotateCounterClockwise() {
45 - return rotations[(this.ordinal() - 1) & 0x3];
61 + return rotations[(this.ordinal() - 1) & 0x7];
46 62 }
47 63 }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut