Jigsaw structure

Jigsaw structure
Jigsaw Block.png: Infobox image for Jigsaw structure the structure in Minecraft
Biomes

None

Generates in
existing chunks

No

Consists of

Jigsaw structures are structures that generate using jigsaw blocks.

They are used to generate pillager outposts, villages, bastion remnants, ancient cities, trail ruins, and trial chambers. The jigsaw structure generation can be customized using data packs in Java Edition or add-ons in Bedrock Edition‌.

Generation

The generation places a number of pieces. A piece is usually a structure template, but can also be a placed feature. The pieces are organized into template pools. During generation pieces are randomly selected from a given template pool.

When a structure is generated starting from a given chunk, it generates in a number of steps, detailed below.

Step 1: Starting piece

A jigsaw structure defines a [String][NBT Compound / JSON Object] start_pool. A piece is selected from this pool and placed at the starting position. Rotation and the starting template are chosen randomly, based on the chunk coordinates and the world seed. If the selected piece is a minecraft:empty_pool_element, the structure fails to generate.‌[note 1] The starting position is the 0, 0 chunk coordinate of the starting chunk. If the [String] project_start_to_heightmap‌/[String] heightmap_projection‌ is set, the start height is based on the specified heightmap, offset by the values result of [Int][NBT Compound / JSON Object] start_height. Otherwise, [Int][NBT Compound / JSON Object] start_height is used to determine the start height.

If the structure defines a [String] start_jigsaw_name, then a jigsaw block with that name is randomly selected and then placed at the starting position. If no matching jigsaw block is found, the structure fails to generate.[note 1] If the structure has [String] start_jigsaw_name unset, the north west corner of the (unrotated) piece is placed at the starting position.

If the final starting piece position is not at least [Int] dimension_padding.bottom blocks away from the lower build limit and [Int] dimension_padding.top blocks away from the upper build limit, the structure fails to generate.[note 1]

Finally, the starting piece is put into a generation queue.

Step 2: Connecting pieces

The generation queue is processed sequentially. A piece is removed from the queue when is processed. Of the processed (parent) piece all jigsaw blocks are then used to generate a connecting piece. The jigsaw blocks are handled in order from high to low selection priority set in each jigsaw block and a random order of jigsaw blocks with equal selection priority.

Connecting piece selection

The jigsaw block is referencing a "target pool". The "target pool" is used as an alias by the pool aliases referenced in [NBT List / JSON Array] pool_aliases to determine which template pool to use. If no pool alias is used then the "target pool" directly references the template pool to use.

The connecting piece is determined using that template pool in following order:

  1. All the pieces from the template pool — in random order according to their weight.
  2. All the pieces from the fallback pool specified in the template pool — in random order according to their weight.

If the maximum depth (defined by [Int] size‌/[Int] max_depth‌) is reached, point 1 is skipped.

Connecting piece try

From the tried piece a random jigsaw block is selected, that

  1. is facing outside of the bounds of the connecting piece
  2. has a "name" that matches the "target name" of the parent jigsaw block,
  3. has an orientation that is compatible with the parent jigsaw orientation (pieces can be rotated horizontally only).

The piece is placed in the world such that the jigsaw blocks connect to each other. If the currently handled piece or the newly selected piece is set to terrain matching, the piece is moved vertically to align with the terrain.

Piece placement condition

The placement is then checked for validity. A piece has to:

  1. Not exceed the outer bounding box. If it is placed within another piece, then the bounding box of that piece is the outer bounding box[note 2], otherwise the outer bounding box is:
    • A cube with side-length 2 * [Int] max_distance_from_center, centered on the starting position.
    • The cube then gets truncated on the top or bottom such that it is at least [Int] dimension_padding or [NBT Compound / JSON Object] dimension_padding.[Int] bottom‌ blocks away from the lower build limit and [Int] dimension_padding or [NBT Compound / JSON Object] dimension_padding.[Int] top‌ blocks away from the upper build limit.
  2. Not intersect with any other piece (except those that it is placed inside of)

