> For the complete documentation index, see [llms.txt](https://a3626a.gitbook.io/hungryanimals/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://a3626a.gitbook.io/hungryanimals/5.4/basics/grass-generation.md).

# Grass Generation

## Introduction

`generators.json` contains a list of 'Generator' which generates grass in the world periodically.

## Grammar

{% code title="generators.json" %}

```
[
  biome_and_generator,
  biome_and_generator,
  ...
]
```

{% endcode %}

{% code title="biome\_and\_generator " %}

```
{
  "types" : [biome_type, ...],
  "generator" : generator
}
|
{
  "biome" : string,
  "generator" : generator
}
|
{
  "generator" : generator
}
```

{% endcode %}

{% code title="biome\_type " %}

```
"HOT" |
"COLD" |
"SPARSE" |
"DENSE" |
"WET" |
"DRY" |
"SAVANNA" |
"CONIFEROUS" |
"JUNGLE" |
"SPOOKY" |
"DEAD" |
"LUSH" |
"NETHER" |
"END" |
"MUSHROOM" |
"MAGICAL" |
"RARE" |
"OCEAN" |
"RIVER" |
"WATER" |
"MESA" |
"FOREST" |
"PLAINS" |
"MOUNTAIN" |
"HILLS" |
"SWAMP" |
"SANDY" |
"SNOWY" |
"WASTELAND" |
"BEACH" |
"VOID"
```

{% endcode %}

{% code title="generator " %}

```
{
  "condition" : condition,
  "grass" : block_state | [block_state, ...]
}
```

{% endcode %}

{% code title="condition " %}

```
{
  "below" : block_state | [block_state, ...],
  "chance" : double,
  "not_adjacent" : block_state | [block_state, ...]
}
```

{% endcode %}

{% hint style="info" %}
For *block state*, follow this page
{% endhint %}

## Usage

There are 3 variants of biome\_and\_generator. First variant which has `"types"` field, applies corresponding generator to every biome wihch has all `"types"`. Second variant which has `"biome"` field, applies corresponding generator to the `"biome"` only. Last one applies the generator to every biome without any other generator. In other words, this is a default generator.

generator has two fields `"condition"` and `"grass"`. When `"condition"` meets, generates `"grass"`. `"grass"` can be a single block\_state or a list of block\_states. When `"grass"` is given as a list, one block\_state is randomly selected and generated.

condition has three fields, and each field can be ommited. Each field represents a condition, and every field must be satisfied. Ommited field is simply considered satisfied. `"below"` is met when block below target position is one of listed block\_state.`"chance"` is met purely by chance. `"1.0"` means always, `"0.0"`means never. Using this field you can specify speed or frequency of grass growth. `"not_adjacent"` is met when there's no block\_state listed nearby target position (8 blocks).

## Examples

```
{
    "biome" : "minecraft:jungle",
    "generator" : {
        "condition" : {
            "below" : {"name" : "minecraft:grass"},
            "chance" : 0.25,
            "not_adjacent" : {
                "name": "minecraft:tallgrass",
                "type": "fern"
            }
        },
        "grass" : {
            "name": "minecraft:tallgrass",
            "type": "fern"
        }
    }
}
```

Grass grows rapidly in jungle.

```
{
    "biome" : "minecraft:plains",
    "generator" : {
        "condition" : {
            "below" : {"name" : "minecraft:grass"},
            "chance" : 0.1,
            "not_adjacent" : {"name": "minecraft:yellow_flower"}
        },
        "grass" : {
            "name": "minecraft:yellow_flower",
            "type": "dandelion"
        }
    }
}
```

Dandelion is growing in plains.

```
{
    "types" : ["COLD", "MOUNTAIN"],
    "generator" : {
        "condition" : {
            "below" : {"name" : "minecraft:grass"},
            "chance" : 0.05,
            "not_adjacent" : {"name": "minecraft:tallgrass"}
        },
        "grass" : {
            "name": "minecraft:tallgrass",
            "type": "fern"
        }
    }
}
```

Grass grows very slowly in every "COLD" "MOUNTAIN".
