Finish removal of PlayerDirection, and partially added diagonal support back to commands. (Other minor changes to WorldEdit-Sponge and FAVS)

This commit is contained in:
Matthew Miller
2018-11-12 12:38:13 +10:00
committed by IronApollo
parent 13bf8429ce
commit f3c633582e
18 changed files with 123 additions and 148 deletions

View File

@ -20,7 +20,6 @@
package com.sk89q.worldedit.extension.platform;
import com.sk89q.worldedit.NotABlockException;
import com.sk89q.worldedit.PlayerDirection;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.entity.Player;
@ -28,6 +27,7 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TargetBlock;
@ -71,25 +71,25 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
* @param rot yaw
* @return the direction
*/
private static PlayerDirection getDirection(double rot) {
private static Direction getDirection(double rot) {
if (0 <= rot && rot < 22.5) {
return PlayerDirection.SOUTH;
return Direction.SOUTH;
} else if (22.5 <= rot && rot < 67.5) {
return PlayerDirection.SOUTH_WEST;
return Direction.SOUTHWEST;
} else if (67.5 <= rot && rot < 112.5) {
return PlayerDirection.WEST;
return Direction.WEST;
} else if (112.5 <= rot && rot < 157.5) {
return PlayerDirection.NORTH_WEST;
return Direction.NORTHWEST;
} else if (157.5 <= rot && rot < 202.5) {
return PlayerDirection.NORTH;
return Direction.NORTH;
} else if (202.5 <= rot && rot < 247.5) {
return PlayerDirection.NORTH_EAST;
return Direction.NORTHEAST;
} else if (247.5 <= rot && rot < 292.5) {
return PlayerDirection.EAST;
return Direction.EAST;
} else if (292.5 <= rot && rot < 337.5) {
return PlayerDirection.SOUTH_EAST;
return Direction.SOUTHEAST;
} else if (337.5 <= rot && rot < 360.0) {
return PlayerDirection.SOUTH;
return Direction.SOUTH;
} else {
return null;
}
@ -377,17 +377,17 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
}
@Override
public PlayerDirection getCardinalDirection() {
public Direction getCardinalDirection() {
return getCardinalDirection(0);
}
@Override
public PlayerDirection getCardinalDirection(int yawOffset) {
public Direction getCardinalDirection(int yawOffset) {
if (getLocation().getPitch() > 67.5) {
return PlayerDirection.DOWN;
return Direction.DOWN;
}
if (getLocation().getPitch() < -67.5) {
return PlayerDirection.UP;
return Direction.UP;
}
// From hey0's code