If the piece can't be placed, then the placement is retried with the next piece (see #Connecting piece selection). If all pieces can't be placed than no piece is placed for this jigsaw block.

If the piece can be placed, then the newly placed piece is added to the generation queue according to the placement priority specified in the parent jigsaw block, but behind elements of equal placement priority already in the queue. The generation continues with the next jigsaw block of the parent piece.

Step 3: Processing

Finally, each piece is processed, changing or removing blocks from the template.

The processing is done using the processor list specified for each piece in the template pool. Additionally, jigsaw blocks are replaced with the specified "Turns into" final state (using the minecraft:jigsaw_replacement processor in Java Edition). For pieces set to terrain matching each column of blocks is adjusted in height match the terrain (using the minecraft:gravity processor in Java Edition).

Notes:

  1. a b c When the structure fails to generate, it can't be located using /locate and other structures from the same structure set can take its place.
  2. When [Boolean] use_expansion_hack is set to true, the bounding box of the pieces is extended to the height of the highest possible child piece.

Pool aliases

Pool aliases are used to redirect the alias "target pool" referenced in jigsaw blocks to a (different) template pools. The redirections are determined before the generation starts, so in a single structure all references to a specific alias template pool are rewired to the same target template pool. Any alias that is not redirected by a pool alias is used directly as reference to a template pool.

direct

All references to [String] alias are rewired to [String] target.

  • [NBT Compound / JSON Object]: a pool alias
    • [String] type: direct
    • [String] alias: ID — alias to be redirected
    • [String] target: One template pool (an [String] ID) — target for redirection

random

A target selected from [NBT List / JSON Array] targets per structure. All references to [String] alias are rewired that target.

  • [NBT Compound / JSON Object]: a pool alias
    • [String] type: random
    • [String] alias: ID
    • [NBT List / JSON Array] targets: list of possible rewiring targets
      • [NBT Compound / JSON Object]: a rewiring target
        • [Int] weight: The chance of this target to be selected
        • [String] data: One template pool (an [String] ID) — target for redirection if selected

random_group

A alias group is selected from [NBT List / JSON Array] groups per structure. All pool aliases in that group are used.

  • [NBT Compound / JSON Object]: a pool alias
    • [String] type: random_group
    • [NBT List / JSON Array] groups list of possible rewiring groups. One group is selected per structure generation.
      • [NBT Compound / JSON Object]: a group
        • [Int] weight: The chance of this group to be selected
        • [NBT List / JSON Array] data: list of pool aliases to be used if the group is selected
          • [NBT Compound / JSON Object]: any pool alias

Data values

ID

Java Edition:

Structure typeIdentifier
BlockSprite jigsaw.png: Sprite image for jigsaw in Minecraft Jigsawjigsaw

Config

Java Edition:

  • [NBT Compound / JSON Object] Structure configuration
    • [String] type: jigsaw
    • Fields common to all structures see Template:Nbt inherit/structure/template
    • [String][NBT Compound / JSON Object] start_pool: One template pool (an [String] ID, or a new [NBT Compound / JSON Object] template pool definition) — The template pool the structure starts from.
    • [Int] size: Value between 0 and 20 (inclusive) — The depth of jigsaw structures to generate.
    • [Int][NBT Compound / JSON Object] start_height: If project_start_to_heightmap is unset, the structure will start at the value provided. Otherwise, the value acts as an offset from the heightmap.
      • Height provider see Template:Nbt inherit/height provider/template
    • [String] project_start_to_heightmap: (optional) The heightmap the start height should project to. Can be WORLD_SURFACE_WG, WORLD_SURFACE, OCEAN_FLOOR_WG, OCEAN_FLOOR, MOTION_BLOCKING, or MOTION_BLOCKING_NO_LEAVES.
    • [String] start_jigsaw_name: (optional) The name of the jigsaw block the structure start attaches to.
    • [Int] max_distance_from_center: The maximum 3D Chebyshev distance from the jigsaw pieces to the structure start. Value between 1 and 128 (inclusive) when [String] terrain_adaptation is "none", otherwise from 1 to 116 (inclusive).
    • [Boolean] use_expansion_hack: Only used in villages.
    • [NBT List / JSON Array] pool_aliases: (optional) used to rewire jigsaw pool connections by redirecting pool references on individual structure instances.
    • [Int][NBT Compound / JSON Object] dimension_padding: (optional, defaults to 0). Padding on the top and bottom world limit. [Int]: shorthand to set the same value for [Int] bottom and [Int] top.
      • [Int] bottom: (optional, defaults to 0), non-negative. Amount of blocks at the bottom build limit that are excluded from the outer bounding box of the structure.
      • [Int] top: (optional, defaults to 0), non-negative. Amount of blocks at the top build limit that are excluded from the outer bounding box of the structure.
    • [String] liquid_settings: (optional, defaults to apply_waterlogging). How blocks with waterlogged block state should generate when they overlap with existing water. apply_waterlogging: waterlog block placed inside water, ignore_waterlogging: keep the waterlogged block state as is.

