Skip to content

Commit

Permalink
Fix/init heightmaps before use (#258)
Browse files Browse the repository at this point in the history
* fix: init heightmaps map before use if nil
  • Loading branch information
tauraamui authored Jun 28, 2023
1 parent 2c3bab9 commit 1547869
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions level/chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ func ChunkToSave(c *Chunk, dst *save.Chunk) (err error) {
s.BlockLight = v.BlockLight
}
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"] = c.HeightMaps.WorldSurface.Raw()
dst.Heightmaps["OCEAN_FLOOR_WG"] = c.HeightMaps.OceanFloorWG.Raw()
Expand Down

0 comments on commit 1547869

Please sign in to comment.