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();}