h31ix

Untitled

Oct 30th, 2012
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. public enum Rotation {
  2. /**
  3. * No rotation
  4. */
  5. NONE,
  6. /**
  7. * Rotated clockwise
  8. */
  9. CLOCKWISE,
  10. /**
  11. * Flipped upside-down
  12. */
  13. FLIPPED,
  14. /**
  15. * Rotated counter-clockwise
  16. */
  17. COUNTER_CLOCKWISE;
  18.  
  19. private static Rotation [] rotations = new Rotation [4];
  20.  
  21. static {
  22. rotations = values();
  23. }
  24.  
  25. /**
  26. * Rotate clockwise one value, as if the frame was right-clicked by a player.
  27. *
  28. * @return The new rotation
  29. */
  30. public Rotation rotateClockwise() {
  31. return rotations[this.ordinal() + 1 % 4];
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment