Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 10:30:04 +01:00
Use Location.getYaw() and getPitch() for converting to Bukkit Locations.
Dieser Commit ist enthalten in:
Ursprung
bdd6d20013
Commit
f50c69ee8f
@ -91,16 +91,11 @@ final class BukkitAdapter {
|
||||
public static org.bukkit.Location adapt(Location location) {
|
||||
checkNotNull(location);
|
||||
Vector position = location.toVector();
|
||||
Vector direction = location.getDirection();
|
||||
final double eyeX = direction.getX();
|
||||
final double eyeZ = direction.getZ();
|
||||
final float yaw = (float) Math.toDegrees(Math.atan2(-eyeX, eyeZ));
|
||||
final double length = Math.sqrt(eyeX * eyeX + eyeZ * eyeZ);
|
||||
final float pitch = (float) Math.toDegrees(Math.atan2(-direction.getY(), length));
|
||||
return new org.bukkit.Location(
|
||||
adapt((World) location.getExtent()),
|
||||
position.getX(), position.getY(), position.getZ(),
|
||||
yaw, pitch);
|
||||
(float) Math.toDegrees(location.getYaw()),
|
||||
(float) Math.toDegrees(location.getPitch()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren