Enum XYZD.Direction
- All Implemented Interfaces:
Serializable
,Comparable<XYZD.Direction>
,java.lang.constant.Constable
- Enclosing class:
XYZD
Represents a compass direction.
Mainly used for storing beds and their direction.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable XYZD.Direction
fromBlockFace
(BlockFace face) Returns the direction from the given block facestatic @Nullable XYZD.Direction
fromLegacy
(int id) Returns the direction from the given legacy idstatic @Nullable XYZD.Direction
Returns the direction from the given nameint
getModX()
Returns the x coordinate modifier for this directionint
getModZ()
Returns the z coordinate modifier for this directionint
toLegacy()
Returns the id that has been used in the legacy versions (1.12 and older) of the gamestatic XYZD.Direction
Returns the enum constant of this type with the specified name.static XYZD.Direction[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
NORTH
-
SOUTH
-
EAST
-
WEST
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-
asBlockFace
-
getModX
public int getModX()Returns the x coordinate modifier for this directionEAST
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 directionSOUTH
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 gameThis refers to the block data that was used for beds.
- Returns:
- The legacy id
-
fromName
Returns the direction from the given nameName 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
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
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:
-