Skip to content

Chunk Generator Block Pop Section

Shane Bee edited this page Jun 10, 2024 · 14 revisions

In this section, we can decorate our chunk.
This section is called once per chunk.
This step is the last step in chunk generation. When this is called, blocks/biomes have been determined.

AVAILABLE SYNTAXES:

Let's talk about some of the available expressions/effects we have that work in this section.

Highest Block Y Expression:

chunk[ ]data highest [block] y at %vector%

This expression allows us to grab the highest block Y at a specific coords.
We can use this to determine where to place a structure or grow a tree.
NOTE: The vector represents a chunk position (0 to 15), not a world position.

ChunkData Biome Expression:

chunk[ ]data biome at %vector%

This expression is used to determine which biome is located at a specific position.
You can use this to determine which blocks/structures to place based on biomes.
NOTE: The vector represents a chunk position (0 to 15), not a world position.

ChunkData BlockData Expression:

chunk[ ]data block[data] at %vector% 

Represents BlockData of blocks in a ChunkData.
This can be used to get/set BlockData when decorating your chunk (ex: trees, bushes).
NOTE: The vector represents a chunk position (0 to 15), not a world position.
You CAN reach into neighbouring chunks by going below 0/above 15 in the vector.
I'm unsure how far you can reach, so use this liberally.

ChunkData Structure Place Effect:

place chunk[ ]data structure %structure% at %vector%

This effect allows us to place structures in our chunk.
This differs from the standard effect for placing structures as it doesn't take in a location.
NOTE: The vector represents a chunk position (0 to 15), not a world position.

Populate Tree Effect:

populate %bukkittreetype% at %vectors%

This effect allows us to populate trees in our chunk.
NOTE: The vector represents a chunk position (0 to 15), not a world position.

Caution

Do NOT use Skript's grow tree effect in this section. It will crash your server.

EXAMPLE:

In this simple example, we're randomly placing a structure in the chunk.
(The structure is loaded earlier in an on load event)

block pop:
	chance of 25%:
		# We start off by getting the x/z of a random block in the chunk
		set {_x} to (random integer between 0 and 15)
		set {_z} to (random integer between 0 and 15)

		# We will grab the highest Y so we can determine where to place our structure
		set {_y} to chunkdata highest y at vector({_x}, 0, {_z}) + 1

		# We can now use this data to get the biome of the block where we want to place a structure
		set {_biome} to chunk data biome at vector({_x}, {_y}, {_z})
		
		# We can now place a structure at this location
		# We can change the structure based on which biome we have here
		if {_biome} != desert:
			# Example of populating in all biomes that are not desert
			populate cherry tree at vector({_x}, {_y}, {_z})
		else:
			# Example of populating a structure in a desert biome
			place chunkdata structure {-structure::stone_blob} at vector({_x}, {_y}, {_z})

Clone this wiki locally