From 222ba33aa43dd1c2204375fd19960a1a0cab92a5 Mon Sep 17 00:00:00 2001 From: Wyatt Childers Date: Thu, 3 Mar 2016 20:31:44 -0500 Subject: [PATCH] Fixed Sponge implementation player rotations --- .../java/com/sk89q/worldedit/sponge/SpongeAdapter.java | 3 +-- .../java/com/sk89q/worldedit/sponge/SpongePlayer.java | 10 +++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java index b1eb2ebb2..92a81d380 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeAdapter.java @@ -35,8 +35,7 @@ final class SpongeAdapter { public static Location adapt(org.spongepowered.api.world.Location 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()); } } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java index 2b9af46d7..7a681a787 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java @@ -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 ) ); }