> For the complete documentation index, see [llms.txt](https://silverminer.gitbook.io/shrines-structures-wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://silverminer.gitbook.io/shrines-structures-wiki/wiki/en_us/random_variation.md).

# random\_variation

### Random variation

There are many structures that can also have variant materials. E.g. the Watchtower is built from spruce, but a dark oak watchtower could be naturally generated as a new, fresh alternative. Shrines' Random variation feature exchanges the materials of its builds on every placement. You can see a Balloon in white, in red, purple, green etc.\
Since 3.x.x you're also able to fully configure random variation through datapacks.

![](https://media.forgecdn.net/attachments/422/138/random_variation_11012022.png)

### How to customize random variation (Only 1.18.2)

> This paragraphs requires some basic knowledge about minecraft datapacks

Let's first talk about how random variation works. Here is what we want to achieve with it:

Imagine the \[] being one block each. We will use 2-dimensional only.

Imagine you want this structure:

```
[stone_bricks] [stone_bricks] [acacia_planks] [stone_brick_stairs]
[acacia_slab] [oak_slab] [stone_brick_slab] [torch]
[stone_bricks] [stone_bricks] [acacia_planks] [stone_brick_stairs]
```

to look like this one:

```
[mossy_stone_bricks] [mossy_stone_bricks] [spruce_planks] [mossy_stone_brick_stairs]
[spruce_slab] [dark_oak_slab] [stone_brick_slab] [torch]
[mossy_stone_bricks] [mossy_stone_bricks] [mossy_stone_bricks] [mossy_stone_brick_stairs]
```

but because you're lazy, you only want to write

```
stone_bricks -> mossy_stone_bricks
acacia -> spruce
oak -> dark_oak
```

In fact, random variation allows you to do that. You don't even need to generate new structure files in advance, the mod will do that at generation time. You still need to help Shrines a bit. It doesn't know which blocks belong to which "material".

A "material" is a set of blocks assigned to an "element id". For example the acacia material looks like this:

```
acacia
    acacia planks -> planks
    acacia slabs -> slab
    acacia stairs -> stairs
    acacia log -> log
```

and the oak material look like this:

```
oak
    oak planks -> planks
    oak slabs -> slab
    oak stairs -> stairs
    oak log -> log
```

(In fact, both materials contain more blocks, but they aren't important for this article)

You probably noticed already the common ground of both materials. The mod will go over each block of the structure and checks which block of the material it matches and takes the assigned id. Next, it will look at the assigned materials and search for the id and take the block. The taken block will be placed then

That's how it works in a bit simplified. To make random variation work properly, you need at least 3 files. 1 "random variation config" file and 2 "random variation material" file. You can add those files though datapacks. Just as minecrafts datapack entries, they have to be placed into a certain directory. Ass directories are relative to the datapack's namespace.

Path for random variation config: `shrines/random_variation/config`

Path for random variation material: `shrines/random_variation/material`

Here is an example config file: <https://github.com/Silverminer007/Shrines/blob/1.18.2%2B-4.x.x/src/main/resources/data/shrines/shrines/random\\_variation/config/azalea\\_pavilion.json>

Here is an example material file: <https://github.com/Silverminer007/Shrines/blob/1.18.2%2B-4.x.x/src/main/resources/data/shrines/shrines/random\\_variation/material/acacia.json>

There are 53 default material files that you can use, so our example could easily be implemented in a config file:

```
{
  "remaps": [
    [
      {
        "first": "shrines:stone_bricks",
        "second": "shrines:mossy_stone_bricks"
      },
      {
        "first": "shrines:acacia",
        "second": "shrines:spruce"
      },
      {
        "first": "shrines:oak",
        "second": "shrines:dark_oak"
      }
    ]
  ]
}
```

**Important: The name of your config file must be the same as the configured structure feature. Same for namespace**

If you have questions or concerns feel free to ask on discord: <https://discord.gg/8pUpWCEUe2>

[Home](/shrines-structures-wiki/wiki/en_us/home.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://silverminer.gitbook.io/shrines-structures-wiki/wiki/en_us/random_variation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
