KubeJS (Old)

KubeJS (Old)

3M Downloads

[Feature Request] "not" recipe filters

erisdev opened this issue ยท 1 comments

commented

In a filter, { not: [ ... ] } should match only if none of the subfilters (...) match. This would be useful, for instance, for doing blanket ingredient replacements where you have a ton of recipes you want to change and only a handful of exceptions that can't easily be excluded using the current matching rules. For example:

events.listen("recipes", recipes => {
    const filter = {
        // match all shaped & shapeless crafting recipes...
        or: [
            { type: "minecraft:crafting_shaped" },
            { type: "minecraft:crafting_shapeless" },
        ],
        // ... which accept milk buckets as an input ...
        input: "minecraft:milk_bucket",
        // ... but don't output a bottle of milk
        not: [{ output: "neapolitan:milk_bottle" }],
    };
    // now almost all crafting recipes that use a milk bucket will use a
    // bottle instead, but neapolitan's bottle filling recipe is unaffected
    recipes.replaceInput(filter,
        "minecraft:milk_bucket",
        { tag: "forge:bottles/milk" });
});
commented

Awesome, thank you!