2020-04-28 21:52:06 +02:00
|
|
|
package net.minestom.server.utils;
|
|
|
|
|
|
|
|
public enum Direction {
|
2020-07-01 20:36:19 +02:00
|
|
|
NORTH(0, 0, -1),
|
|
|
|
EAST(1, 0, 0),
|
|
|
|
SOUTH(0, 0, 1),
|
|
|
|
WEST(-1, 0, 0),
|
|
|
|
UP(0, 1, 0),
|
|
|
|
DOWN(0, -1, 0);
|
2020-04-28 21:52:06 +02:00
|
|
|
|
|
|
|
public static final Direction[] HORIZONTAL = { SOUTH, WEST, NORTH, EAST };
|
|
|
|
|
2020-07-01 20:36:19 +02:00
|
|
|
private final int normalX;
|
|
|
|
private final int normalY;
|
|
|
|
private final int normalZ;
|
|
|
|
|
|
|
|
Direction(int normalX, int normalY, int normalZ) {
|
|
|
|
this.normalX = normalX;
|
|
|
|
this.normalY = normalY;
|
|
|
|
this.normalZ = normalZ;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int normalX() {
|
|
|
|
return normalX;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int normalY() {
|
|
|
|
return normalY;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int normalZ() {
|
|
|
|
return normalZ;
|
|
|
|
}
|
|
|
|
|
2020-04-28 22:45:37 +02:00
|
|
|
public Direction opposite() {
|
|
|
|
switch (this) {
|
|
|
|
case UP:
|
|
|
|
return DOWN;
|
|
|
|
case DOWN:
|
|
|
|
return UP;
|
|
|
|
case EAST:
|
|
|
|
return WEST;
|
|
|
|
case WEST:
|
|
|
|
return EAST;
|
|
|
|
case NORTH:
|
|
|
|
return SOUTH;
|
|
|
|
case SOUTH:
|
|
|
|
return NORTH;
|
|
|
|
default:
|
|
|
|
throw new IllegalArgumentException();
|
|
|
|
}
|
|
|
|
}
|
2020-04-28 21:52:06 +02:00
|
|
|
}
|