Hi, I am trying make a game like Minecraft but have trouble making the terrain[ Hills , Mountains , etc ] and making the dirt blocks below the Grass Blocks

Here's The Source Code
extends Spatial
enum Blocks {Dirt,Grass,Stone}
var groundsize = Vector3(10,10,10)
var nextchunk_coord = Vector3(0,0,0)
var noise
onready var map = $World/GridMap
func ready():
randomize()
noise = OpenSimplexNoise.new()
noise.seed = randi()
noise.octaves = 3
noise.period = 18
noise.persistence = 0.8
chunk(groundsize.x,groundsize.y,groundsize.z)
func chunk(chunkwidth,chunklength,chunkdepth):
for x in chunkwidth:
for y in chunkdepth:
for z in chunklength:
var final = 0
var a = noise.getnoise3d(x,y,z + nextchunkcoord.z)
#var a = noise.getnoise1d(y)
if a < 0.02:
final = Blocks.Dirt
elif a >=0.02 and a < 0.4 :
final = Blocks.Grass
elif a >=0.4 and a < 0.7:
final = Blocks.Stone
else:
final = Blocks.empty()
for num in range(0,z):
map.setcellitem(x,y,z + nextchunkcoord.z,final)
nextchunkcoord.z += chunk_length
I only used Gridmaps and a camera(for the preview)