Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-278298

player flickers when flying with elytra

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.21.3
    • None
    • Unconfirmed
    • (Unassigned)

      this is technically a duplicate of MC-142246, but that was closed as resolved, so I made this new one
      when flying wit an elytra at higher speeds with fireworks, the player starts to flicker

      this is caused by floating point inprecissions
      inĀ 

      net.minecraft.client.renderer.entity.player.PlayerRenderer#extractFlightData

      in this part

      if (d > 0.0 && d2 > 0.0) {
        playerRenderState.shouldApplyFlyingYRot = true;
        double d3 = (vec32.x * vec3.x + vec32.z * vec3.z) / Math.sqrt(d * d2);
        double d4 = vec32.x * vec3.z - vec32.z * vec3.x;
        playerRenderState.flyingYRot = (float)(Math.signum(d4) * Math.acos(d3));
      } 

      d3 can get sligthly above 1 (like 1.0000000000000002), which produces a NaN, because acos of >1 is NaN

            Unassigned Unassigned
            fayer3 Bayer Florian
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: