-
-
Notifications
You must be signed in to change notification settings - Fork 19
Chunk Generator Chunk Gen Section
Time to generate a chunk.
This section is called once per chunk.
Let's look at some available expression you can use in this section.
chunk[ ]data biome at %vector%This expression is used to get a biome at a specific point in the chunk.
You may want this to decide which block to place.
The vector represents a position in the chunk not a position in the world. (ie: x/z values are from 0-15)
chunk[ ]data block[data] at %vector%This expression is used to set a block in a chunk during generation.
Same as the biome expression, the vector represents a position in the chunk not in the world.
chunk[ ]data block[data]s (between|within) %vector% (and|to) %vector%Similar to the ChunkData Block expression, this can be used to quickly fill a bunch of blocks at once.
Same as the above expression, the vector represents a position in the chunk not in the world.
chunk[ ]data chunk (:x|z)This expression is used to the get X/Z coordinations of a chunk.
You can multiply this number by 16 to help get where in the world a block is located.
This can be used to help with noise generation.
In this example we're simply filling the underground layers with red concrete and setting the top surface layer to red concrete powder.
chunk gen:
loop 16 times:
loop 16 times:
set {_x} to (loop-number-1) - 1
set {_z} to (loop-number-2) - 1
# This is a custom expression I have created in my own script, this is not from SkBee
# This is just meant to give you an idea of how noise works
set {_n} to biome noise at vector({_x} + (chunkdata chunk x * 16), 1, {_z} + (chunkdata chunk z * 16))
# Now we set the blocks from 0 to our noise level filling in our world
set chunkdata blocks within vector({_x}, 0, {_z}) and vector({_x}, {_n}, {_z}) to red_concrete[]
# Now we set our surface layer
set chunkdata block at vector({_x}, {_n}, {_z}) to red_concrete_powder[]Here is how it looks in the world.

In this example we're doing a heck of a lot more work. Again using noise maps to be able to determine where blocks are going.
Also used in conjunction with a biome map to determine which blocks are placed per different types of biomes.
We also have an ocean/water layer in this as well.
chunk gen:
loop 16 times:
loop 16 times:
set {_x} to (loop-number-1) - 1
set {_z} to (loop-number-2) - 1
set {_n} to block noise at ({_x} + (16 * chunkdata chunk x)), ({_z} + (16 * chunkdata chunk z))
set {_top} to {_n} if {_n} > 64 else 64
# Fill stone
set chunkdata blocks between vector({_x},-64,{_z}) and vector(({_x}),({_n}),({_z})) to stone[]
# Place surface
loop integers between {_n} and {_top}:
set {_y} to loop-number-3
set {_biome} to calculated biome at vector({_x} + (16 * chunkdata chunk x), {_y}, {_z} + (16 * chunkdata chunk z))
# Surface
if {_y} = {_n}:
if {_y} > 64:
if {_biome} = desert, badlands or beach:
set {_data} to sand[]
else if all:
{_biome} = mangrove swamp
chance of 45%
then:
set {_data} to mud[]
else:
set {_data} to grass_block[]
else:
set {_data} to sand[]
# Water
else if all:
{_y} > {_n}
{_y} < 64
then:
set {_data} to water[]
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-4
set chunkdata block at vector({_x}, {_y} - {_yy}, {_z}) to {_below}
delete {_data}
delete {_below}Here is how it looks in game:
