wisp-forest / lavender

A Guidebook API and alternative to Patchouli
https://modrinth.com/mod/lavender
MIT License
17 stars 3 forks source link

Support structure block keys with a list of items #7

Open solonovamax opened 3 months ago

solonovamax commented 3 months ago

Support using structure block keys which contain a list of items

For example:

{
    "keys":   {
        "S":      "minecraft:sea_lantern",
        "p":      [
            "minecraft:prismarine",
            "minecraft:prismarine_bricks",
            "minecraft:dark_prismarine"
        ],
        "d":      [
            "minecraft:dark_prismarine",
            "minecraft:prismarine",
            "minecraft:prismarine_bricks"
        ],
        "anchor": "minecraft:conduit"
    },
    ...
}

Each key is either a string or an array of strings, both of which are parsed by BlockArgumentParser.blockOrTag().

I'm probably going to PR a change later that does this. (it's a not-too invasive change in StructureTemplate.parse, as well as a few additional utility classes just to make the code cleaner and avoid the anonymous classes.)

solonovamax commented 3 months ago

An alternative syntax could be:

{
    "keys":   {
        "S":      "minecraft:sea_lantern",
        "p":      "minecraft:prismarine,minecraft:prismarine_bricks,minecraft:dark_prismarine",
        "d":      "minecraft:dark_prismarine,minecraft:prismarine,minecraft:prismarine_bricks",
        "anchor": "minecraft:conduit"
    },
    ...
}

and then splitting it on ,. Though, care would need to be taken to not split it on commas in the nbt data.

This one is more similar to patchouli's syntax.