Direction

Represents a cardinal direction (north, south, east, west) and (up and down).

Importing the class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

ZenScript
Copy
import crafttweaker.api.util.Direction;

Extending Enum<Direction>

Direction extends Enum<Direction>. That means all methods available in Enum<Direction> are also available in Direction

Static Properties

NameTypeHas GetterHas SetterDescription
downDirectiontruefalseNo Description Provided
eastDirectiontruefalseNo Description Provided
northDirectiontruefalseNo Description Provided
sidesDirection[]truefalseNo Description Provided
southDirectiontruefalseNo Description Provided
upDirectiontruefalseNo Description Provided
westDirectiontruefalseNo Description Provided

Methods

rotateY

Rotates this direction on the Y axis

Returns: the direction that rotated on the Y axis of this direction
Return Type: Direction

ZenScript
Copy
// Direction.rotateY() as Direction

<direction:north>.rotateY();
rotateYCCW

Rotates this direction counter-clock wise on the Y axis

Returns: the direction that is counter clockwise on the Y axis
Return Type: Direction

ZenScript
Copy
// Direction.rotateYCCW() as Direction

<direction:north>.rotateYCCW();

Properties

NameTypeHas GetterHas SetterDescription
axisDirectionAxistruefalseGets the direction axis of this direction
axisOffsetinttruefalseGets the offset of this axis (is it pointing towards position or negative). down is negative, up is positive (-y for down, +y for up)
horizontalAnglefloattruefalseGets the horizontal angle of this direction
horizontalIndexinttruefalseGet the index of this horizontal direction (0-3). The order is S-W-N-E
indexinttruefalseGet the Index of this direction (0-5). The order is D-U-N-S-W-E
namestringtruefalseGets the name of this direction
oppositeDirectiontruefalseGets the opposite of this Direction (north returns south)
xOffsetinttruefalseGets the X offset of this direction
yOffsetinttruefalseGets the Y offset of this direction
zOffsetinttruefalseGets the Z offset of this direction