mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Fixed Sponge implementation player rotations
This commit is contained in:
parent
f09fff9491
commit
222ba33aa4
@ -35,8 +35,7 @@ final class SpongeAdapter {
|
||||
|
||||
public static Location adapt(org.spongepowered.api.world.Location<org.spongepowered.api.world.World> loc, Vector3d rot) {
|
||||
Vector position = new Vector(loc.getX(), loc.getY(), loc.getZ());
|
||||
Vector dir = new Vector(rot.getX(), rot.getY(), rot.getZ());
|
||||
|
||||
return new Location(SpongeAdapter.adapt(loc.getExtent()), position, dir);
|
||||
return new Location(SpongeAdapter.adapt(loc.getExtent()), position, (float) rot.getY(), (float) rot.getX());
|
||||
}
|
||||
}
|
||||
|
@ -148,16 +148,12 @@ public class SpongePlayer extends AbstractPlayerActor {
|
||||
this.player.getWorld(), pos.getX(), pos.getY(), pos.getZ()
|
||||
);
|
||||
|
||||
double yawR = Math.toRadians(yaw);
|
||||
double pitchR = Math.toRadians(pitch);
|
||||
double xz = Math.cos(pitch);
|
||||
|
||||
this.player.setLocationAndRotation(
|
||||
loc,
|
||||
new Vector3d(
|
||||
-xz * Math.sin(yawR),
|
||||
-Math.sin(pitchR),
|
||||
xz * Math.cos(yawR)
|
||||
pitch,
|
||||
yaw,
|
||||
0
|
||||
)
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user