Chunk Generator Surface Gen Section - ShaneBeee/SkBee GitHub Wiki

After we're done creating our noise terrain, let's give our surface a little love.

Expressions:

You can use the same expressions from Noise Gen.

Examples:

Working from our same code for the Noise Gen section, we'll apply a top layer surface.

surface gen:
	loop integers between 0 and 15:
		loop integers between 0 and 15:
			set {_x} to (loop-number-1)
			set {_z} to (loop-number-2)

			# Let's get our original noise so we know where the top is
			set {_y} to block noise at ({_x} + (16 * chunkdata chunk x)), ({_z} + (16 * chunkdata chunk z))

			# We also want to get our biome so we can place biome appropriate blocks
			set {_biome} to calculated biome at vector({_x} + (16 * chunkdata chunk x), {_y}, {_z} + (16 * chunkdata chunk z))

			# Place surface
			if any:
				{_biome} = desert, badlands or beach
				{_biome} = biome registry tag key "is_ocean"
			then:
				set {_data} to sand[]
			else if all:
				{_biome} = mangrove swamp
				chance of 45%
			then:
				set {_data} to mud[]
			else:
				set {_data} to grass_block[]

			if {_data} is set:
				set chunkdata block at vector({_x}, {_y}, {_z}) to {_data}
				if {_data} is grass_block[] or mud[]:
					set {_below} to dirt[]
				else if {_data} is sand[]:
					set {_below} to sandstone[]
				if {_below} is set:
					loop 3 times:
						set {_yy} to loop-number-3
						set chunkdata block at vector({_x}, {_y} - {_yy}, {_z}) to {_below}
				delete {_data}
				delete {_below}

How it looks:

Same view but with vanilla decor turned on: