public override void handleFlying(Packet10Flying packet10flying) { field_22003_h = true; if (!hasMoved) { double d = packet10flying.yPosition - lastPosY; if (packet10flying.xPosition == lastPosX && d*d < 0.01D && packet10flying.zPosition == lastPosZ) { hasMoved = true; } } if (hasMoved) { if (playerEntity.ridingEntity != null) { float f = playerEntity.rotationYaw; float f1 = playerEntity.rotationPitch; playerEntity.ridingEntity.updateRiderPosition(); double d2 = playerEntity.posX; double d4 = playerEntity.posY; double d6 = playerEntity.posZ; double d8 = 0.0D; double d9 = 0.0D; if (packet10flying.rotating) { f = packet10flying.yaw; f1 = packet10flying.pitch; } if (packet10flying.moving && packet10flying.yPosition == -999D && packet10flying.stance == -999D) { d8 = packet10flying.xPosition; d9 = packet10flying.zPosition; } playerEntity.onGround = packet10flying.onGround; playerEntity.onUpdateEntity(true); playerEntity.moveEntity(d8, 0.0D, d9); playerEntity.setPositionAndRotation(d2, d4, d6, f, f1); playerEntity.motionX = d8; playerEntity.motionZ = d9; if (playerEntity.ridingEntity != null) { mcServer.worldMngr.func_12017_b(playerEntity.ridingEntity, true); } if (playerEntity.ridingEntity != null) { playerEntity.ridingEntity.updateRiderPosition(); } mcServer.configManager.func_613_b(playerEntity); lastPosX = playerEntity.posX; lastPosY = playerEntity.posY; lastPosZ = playerEntity.posZ; mcServer.worldMngr.updateEntity(playerEntity); return; } double d1 = playerEntity.posY; lastPosX = playerEntity.posX; lastPosY = playerEntity.posY; lastPosZ = playerEntity.posZ; double d3 = playerEntity.posX; double d5 = playerEntity.posY; double d7 = playerEntity.posZ; float f2 = playerEntity.rotationYaw; float f3 = playerEntity.rotationPitch; if (packet10flying.moving && packet10flying.yPosition == -999D && packet10flying.stance == -999D) { packet10flying.moving = false; } if (packet10flying.moving) { d3 = packet10flying.xPosition; d5 = packet10flying.yPosition; d7 = packet10flying.zPosition; double d10 = packet10flying.stance - packet10flying.yPosition; if (d10 > 1.6499999999999999D || d10 < 0.10000000000000001D) { kickPlayer("Illegal stance"); logger.warning( (new StringBuilder()).append(playerEntity.username).append(" had an illegal stance: "). append(d10).toString()); } } if (packet10flying.rotating) { f2 = packet10flying.yaw; f3 = packet10flying.pitch; } playerEntity.onUpdateEntity(true); playerEntity.ySize = 0.0F; playerEntity.setPositionAndRotation(lastPosX, lastPosY, lastPosZ, f2, f3); double d11 = d3 - playerEntity.posX; double d12 = d5 - playerEntity.posY; double d13 = d7 - playerEntity.posZ; float f4 = 0.0625F; bool flag = mcServer.worldMngr.getCollidingBoundingBoxes(playerEntity, playerEntity.boundingBox.copy().func_694_e(f4, f4, f4)) .size() == 0; playerEntity.moveEntity(d11, d12, d13); d11 = d3 - playerEntity.posX; d12 = d5 - playerEntity.posY; if (d12 > -0.5D || d12 < 0.5D) { d12 = 0.0D; } d13 = d7 - playerEntity.posZ; double d14 = d11*d11 + d12*d12 + d13*d13; bool flag1 = false; if (d14 > 0.0625D && !playerEntity.isPlayerSleeping()) { flag1 = true; logger.warning( (new StringBuilder()).append(playerEntity.username).append(" moved wrongly!").toString()); [email protected]( (new StringBuilder()).append("Got position ").append(d3).append(", ").append(d5).append(", "). append(d7).toString()); [email protected]( (new StringBuilder()).append("Expected ").append(playerEntity.posX).append(", ").append( playerEntity.posY).append(", ").append(playerEntity.posZ).toString()); } playerEntity.setPositionAndRotation(d3, d5, d7, f2, f3); bool flag2 = mcServer.worldMngr.getCollidingBoundingBoxes(playerEntity, playerEntity.boundingBox.copy().func_694_e(f4, f4, f4)) .size() == 0; if (flag && (flag1 || !flag2) && !playerEntity.isPlayerSleeping()) { teleportTo(lastPosX, lastPosY, lastPosZ, f2, f3); return; } playerEntity.onGround = packet10flying.onGround; mcServer.configManager.func_613_b(playerEntity); playerEntity.handleFalling(playerEntity.posY - d1, packet10flying.onGround); } }
public override void handleFlying(Packet10Flying packet10flying) { field_22003_h = true; if (!hasMoved) { double d = packet10flying.yPosition - lastPosY; if (packet10flying.xPosition == lastPosX && d * d < 0.01D && packet10flying.zPosition == lastPosZ) { hasMoved = true; } } if (hasMoved) { if (playerEntity.ridingEntity != null) { float f = playerEntity.rotationYaw; float f1 = playerEntity.rotationPitch; playerEntity.ridingEntity.updateRiderPosition(); double d2 = playerEntity.posX; double d4 = playerEntity.posY; double d6 = playerEntity.posZ; double d8 = 0.0D; double d9 = 0.0D; if (packet10flying.rotating) { f = packet10flying.yaw; f1 = packet10flying.pitch; } if (packet10flying.moving && packet10flying.yPosition == -999D && packet10flying.stance == -999D) { d8 = packet10flying.xPosition; d9 = packet10flying.zPosition; } playerEntity.onGround = packet10flying.onGround; playerEntity.onUpdateEntity(true); playerEntity.moveEntity(d8, 0.0D, d9); playerEntity.setPositionAndRotation(d2, d4, d6, f, f1); playerEntity.motionX = d8; playerEntity.motionZ = d9; if (playerEntity.ridingEntity != null) { mcServer.worldMngr.func_12017_b(playerEntity.ridingEntity, true); } if (playerEntity.ridingEntity != null) { playerEntity.ridingEntity.updateRiderPosition(); } mcServer.configManager.func_613_b(playerEntity); lastPosX = playerEntity.posX; lastPosY = playerEntity.posY; lastPosZ = playerEntity.posZ; mcServer.worldMngr.updateEntity(playerEntity); return; } double d1 = playerEntity.posY; lastPosX = playerEntity.posX; lastPosY = playerEntity.posY; lastPosZ = playerEntity.posZ; double d3 = playerEntity.posX; double d5 = playerEntity.posY; double d7 = playerEntity.posZ; float f2 = playerEntity.rotationYaw; float f3 = playerEntity.rotationPitch; if (packet10flying.moving && packet10flying.yPosition == -999D && packet10flying.stance == -999D) { packet10flying.moving = false; } if (packet10flying.moving) { d3 = packet10flying.xPosition; d5 = packet10flying.yPosition; d7 = packet10flying.zPosition; double d10 = packet10flying.stance - packet10flying.yPosition; if (d10 > 1.6499999999999999D || d10 < 0.10000000000000001D) { kickPlayer("Illegal stance"); logger.warning( (new StringBuilder()).append(playerEntity.username).append(" had an illegal stance: "). append(d10).toString()); } } if (packet10flying.rotating) { f2 = packet10flying.yaw; f3 = packet10flying.pitch; } playerEntity.onUpdateEntity(true); playerEntity.ySize = 0.0F; playerEntity.setPositionAndRotation(lastPosX, lastPosY, lastPosZ, f2, f3); double d11 = d3 - playerEntity.posX; double d12 = d5 - playerEntity.posY; double d13 = d7 - playerEntity.posZ; float f4 = 0.0625F; bool flag = mcServer.worldMngr.getCollidingBoundingBoxes(playerEntity, playerEntity.boundingBox.copy().func_694_e(f4, f4, f4)) .size() == 0; playerEntity.moveEntity(d11, d12, d13); d11 = d3 - playerEntity.posX; d12 = d5 - playerEntity.posY; if (d12 > -0.5D || d12 < 0.5D) { d12 = 0.0D; } d13 = d7 - playerEntity.posZ; double d14 = d11 * d11 + d12 * d12 + d13 * d13; bool flag1 = false; if (d14 > 0.0625D && !playerEntity.isPlayerSleeping()) { flag1 = true; logger.warning( (new StringBuilder()).append(playerEntity.username).append(" moved wrongly!").toString()); [email protected]( (new StringBuilder()).append("Got position ").append(d3).append(", ").append(d5).append(", "). append(d7).toString()); [email protected]( (new StringBuilder()).append("Expected ").append(playerEntity.posX).append(", ").append( playerEntity.posY).append(", ").append(playerEntity.posZ).toString()); } playerEntity.setPositionAndRotation(d3, d5, d7, f2, f3); bool flag2 = mcServer.worldMngr.getCollidingBoundingBoxes(playerEntity, playerEntity.boundingBox.copy().func_694_e(f4, f4, f4)) .size() == 0; if (flag && (flag1 || !flag2) && !playerEntity.isPlayerSleeping()) { teleportTo(lastPosX, lastPosY, lastPosZ, f2, f3); return; } playerEntity.onGround = packet10flying.onGround; mcServer.configManager.func_613_b(playerEntity); playerEntity.handleFalling(playerEntity.posY - d1, packet10flying.onGround); } }