mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-09-06 15:58:20 +00:00
Commands that consider the player's look direction now also use up/down when the player's pitch is outside the [-67.5;67.5] interval.
This commit is contained in:
parent
d7c21322aa
commit
e67ea1e769
@ -342,6 +342,11 @@ public abstract class LocalPlayer {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public PlayerDirection getCardinalDirection() {
|
public PlayerDirection getCardinalDirection() {
|
||||||
|
if (getPitch() > 67.5)
|
||||||
|
return PlayerDirection.DOWN;
|
||||||
|
if (getPitch() < -67.5)
|
||||||
|
return PlayerDirection.UP;
|
||||||
|
|
||||||
// From hey0's code
|
// From hey0's code
|
||||||
double rot = (getYaw() - 90) % 360;
|
double rot = (getYaw() - 90) % 360;
|
||||||
if (rot < 0) {
|
if (rot < 0) {
|
||||||
|
@ -30,7 +30,9 @@ public enum PlayerDirection {
|
|||||||
SOUTH(new Vector(1, 0, 0), new Vector(0, 0, -1), true),
|
SOUTH(new Vector(1, 0, 0), new Vector(0, 0, -1), true),
|
||||||
SOUTH_WEST((new Vector(1, 0, 1)).normalize(), (new Vector(1, 0, -1)).normalize(), false),
|
SOUTH_WEST((new Vector(1, 0, 1)).normalize(), (new Vector(1, 0, -1)).normalize(), false),
|
||||||
WEST(new Vector(0, 0, 1), new Vector(1, 0, 0), true),
|
WEST(new Vector(0, 0, 1), new Vector(1, 0, 0), true),
|
||||||
NORTH_WEST((new Vector(-1, 0, 1)).normalize(), (new Vector(1, 0, 1)).normalize(), false);
|
NORTH_WEST((new Vector(-1, 0, 1)).normalize(), (new Vector(1, 0, 1)).normalize(), false),
|
||||||
|
UP(new Vector(0, 1, 0), new Vector(0, 0, 1), true),
|
||||||
|
DOWN(new Vector(0, -1, 0), new Vector(0, 0, 1), true);
|
||||||
|
|
||||||
private Vector dir;
|
private Vector dir;
|
||||||
private Vector leftDir;
|
private Vector leftDir;
|
||||||
@ -46,6 +48,7 @@ public enum PlayerDirection {
|
|||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public Vector leftVector() {
|
public Vector leftVector() {
|
||||||
return leftDir;
|
return leftDir;
|
||||||
}
|
}
|
||||||
|
@ -727,9 +727,9 @@ public class WorldEdit {
|
|||||||
xm += 1;
|
xm += 1;
|
||||||
} else if (dirStr.charAt(0) == 'n' || dir == PlayerDirection.NORTH) {
|
} else if (dirStr.charAt(0) == 'n' || dir == PlayerDirection.NORTH) {
|
||||||
xm -= 1;
|
xm -= 1;
|
||||||
} else if (dirStr.charAt(0) == 'u') {
|
} else if (dirStr.charAt(0) == 'u' || dir == PlayerDirection.UP) {
|
||||||
ym += 1;
|
ym += 1;
|
||||||
} else if (dirStr.charAt(0) == 'd') {
|
} else if (dirStr.charAt(0) == 'd' || dir == PlayerDirection.DOWN) {
|
||||||
ym -= 1;
|
ym -= 1;
|
||||||
} else {
|
} else {
|
||||||
if (wasDetected) {
|
if (wasDetected) {
|
||||||
@ -787,9 +787,9 @@ public class WorldEdit {
|
|||||||
xm += 1;
|
xm += 1;
|
||||||
} else if (dirStr.charAt(0) == 'n' || dir == PlayerDirection.NORTH) {
|
} else if (dirStr.charAt(0) == 'n' || dir == PlayerDirection.NORTH) {
|
||||||
xm -= 1;
|
xm -= 1;
|
||||||
} else if (dirStr.charAt(0) == 'u') {
|
} else if (dirStr.charAt(0) == 'u' || dir == PlayerDirection.UP) {
|
||||||
ym += 1;
|
ym += 1;
|
||||||
} else if (dirStr.charAt(0) == 'd') {
|
} else if (dirStr.charAt(0) == 'd' || dir == PlayerDirection.DOWN) {
|
||||||
ym -= 1;
|
ym -= 1;
|
||||||
} else {
|
} else {
|
||||||
if (wasDetected) {
|
if (wasDetected) {
|
||||||
@ -828,9 +828,9 @@ public class WorldEdit {
|
|||||||
return CuboidClipboard.FlipDirection.NORTH_SOUTH;
|
return CuboidClipboard.FlipDirection.NORTH_SOUTH;
|
||||||
} else if (dirStr.charAt(0) == 'n' || dir == PlayerDirection.NORTH) {
|
} else if (dirStr.charAt(0) == 'n' || dir == PlayerDirection.NORTH) {
|
||||||
return CuboidClipboard.FlipDirection.NORTH_SOUTH;
|
return CuboidClipboard.FlipDirection.NORTH_SOUTH;
|
||||||
} else if (dirStr.charAt(0) == 'u') {
|
} else if (dirStr.charAt(0) == 'u' || dir == PlayerDirection.UP) {
|
||||||
return CuboidClipboard.FlipDirection.UP_DOWN;
|
return CuboidClipboard.FlipDirection.UP_DOWN;
|
||||||
} else if (dirStr.charAt(0) == 'd') {
|
} else if (dirStr.charAt(0) == 'd' || dir == PlayerDirection.DOWN) {
|
||||||
return CuboidClipboard.FlipDirection.UP_DOWN;
|
return CuboidClipboard.FlipDirection.UP_DOWN;
|
||||||
} else {
|
} else {
|
||||||
throw new UnknownDirectionException(dir.name());
|
throw new UnknownDirectionException(dir.name());
|
||||||
|
Loading…
Reference in New Issue
Block a user