Translations:Lagback/27/zh
在單人遊戲中,回彈是由這部分代碼引起的(高度簡化,我們忽略了飛行、睡眠、傳送、重生、加載實體等異常情況......):<syntaxhighlight lang="java" line="1"> //位於 NetHandlerPlayServer.java public void processPlayer(PacketPlayer packetIn) {
double posY_original = this.playerEntity.posY; this.lastPosX = this.playerEntity.posX; this.lastPosY = this.playerEntity.posY; this.lastPosZ = this.playerEntity.posZ; double next_posX = packetIn.getPositionX(); double next_posY = packetIn.getPositionY(); double next_posZ = packetIn.getPositionZ(); float yaw = this.playerEntity.rotationYaw; float pitch = this.playerEntity.rotationPitch; if (packetIn.getRotating()) {yaw = packetIn.getYaw(); pitch = packetIn.getPitch();}