Wiki 9Minecraft Wiki 9Minecraft

How to Spawn a Saved Structure Schematic in Your World

Saving Your Schematic

To make a custom building generate naturally in your world, you first need a saved .nbt schematic file (such as one saved using a vanilla Structure Block). Move this .nbt file into your datapack's structures/ directory so the game can locate it.

Creating the Structure Spawner File

Next, navigate to the structure_spawners/ folder inside your datapack and create a new configuration file named <structure name>.json. Inside this JSON file, include the required template, placement, and averageSpacing entries.

Under the template section, configure how the schematic loads:

  • Set "type": "single" to tell the spawner to load one standalone .nbt file from your structures/ folder.
  • Set "id" to the location of your file using the standard namespace:path format.
  • If you are generating something like a path or road that needs to match the slope of the ground, add "followTerrain": true inside the template block. For normal buildings with flat floors, leave followTerrain at its default of false.

Finally, set "averageSpacing" to an integer representing the average horizontal distance in chunks between spawn attempts, and fill in your required "placement" rules. Load your datapack into a world to begin finding your structure.