Croparia IF Docs

|

General

Section
Modpack Authors
6 TOP-LEVEL ITEMS
    Modpack Authors
    Runtime Data Generation System

      Create a Data Generator

    Recipe Wizard

Create a Data Generator

This page answers one question: how to write a working data generator file. For the overall concepts, see the Runtime Data Generation System. For field value syntax, see Placeholder Parsers.

Where It Goes

Generator files belong in the generator/ directory of the corresponding handler, not directly under assets/ or data/:

  • Datapack: [game directory]/croparia/datapack/generator/
  • Resource pack: [game directory]/croparia/resourcepack/generator/

The generated outputs will then be written to:

  • Datapack: [game directory]/croparia/datapack/data/
  • Resource pack: [game directory]/croparia/resourcepack/assets/

Supported formats:

  • toml
  • cdg
  • json

toml is the recommended default.

Minimal Example

registry = "croparia:crops"
path = "example/recipes/${id.path}.json"
template = """
{
  "type": "minecraft:crafting_shapeless",
  "ingredients": [
    { "item": "${fruit}" }
  ],
  "result": {
    "id": "${seed}",
    "count": 1
  }
}
"""

This means:

  • iterate over croparia:crops
  • calculate path once for each entry
  • fill template with the current entry
  • generate multiple independent files

Core Fields

  • registry: which generation entry set should be iterated
    • common values:
      • croparia:crops
      • croparia:melons
      • croparia:elements
  • path: relative output path; this field is itself a template
    • example:
path = "${id.namespace}/models/item/${seed.path}.json"
  • template: the final file content to write; this is also a template string
    • example:
template = """
{
  "parent": "croparia:item/template_seed"
}
"""
  • type: generator type

  • startup: whether this generator should run before the server has fully started

  • enabled: whether the generator is enabled; useful for temporarily disabling a file without deleting it

    • example:
enabled = false
  • whitelist
    • purpose: only generate for specific entries instead of traversing the whole registry
    • common use cases: debugging, partial overrides
    • example:
whitelist = ["croparia:coal", "croparia:iron"]

Generator Types

Standard Generator croparia:generator

The default type. One entry usually produces one file; if multiple entries resolve to the same target path, the later write overrides the earlier one.

Good for:

  • recipes
  • models
  • loot tables
  • blockstates
registry = "croparia:crops"
startup = true
path = "${id.namespace}/models/item/${seed.path}.json"
template = """
{
  "parent": "croparia:item/template_seed"
}
"""

Aggregated Generator croparia:aggregated

Each entry first produces a piece of content, then all pieces are merged into one shared template. This is a good fit for files like tags, where many entries must be combined into one result.

Extra field:

  • content
registry = "croparia:crops"
type = "croparia:aggregated"
startup = true
path = "croparia/tags/item/seeds/crops.json"
content = '    "${seed}"'
template = """
{
  "replace": false,
  "values": [
${content}
  ]
}
"""

Language Generator croparia:lang

This type is designed for translatable entries. It splits output by language and injects the _lang placeholder for use inside templates.

Good for:

  • language files
registry = "croparia:crops"
type = "croparia:lang"
startup = true
path = "${id.namespace}/lang/${lang}.json"
template = '"${translation_key}": "${translations.get(_lang)}"'

For language-related fields, see Placeholder Parsers.

In This Page
Create a Data Generator
NO EXTRACTED HEADINGS