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

Heightmap min value not set when loading chunk from NBT

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.11.2, Minecraft 1.12.2, Minecraft 1.13.2
    • Fix Version/s: None
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      The bug

      Note: The following is based on decompiled code, using MCP naming.

      The minimum heightmap value for a chunk is currently set when the heightmap is populated either by chunk generation on the server, or by a chunk data packet being received by the client. However, it is not set when a chunk is read from NBT (see AnvilChunkLoader#readChunkFromNBT()).

      This means that server-side, any chunk not freshly generated will have a heightmap minimum of 0.
      The main effect of this is that lighting checks performed by Chunk#recheckGaps() will call World#checkLightFor() for all y-values between 0 and the heightmap value for that column (+1), instead of a reduced range.

      Possible fix

      The heightMapMinimum field should be updated when the heightmap is set in Chunk#setHeightMap(). For example:

      public void setHeightMap(int[] newHeightMap)
      {
          if (this.heightMap.length != newHeightMap.length)
          {
              LOGGER.warn("Could not set level chunk heightmap, array length is {} instead of {}", newHeightMap.length, this.heightMap.length);
          }
          else
          {
              System.arraycopy(newHeightMap, 0, this.heightMap, 0, this.heightMap.length);
              // *update heightmap min value here*
          }
      }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              quadraxis Ben Staddon
            • Votes:
              6 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                CHK: