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

updateSkyBrightness() is not used client-side, causing multiple issues

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w40a
    • 1.19.3, 23w05a, 23w06a, 23w07a, 1.19.4 Pre-release 1, 1.19.4 Pre-release 2, 1.19.4, 23w16a, 1.20, 1.20.1, 1.20.2, 23w45a, 1.20.3, 24w11a, 1.20.5, 1.21, 24w36a
    • None
    • Confirmed
    • Rendering
    • Low
    • Platform

      This is a very old bug, but I think it wasn't reported before, since it is really hard to spot the difference between old, expected behavior and the new one. This used to happen since Beta 1.8 pre-release, but only on multiplayer. After 1.3, which made single player worlds server-side, it also affects singleplayer.

      Technical Review (code analysis)

      Prior to Beta 1.8, the skyDarken field present on Level.java used to be updated client-side to check for updating all chunk's render sky brigtness. This was removed on Beta 1.8 because apparently wasn't used anymore for the client. However, it is used in getMaxLocalRawBrightness to subtract the gotten sky light with the night light level reduction.

      Method getMaxLocalRawBrightness(BlockPos), present in LevelReader.java. For the client, it is used at:

      • ScreenEffectRenderer.java to calculate the water overlay brightness, method renderWater.
      • EntityRendererDispatcher.java to calculate the shadow strenght (or if it is necessary to render), method renderBlockShadow.
      • Gui.java to update vignette brightness, method updateVignetteBrightness.

      This bug it is really easy to fix, as it only requires to use updateSkyBrightness at ClientLevel.java's tick(BooleanSupplier) just like in ServerLevel.java.

      For everyone to understand

      This bug basically makes 'water overlay'/vignette/'entity shadows' to render as if it was day (full bright), when you're directly under skylight at night. For better understanding, see the images attached below

       

        1. Underwater Before.png
          Underwater Before.png
          371 kB
        2. Vignette After.png
          Vignette After.png
          287 kB
        3. Shadows Before.png
          Shadows Before.png
          308 kB
        4. Shadows After.png
          Shadows After.png
          286 kB
        5. Underwater After.png
          Underwater After.png
          385 kB
        6. Vignette Before.png
          Vignette Before.png
          506 kB

            Unassigned Unassigned
            ISRosillo14 Ismael Rosillo
            Votes:
            17 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: