Updated Orientation with new helper functionality.
This commit is contained in:
parent
50e6b39a29
commit
e6b61cb33d
1 changed files with 27 additions and 7 deletions
|
@ -3,27 +3,40 @@ package net.minecraftforge.common;
|
|||
public enum Orientation
|
||||
{
|
||||
/** -Y */
|
||||
DOWN,
|
||||
DOWN(0, -1, 0),
|
||||
|
||||
/** +Y */
|
||||
UP,
|
||||
UP(0, 1, 0),
|
||||
|
||||
/** -Z */
|
||||
NORTH,
|
||||
NORTH(0, 0, -1),
|
||||
|
||||
/** +Z */
|
||||
SOUTH,
|
||||
SOUTH(0, 0, 1),
|
||||
|
||||
/** -X */
|
||||
WEST,
|
||||
WEST(-1, 0, 0),
|
||||
|
||||
/** +X */
|
||||
EAST,
|
||||
EAST(1, 0, 0),
|
||||
|
||||
/**
|
||||
* Used only by getOrientation, for invalid inputs
|
||||
*/
|
||||
UNKNOWN;
|
||||
UNKNOWN(0, 0, 0);
|
||||
|
||||
public final int offsetX;
|
||||
public final int offsetY;
|
||||
public final int offsetZ;
|
||||
public final int flag;
|
||||
|
||||
private Orientation(int x, int y, int z)
|
||||
{
|
||||
offsetX = x;
|
||||
offsetY = y;
|
||||
offsetZ = z;
|
||||
flag = 1 << ordinal();
|
||||
}
|
||||
|
||||
public static Orientation getOrientation(int id)
|
||||
{
|
||||
|
@ -33,4 +46,11 @@ public enum Orientation
|
|||
}
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
||||
public static final int[] opposite = new int[] { 1, 0, 3, 2, 5, 4, 6};
|
||||
|
||||
public Orientation getOpposite()
|
||||
{
|
||||
return getOrientation(opposite[ordinal()]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue