From 15478690a0faf85c1ee7e4d0046b71ccde02df21 Mon Sep 17 00:00:00 2001 From: Adam Stringer Date: Wed, 28 Jun 2023 04:20:48 +0100 Subject: [PATCH] Fix/init heightmaps before use (#258) * fix: init heightmaps map before use if nil --- level/chunk.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/level/chunk.go b/level/chunk.go index 8d258b1..24d6ded 100644 --- a/level/chunk.go +++ b/level/chunk.go @@ -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()