code: def generate_heightmap(self, buffer=False, as_array=False):
          
          non_solids = [0, 8, 9, 10, 11, 38, 37, 32, 31]
          if buffer:
              return BytesIO(pack(">i", 256)+self.generate_heightmap()) # Length + Heightmap, ready for insertion into Chunk NBT
          else:
              bytes = []
              for z in range(16):
                  for x in range(16):
                      for y in range(127, -1, -1):
                          offset = y + z*128 + x*128*16
                          if (self.blocksList[offset] not in non_solids or y == 0):
                              bytes.append(y+1)
                              break
              if (as_array):
                  return bytes
              else:
                  return array.array('B', bytes).tostring()
docs: Return a heightmap, representing the highest solid blocks in this chunk.