Bedrock Edition:

  • [NBT Compound / JSON Object] Structure configuration
    • [String] format_version: ​
    • [NBT Compound / JSON Object] minecraft:jigsaw
      • [NBT Compound / JSON Object] description
        • [String] identifier: The identifier used for /locate and /place
      • [NBT Compound / JSON Object] biome_filter: Biomes that this structure is allowed to generate in. ​
      • [String] step: The step where the structure generates. ​
      • [String] terrain_adaptation: (Optional, defaults to none) The type of terrain adaptation used for the structure. none for no adaptation, beard_thin is used by pillager outposts and villages, beard_box is used by ancient cities, bury is used by strongholds, and encapsulate is used by Trial Chambers.
      • [String] start_pool: One template pool (an [String] ID) — The template pool the structure starts from.
      • [Int] max_depth: Value between 0 and 20 (inclusive) — The depth of jigsaw structures to generate.
      • [Int][NBT Compound / JSON Object] start_height: If heightmap_projection is unset, the structure will start at the value provided. Otherwise, the value acts as an offset from the heightmap. ​
        • Height provider see Template:Nbt inherit/height provider/template
      • [String] heightmap_projection: (optional) The heightmap the start height should project to. Can be world_surface or sea_floor.
      • [String] start_jigsaw_name: (optional) The name of the jigsaw block the structure start attaches to.
      • [Int] max_distance_from_center: The maximum 3D Chebyshev distance from the jigsaw pieces to the structure start. Value between 1 and 128 (inclusive) .
      • [NBT List / JSON Array] pool_aliases: (optional) used to rewire jigsaw pool connections by redirecting pool references on individual structure instances.
      • [Int] dimension_padding: (optional, defaults to 0). Padding on the top and bottom world limit.

History

Java Edition
1.1418w46aAdded jigsaw blocks.
18w47aAdded jigsaw structures in the form of pillager outpost.
1.16.220w28aJigsaw structures can now be customized in data packs, using configured_structure_features of type village, pillager_outpost, and bastion_remnant. They have a maximum radius of 80 blocks.
1.19Deep Dark Experimental Snapshot 1Jigsaw structures with radius 128 can now be generated using the configured_structure_features type ancient_city.
22w11aMerged the structure types village, pillager_outpost, and bastion_remnant into a single type jigsaw.
Added [Int][NBT Compound / JSON Object] start_height, [String] project_start_to_heightmap, and [Boolean] use_expansion_hack fields.
22w12aAdded [Int] max_distance_from_center field.
22w13aReplaced [Boolean] adapt_noise field with [String] terrain_adaptation.
22w17aAdded [String] start_jigsaw_name field.
1.20.323w42aAdded [NBT List / JSON Array] pool_aliases.
1.2124w19aAdded [Int] dimension_padding.
24w20a[Int][NBT Compound / JSON Object] dimension_padding can now also be specified separately for top and bottom padding.
pre1Added [String] liquid_settings.
Bedrock Edition
1.10.0beta 1.10.0.3Added jigsaw blocks.
1.21.50
Experiment
Data-Driven Jigsaw Structures
Preview 1.21.50.26Jigsaw structures can now be customized in add-ons, using files json.

Navigation