/**
* Handles changes in player positioning and rotation such as when travelling to a new dimension, (re)spawning,
* mounting horses etc. Seems to immediately reply to the server with the clients post-processing perspective on the
* player positioning
*/
public void handlePlayerPosLook(S08PacketPlayerPosLook packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
EntityPlayer entityplayer = this.gameController.thePlayer;
double d0 = packetIn.getX();
double d1 = packetIn.getY();
double d2 = packetIn.getZ();
float f = packetIn.getYaw();
float f1 = packetIn.getPitch();
if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.X)) {
d0 += entityplayer.posX;
} else {
entityplayer.motionX = 0.0D;
}
if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.Y)) {
d1 += entityplayer.posY;
} else {
entityplayer.motionY = 0.0D;
}
if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.Z)) {
d2 += entityplayer.posZ;
} else {
entityplayer.motionZ = 0.0D;
}
if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.X_ROT)) {
f1 += PlayerHandler.pitch;
}
if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.Y_ROT)) {
f += PlayerHandler.yaw;
}
final HeadLookEvent headLookEvent = new HeadLookEvent(f, f1, d0, d1, d2).publishItself();
final float yaw = f;
final float pitch = f1;
if (!headLookEvent.isCancelled())
entityplayer.setPositionAndRotation(headLookEvent.getX(), headLookEvent.getY(), headLookEvent.getZ(), headLookEvent.getYaw(), headLookEvent.getPitch());
PlayerHandler.yaw = yaw;
PlayerHandler.pitch = pitch;
this.netManager.sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(entityplayer.posX, entityplayer.getEntityBoundingBox().minY, entityplayer.posZ, yaw, pitch, false));
if (!this.doneLoadingTerrain) {
this.gameController.thePlayer.prevPosX = this.gameController.thePlayer.posX;
this.gameController.thePlayer.prevPosY = this.gameController.thePlayer.posY;
this.gameController.thePlayer.prevPosZ = this.gameController.thePlayer.posZ;
this.doneLoadingTerrain = true;
this.gameController.displayGuiScreen((GuiScreen) null);
}
}