Update player's yaw/pitch during client tick as well as render tick
@@ -193,6 +193,15 @@ public class CommandForWheeledRobotNavigationImplementation extends CommandBase
mYaw += deltaYaw;
mCameraPitch += deltaPitch;
mCameraPitch = (mCameraPitch < -90) ? -90 : (mCameraPitch > 90 ? 90 : mCameraPitch); // Clamp to [-90, 90]
+
+ // And update the player:
+ EntityPlayerSP player = Minecraft.getMinecraft().player;
+ if (player != null)
+ {
+ player.rotationPitch = this.mCameraPitch;
+ player.rotationYaw = this.mYaw;
+ }
+
}
@Override
@@ -282,14 +291,8 @@ public class CommandForWheeledRobotNavigationImplementation extends CommandBase
if (ev.phase == Phase.START)
{
if (this.isOverriding())
- {
- EntityPlayerSP player = Minecraft.getMinecraft().player;
- if (player != null)
{
updateYawAndPitch();
- player.rotationPitch = this.mCameraPitch;
- player.rotationYaw = this.mYaw;
- }
}
}
}
