func (sh *SimplexHills) Chunk(cc coords.Chunk) *mapgen.Chunk { // Build the height map hMap := make([][]int, coords.ChunkWidth) for x := range hMap { hMap[x] = make([]int, coords.ChunkDepth) for z := range hMap[x] { oc := coords.Offset{X: x, Y: 0, Z: z} bc := oc.Block(cc) hMap[x][z] = int(sh.heightAt(float64(bc.X), float64(bc.Z))) } } chunk := &mapgen.Chunk{} for ocX := 0; ocX < coords.ChunkWidth; ocX++ { for ocY := 0; ocY < coords.ChunkHeight; ocY++ { for ocZ := 0; ocZ < coords.ChunkDepth; ocZ++ { oc := coords.Offset{X: ocX, Y: ocY, Z: ocZ} bc := oc.Block(cc) block := sh.block(bc, hMap[oc.X][oc.Z]) chunk.SetBlock(oc, block) } } } return chunk }