Enum Class StructureRotation

java.lang.Object
java.lang.Enum<StructureRotation>
fr.fidorial.world.structure.StructureRotation
All Implemented Interfaces:
Serializable, Comparable<StructureRotation>, Constable

public enum StructureRotation extends Enum<StructureRotation>
A quarter-turn rotation around the vertical axis, as used by structure templates and jigsaw pieces.
Since:
0.1.0
  • Enum Constant Details

  • Method Details

    • values

      public static StructureRotation[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static StructureRotation valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • quarterTurns

      public int quarterTurns()
      Returns:
      the number of clockwise quarter turns, from 0 to 3
    • ofQuarterTurns

      public static StructureRotation ofQuarterTurns(int quarterTurns)
      Parameters:
      quarterTurns - clockwise quarter turns, any integer
      Returns:
      the matching rotation
    • then

      public StructureRotation then(StructureRotation other)
      Applies other after this rotation.
      Parameters:
      other - the rotation to add
      Returns:
      the combined rotation
    • rotate

      public int rotate(int value, int steps)
      Rotates a value expressed on a circle of steps positions, such as the 16 sign rotations.
      Parameters:
      value - the current value
      steps - the number of positions on the circle
      Returns:
      the rotated value
    • serializedName

      public String serializedName()
      Returns:
      the lowercase name used by commands, e.g. clockwise_90
    • byName

      public static @Nullable StructureRotation byName(String name)