/world-pregen

Minecraft datapack: Pre-generate a Minecraft world before playing

Primary Languagemcfunction

world-pregen

Minecraft datapack: Pre-generate a Minecraft world before playing

How to use:

  • Drop the datapack into your world's datapacks folder. The usual path is .minecraft/saves/<world>/datapacks for singleplayer or world/datapacks for servers.
  • Type /reload or restart your world to enable the datapack.

To pregen the world:

  • Set your render distance to 5 chunks or greater.
  • Run /function pregen:config
  • Select your origin point. Usually you want this to be 0,0 but if you want to generate terrain centered far from 0,0, you can change it here.
  • Select the radius. This is not a circular radius but simply the distance in each axis you want to generate from the origin. e.g. a 5000 radius will approximately generate a 10k*10k area, 5000 blocks in each direction.
  • Select the dimension you want to generate.
  • Click [Refresh] to confirm your settings, then click [Start] when you're ready.

  • If Minecraft runs out of memory while the datapack is generating the world, try allocating more memory and restarting the game.

How it works:

  • The datapack changes your gamemode to spectator mode and teleports your character to the starting point in the correct dimension
    • The starting point is calculated based on the origin point selected and how much of the dimension is previously generated by the datapack. If none of the dimension was already generated, the datapack will start at the origin point.
  • The datapack generates the world from the inside out (i.e. closer to further).
    • It does this by teleporting your character in loops around the origin.
    • This means that if you choose to stop the generation early, the world will be generated at a smaller radius
    • It also means that if you choose to generate using a larger radius in the future, it can skip the closer chunks that were already generated
  • The datapack also estimates the number of ticks it will take to complete generation.
    • This is displayed on the top of your screen in the form of a progress bar, as well as occasional time estimates in chat.

  • When world generation stops, either by completing the radius or by clicking [Stop], the datapack saves the progress made in the dimension, changes the player to creative mode and teleports them to spawn.
    • By saving the progress made, we avoid trying to generate the same chunks again the next time pregen is run.

Options

Settings can be changed using the WorldPregen scoreboard or using /function pregen:config

  • OriginX: x coordinate of Origin. Defaults to 0.
  • OriginZ: z coordinate of Origin. Defaults to 0.
  • Radius: Distance (in blocks) in each axis to generate. Must be nonnegative. Defaults to 5000
  • Dimension: ID of dimension to generate. Must be between -1 and 1. Defaults to 0.
  • Overworld: Generation progress made in the Overworld
  • Nether: Generation progress made in the Nether
  • End: Generation progress made in the End