Skip to content

PresetsFileFormat

dshadowwolf edited this page Feb 21, 2018 · 2 revisions

The Presets File is a simple but complex thing, containing a json object where the keys point to any form of values. More than that, you can even include a "presets" section in a raw config that only applies to that file. When referencing a preset you use the format of $<name>[.<name>...] building a path down the object tree.

An example of a presets file:

{
    "dimensions": {
        "all-overworld": [],
        "overworld": [ 0 ],
        "nether": [ -1 ],
        "end": [ 1 ]
    },
    "biomes": {
        "emeralds": { "includes": [ "minecraft:extreme_hills", "minecraft:smaller_extreme_hills" ] },
        "open-area": { "includes": [ "PLAINS", "DESERT", "WASTELAND" ] },
        "hilly": { "includes": [ "HILLS", "MOUNTAIN" ] },
        "sandy": { "includes": [ "BEACH", "DESERT" ] },
        "special": { "includes": [ "MUSHROOM", "MAGICAL" ] },
        "desolate": { "includes": [ "DESERT", "WASTELAND", "FROZEN" ], "excludes": [ "minecraft:taiga" ] },
        "any": { "excludes": [ ] } 
    },
    "blocks": {
        "iron-mix-1": [ { "name": "minecraft:iron_ore", "chance": 100 },
                        { "name": "basemetals:nickel_ore", "chance":50 },
                        { "name": "modernmetals:chromium_ore", "chance":10 } ],
        "silver-mix": [ { "name": "basemetals:lead_ore", "chance": 25 },
                        { "name": "basemetals:silver_ore", "chance": 75 } ]
    },
    "parameters": {
        "cluster-frequent-large": {
            "max-spread": 32,
            "cluster-size": 32,
            "cluster-count": 16,
            "min-height": 13,
            "max-height": 80,
            "variance": 4,
            "frequency": 25,
            "tries-per-chunk": 16
        }
    }
}

In the above example I have organized it based on what the section contained - dimension lists, biome lists, blocks and feature generator parameters. If, in a config, I wished to use the blocks preset "iron-mix-1", it would be as $blocks.iron-mix-1 and if I wanted to reference the "open-area" biomes preset, it would be $biomes.open-area.

This layout might work for me, but remember - the only requirement of the format is that it be defined as a json object containing other json objects. As long as you can define a "path" for the variable that meets the description given here, there should be no issues.