Enum XYZD.Direction

java.lang.Object
java.lang.Enum<XYZD.Direction>
de.marcely.bedwars.tools.location.XYZD.Direction
All Implemented Interfaces:
Serializable, Comparable<XYZD.Direction>, java.lang.constant.Constable
Enclosing class:
XYZD

public static enum XYZD.Direction extends Enum<XYZD.Direction>
Represents a compass direction.

Mainly used for storing beds and their direction.

  • Enum Constant Details

  • Method Details

    • values

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

      public static XYZD.Direction valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
      NullPointerException - if the argument is null
    • asBlockFace

      public BlockFace asBlockFace()
    • getModX

      public int getModX()
      Returns the x coordinate modifier for this direction

      EAST returns 1, WEST returns -1, and all other directions return 0

      Returns:
      The x coordinate modifier
    • getModZ

      public int getModZ()
      Returns the z coordinate modifier for this direction

      SOUTH returns 1, NORTH returns -1, and all other directions return 0

      Returns:
      The z coordinate modifier
    • toLegacy

      public int toLegacy()
      Returns the id that has been used in the legacy versions (1.12 and older) of the game

      This refers to the block data that was used for beds.

      Returns:
      The legacy id
    • fromName

      @Nullable public static @Nullable XYZD.Direction fromName(String name)
      Returns the direction from the given name

      Name refers to Enum.name(). The name is case-insensitive.

      Parameters:
      name - The name of the direction
      Returns:
      The direction or null if the name is invalid
    • fromBlockFace

      @Nullable public static @Nullable XYZD.Direction fromBlockFace(BlockFace face)
      Returns the direction from the given block face
      Parameters:
      face - The block face
      Returns:
      The direction or null if the block face is invalid
    • fromLegacy

      @Nullable public static @Nullable XYZD.Direction fromLegacy(int id)
      Returns the direction from the given legacy id
      Parameters:
      id - The legacy id
      Returns:
      The direction or null if the id is invalid
      See Also: