Direction
Link to direction
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 Copyimport crafttweaker.api.util.Direction;
Enum Constants
Link to enum-constants
Direction is an enum. It has 6 enum constants. They are accessible using the code below.
ZenScript CopyDirection.north
Direction.south
Direction.east
Direction.west
Direction.up
Direction.down
Static Properties
Link to static-properties
Name | Type | Has Getter | Has Setter | Description |
---|---|---|---|---|
Name down | Type Direction | Has Getter true | Has Setter false | Description No Description Provided |
Name east | Type Direction | Has Getter true | Has Setter false | Description No Description Provided |
Name north | Type Direction | Has Getter true | Has Setter false | Description No Description Provided |
Name sides | Type Direction[] | Has Getter true | Has Setter false | Description No Description Provided |
Name south | Type Direction | Has Getter true | Has Setter false | Description No Description Provided |
Name up | Type Direction | Has Getter true | Has Setter false | Description No Description Provided |
Name west | Type Direction | Has Getter true | Has Setter false | Description No Description Provided |
Methods
Link to methods
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();
Properties
Link to properties
Name | Type | Has Getter | Has Setter | Description |
---|---|---|---|---|
Name axis | Type DirectionAxis | Has Getter true | Has Setter false | Description Gets the direction axis of this direction |
Name 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) |
Name horizontalAngle | Type float | Has Getter true | Has Setter false | Description Gets the horizontal angle of this direction |
Name 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 |
Name 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 name | Type string | Has Getter true | Has Setter false | Description Gets the name of this direction |
Name opposite | Type Direction | Has Getter true | Has Setter false | Description Gets the opposite of this Direction (north returns south) |
Name xOffset | Type int | Has Getter true | Has Setter false | Description Gets the X offset of this direction |
Name yOffset | Type int | Has Getter true | Has Setter false | Description Gets the Y offset of this direction |
Name zOffset | Type int | Has Getter true | Has Setter false | Description Gets the Z offset of this direction |