Fix/init heightmaps before use (#258)

* fix: init heightmaps map before use if nil
This commit is contained in:
Adam Stringer
2023-06-28 04:20:48 +01:00
committed by GitHub
parent 2c3bab9a98
commit 15478690a0

View File

@ -190,6 +190,9 @@ func ChunkToSave(c *Chunk, dst *save.Chunk) (err error) {
s.BlockLight = v.BlockLight s.BlockLight = v.BlockLight
} }
dst.Sections = sections dst.Sections = sections
if dst.Heightmaps == nil {
dst.Heightmaps = make(map[string][]uint64)
}
dst.Heightmaps["WORLD_SURFACE_WG"] = c.HeightMaps.WorldSurfaceWG.Raw() dst.Heightmaps["WORLD_SURFACE_WG"] = c.HeightMaps.WorldSurfaceWG.Raw()
dst.Heightmaps["WORLD_SURFACE"] = c.HeightMaps.WorldSurface.Raw() dst.Heightmaps["WORLD_SURFACE"] = c.HeightMaps.WorldSurface.Raw()
dst.Heightmaps["OCEAN_FLOOR_WG"] = c.HeightMaps.OceanFloorWG.Raw() dst.Heightmaps["OCEAN_FLOOR_WG"] = c.HeightMaps.OceanFloorWG.Raw()