Tutorials/Custom structures

From Minecraft Wiki
Jump to navigation Jump to search
This tutorial is exclusive to Java Edition. 
A forest landscape filled with stone tall towers, a custom structure
A custom structure added to the world by a data pack

This tutorial explains how to create a data pack that adds a custom structure to the world. It assumes you already know how to create a data pack.

pack.mcmeta

{
  "pack": {
    "pack_format": 48,
    "description": "A tall tower"
  }
}

Structure Set[edit | edit source]

A structure set is where the placement starts. It defines where in the world the structure should be placed, and how rare it is.

data/example/worldgen/structure_set/tall_towers.json

{
  "structures": [
    {
      "structure": "example:tall_tower",
      "weight": 1
    }
  ],
  "placement": {
    "type": "minecraft:random_spread",
    "spacing": 5,
    "separation": 2,
    "salt": 1646207470
  }
}

Structure sets are made up of two parts:

  •  structures takes a weighted list of different structures (see below), allowing structure variants (for example the vanilla Nether has a structure set with both the bastion and fortress).
  •  placement specifies in which chunks to spawn the structure. The simplest option is random_spread where you can give the average distance in chunks ( spacing) and the minimum distance in chunks ( separation). The  salt is then used together with the world seed to randomly place structures in a chunk grid.

Structure[edit | edit source]

The structure is the ID you will be able to reference in the /locate command. It contains the configuration on what to place in the world, in which biomes, as well as structure properties like mob spawns.

data/example/worldgen/structure/tall_tower.json

{
  "type": "minecraft:jigsaw",
  "biomes": "#minecraft:has_structure/mineshaft",
  "step": "surface_structures",
  "spawn_overrides": {},
  "terrain_adaptation": "beard_thin",
  "start_pool": "example:tall_tower",
  "size": 1,
  "start_height": {
    "absolute": 0
  },
  "project_start_to_heightmap": "WORLD_SURFACE_WG",
  "max_distance_from_center": 80,
  "use_expansion_hack": false
}

When creating custom structures, you should always set  type to jigsaw. The  biomes field is a biome tag controlling which biomes are allowed to spawn this structure in. The  start_pool references a template pool (see below) which will define the actual structure layout. If you want to use jigsaws, make sure to increase the  size value. It is the jigsaw depth limit and it has a maximum of 20.

Full JSON format of jigsaw structures:

Template pool[edit | edit source]

The template pool defines how to build up your structure. The example in this tutorial does not use jigsaw, so this is quite straight forward: we want to place a single structure NBT file.

data/example/worldgen/template_pool/tall_tower.json

{
  "fallback": "minecraft:empty",
  "elements": [
    {
      "weight": 1,
      "element": {
        "element_type": "minecraft:single_pool_element",
        "location": "example:stone_tall_tower",
        "projection": "rigid",
        "processors": "minecraft:empty"
      }
    }
  ]
}

A single structure is selected from the  elements list. You can add structure variants by adding multiple elements here. The  location field references a structure NBT file

Structure NBT[edit | edit source]

The final piece to get a custom structure in your world is to have a structure NBT file.

data/example/structure/stone_tall_tower.nbt

You can create your own structure in-game, or download this one

Navigation[edit | edit source]