Minecraft Data Packs / World Generation

Staggered World Gen Lib

  • check_circle Advancements
  • check_circle Functions
  • check_circle Predicates
  • 14,464 views, 2 today
  • 3,968 downloads, 0 today
  • 38
  • 32
Deprecated avatar Deprecated
Level 76 : Legendary Modder
Support and development on this data pack are discontinued.

This data pack is a library; it is intended to be used by other data packs and not on its own.

Staggered World Gen Lib (Stagger Gen) allows all the data packs that use it to generate together in the same chunks without conflicting. In addition to this, adding a data pack that uses Stagger Gen to a world that already has chunks generated in by another data pack that uses Stagger Gen will allow the new data pack to do its world generation in the already generated chunks.

The main benefit of using Stagger Gen to manage your world generation is that generation is staggered to only effect 4 chunks per player per tick in a 9x9 area around them, greatly reducing the impact on performance. Another method used to reduce the impact on performance is that world generation only happens when a player moves into a new chunk, which means players who are afk don't impact performance.

Stagger Gen can add world generation to both the Overworld and the Nether, although it doesn't add world generation functionality to the End due to the way it records which chunks it has generated in.

Stagger Gen is not compatible with any data pack that changes the bedrock layer at Y0 out for another block, which includes most other world gen data packs that don't use Stagger Gen.

How to use Stagger Gen to add world generation to your data pack
The Stagger Gen data pack needs to be present in the same world as your data pack for its functionality to be available to your data pack.

The functions in the #stagger_gen:overworld/new_chunk and #stagger_gen:nether/new_chunk function tags are executed once per second per chunk in the 9x9 chunk area around every player that is currently moving between chunks (which one is executed depends on which dimension each player is in). These functions are executed positioned at Y0, with the lowest x and z coordinates within the given chunk.

The functions you add to either of these tags will need to check whether your data pack has already generated within a given chunk, and record the fact that they've generated. This is done with NBT data on an item in a barrel at the bottom of the world within each chunk; e.g. for my Underground Overhaul data pack I use the following command to check if it's already generated in a given chunk, and if not, to call all its world generation functions for a new chunk: execute if block ~ 0 ~ minecraft:barrel unless data block ~ 0 ~ Items[​0].tag.under_over run function #under_over:new_chunk . Underground Overhaul also records that it's generated in a chunk with the following command: data modify block ~ 0 ~ Items[​0].tag merge value {under_over:1b} , which simply adds a boolean nbt value to the item in the barrel for later checking, but you could store more complex data if you want to track which features of your data pack have generated in a given chunk, or which version it was that generated in a given chunk, or any other data about the chunk you might want to track.

Stagger Gen also comes with a few functions to help you place structures or world features in the Overworld (although they can be used in any dimension). These functions are meant to be executed as a placeholder entity so you can summon your marker entity, run the desired function to move it into position, and then execute at the entity to place your structure or feature. The functions, and their effects, are as follows;
  • stagger_gen:overworld/find_surface will move the marker entity to the highest block in the world at the current x & z coordinates, but will ignore trees and plants (i.e. it will place the entity underneath trees, if there are any at its x & z coordiantes).
It is recommended that you use the spreadplayers command if you want to randomise the x and z coordinates of where your structure/feature will generate. It can also be used to find caves in 1.16 with the new "under" condition.

If you have any questions about Stagger Gen, or would like any help using it to add world generation to your data pack, please feel free to message me.
CompatibilityMinecraft 1.16

5 Update Logs

Version 6 : by Deprecated 09/26/2020 4:21:15 pmSep 26th, 2020

  • Refactored some of the code to make it more efficient, so it should hopefully run a little more efficiently.
Comments have been disabled on this content.
Planet Minecraft


© 2010 - 2023