Revert "Fix /player look and turn commands reversing yaw and pitch (#1689)"
This reverts commit 591153458c.
This commit is contained in:
2 files changed
+17
-16
No files matched your search
@@ -87,9 +87,9 @@ public class PlayerCommand
|
||||
.then(argument("direction", RotationArgument.rotation())
|
||||
.executes(c -> manipulate(c, ap -> ap.look(RotationArgument.getRotation(c, "direction").getRotation(c.getSource())))))
|
||||
).then(literal("turn")
|
||||
.then(literal("left").executes(c -> manipulate(c, ap -> ap.turn(0, -90))))
|
||||
.then(literal("right").executes(c -> manipulate(c, ap -> ap.turn(0, 90))))
|
||||
.then(literal("back").executes(c -> manipulate(c, ap -> ap.turn(0, 180))))
|
||||
.then(literal("left").executes(c -> manipulate(c, ap -> ap.turn(-90, 0))))
|
||||
.then(literal("right").executes(c -> manipulate(c, ap -> ap.turn(90, 0))))
|
||||
.then(literal("back").executes(c -> manipulate(c, ap -> ap.turn(180, 0))))
|
||||
.then(argument("rotation", RotationArgument.rotation())
|
||||
.executes(c -> manipulate(c, ap -> ap.turn(RotationArgument.getRotation(c, "rotation").getRotation(c.getSource())))))
|
||||
).then(literal("move").executes(c -> manipulate(c, EntityPlayerActionPack::stopMovement))
|
||||
|
||||
@@ -112,26 +112,27 @@ public class EntityPlayerActionPack
|
||||
}
|
||||
public EntityPlayerActionPack look(Direction direction)
|
||||
{
|
||||
return switch (direction)
|
||||
switch (direction)
|
||||
{
|
||||
case NORTH -> look(0, 180);
|
||||
case SOUTH -> look(0, 0);
|
||||
case EAST -> look(0, -90);
|
||||
case WEST -> look(0, 90);
|
||||
case UP -> look(-90, player.getYRot());
|
||||
case DOWN -> look(90, player.getYRot());
|
||||
};
|
||||
case NORTH: return look(180, 0);
|
||||
case SOUTH: return look(0, 0);
|
||||
case EAST: return look(-90, 0);
|
||||
case WEST: return look(90, 0);
|
||||
case UP: return look(player.getYRot(), -90);
|
||||
case DOWN: return look(player.getYRot(), 90);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public EntityPlayerActionPack look(Vec2 rotation)
|
||||
{
|
||||
return look(rotation.x, rotation.y);
|
||||
}
|
||||
|
||||
public EntityPlayerActionPack look(float pitch, float yaw)
|
||||
public EntityPlayerActionPack look(float yaw, float pitch)
|
||||
{
|
||||
player.setXRot(Mth.clamp(pitch, -90, 90)); // setPitch
|
||||
player.setYRot(yaw % 360); //setYaw
|
||||
// maybe player.moveTo(player.getX(), player.getY(), player.getZ(), yaw, Mth.clamp(pitch,-90.0F, 90.0F));
|
||||
player.setXRot(Mth.clamp(pitch, -90, 90)); // setPitch
|
||||
// maybe player.setPositionAndAngles(player.x, player.y, player.z, yaw, MathHelper.clamp(pitch,-90.0F, 90.0F));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -141,9 +142,9 @@ public class EntityPlayerActionPack
|
||||
return this;
|
||||
}
|
||||
|
||||
public EntityPlayerActionPack turn(float pitch, float yaw)
|
||||
public EntityPlayerActionPack turn(float yaw, float pitch)
|
||||
{
|
||||
return look(player.getXRot() + pitch, player.getYRot() + yaw);
|
||||
return look(player.getYRot() + yaw, player.getXRot() + pitch);
|
||||
}
|
||||
|
||||
public EntityPlayerActionPack turn(Vec2 rotation)
|
||||
|
||||
Reference in new issue
Block a user