Created
February 18, 2017 15:43
-
-
Save konsolas/86463e4babd5f592ef5d21e12a982cac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 += entityplayer.rotationPitch; | |
} | |
if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.Y_ROT)) | |
{ | |
f += entityplayer.rotationYaw; | |
} | |
entityplayer.setPositionAndRotation(d0, d1, d2, f, f1); | |
this.netManager.sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(entityplayer.posX, entityplayer.getEntityBoundingBox().minY, entityplayer.posZ, entityplayer.rotationYaw, entityplayer.rotationPitch, 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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment