3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-09 13:00:05 +01:00

Added LocalPlayer.getCardinalDirection(int yawOffset)

Dieser Commit ist enthalten in:
TomyLobo 2011-10-25 01:02:50 +02:00
Ursprung a1fb1fd4e4
Commit 3962e6c9d8

Datei anzeigen

@ -349,6 +349,16 @@ public abstract class LocalPlayer {
* @return * @return
*/ */
public PlayerDirection getCardinalDirection() { public PlayerDirection getCardinalDirection() {
return getCardinalDirection(0);
}
/**
* Get the player's cardinal direction (N, W, NW, etc.) with an offset. May return null.
* @param yawOffset offset that is added to the player's yaw before determining the cardinal direction
*
* @return
*/
public PlayerDirection getCardinalDirection(int yawOffset) {
if (getPitch() > 67.5) { if (getPitch() > 67.5) {
return PlayerDirection.DOWN; return PlayerDirection.DOWN;
} }
@ -357,7 +367,7 @@ public abstract class LocalPlayer {
} }
// From hey0's code // From hey0's code
double rot = (getYaw() - 90) % 360; double rot = (getYaw() + yawOffset - 90) % 360;
if (rot < 0) { if (rot < 0) {
rot += 360.0; rot += 360.0;
} }