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

Importing the class

Link to 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;

Direction is an enum. It has 6 enum constants. They are accessible using the code below.

ZenScript
Copy
Direction.north
Direction.south
Direction.east
Direction.west
Direction.up
Direction.down

Static Properties

Link to static-properties

名称TypeHas GetterHas SetterDescription
名称
down
Type
Direction
Has Getter
true
Has Setter
false
Description
No Description Provided
名称
east
Type
Direction
Has Getter
true
Has Setter
false
Description
No Description Provided
名称
north
Type
Direction
Has Getter
true
Has Setter
false
Description
No Description Provided
名称
sides
Type
Direction[]
Has Getter
true
Has Setter
false
Description
No Description Provided
名称
south
Type
Direction
Has Getter
true
Has Setter
false
Description
No Description Provided
名称
up
Type
Direction
Has Getter
true
Has Setter
false
Description
No Description Provided
名称
west
Type
Direction
Has Getter
true
Has Setter
false
Description
No Description Provided

Name: 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();

Name: 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();
名称TypeHas GetterHas SetterDescription
名称
axis
Type
DirectionAxis
Has Getter
true
Has Setter
false
Description
Gets the direction axis of this direction
名称
axisOffset
Type
int
Has Getter
true
Has Setter
false
Description
Gets the offset of this axis (is it pointing towards position or negative). down is negative, up is positive (-y for down, +y for up)
名称
horizontalAngle
Type
float
Has Getter
true
Has Setter
false
Description
Gets the horizontal angle of this direction
名称
horizontalIndex
Type
int
Has Getter
true
Has Setter
false
Description
Get the index of this horizontal direction (0-3). The order is S-W-N-E
名称
index
Type
int
Has Getter
true
Has Setter
false
Description
Get the Index of this direction (0-5). The order is D-U-N-S-W-E
名称
name
Type
string
Has Getter
true
Has Setter
false
Description
Gets the name of this direction
名称
opposite
Type
Direction
Has Getter
true
Has Setter
false
Description
Gets the opposite of this Direction (north returns south)
名称
xOffset
Type
int
Has Getter
true
Has Setter
false
Description
Gets the X offset of this direction
名称
yOffset
Type
int
Has Getter
true
Has Setter
false
Description
Gets the Y offset of this direction
名称
zOffset
Type
int
Has Getter
true
Has Setter
false
Description
Gets the Z offset of this direction