TerraformersMC / Terrestria

A Fabric mod enhancing the detail of Minecraft with unique and vibrant biomes. Inspired by ExtrabiomesXL.
https://www.curseforge.com/minecraft/mc-mods/terrestria
GNU Lesser General Public License v3.0
199 stars 43 forks source link

Allow crafting stripped wood from stripped logs #236

Closed haykam821 closed 3 years ago

haykam821 commented 3 years ago

Fixes #218

The following script was used to generate the crafting recipes:

const fs = require("fs-extra");

const PATH_PATTERN = /^[a-z_]+_wood\.json$/;
const PATHS = [
    "src/main/resources/data/terrestria/recipes",
    "src/main/resources/data/terrestria/advancements/recipes/building_blocks"
];

(async () => {
    for (const path of PATHS) {
        const files = await fs.readdir(path);
        for (const fileName of files) {
            if (fileName.match(PATH_PATTERN) && !fileName.startsWith("stripped")) {
                let file = await fs.readFile(path + "/" + fileName, "utf-8");
                file = file.replace(/\:([a-z_]+)_wood/g, ":stripped_$1_wood");
                file = file.replace(/\:([a-z_]+)_log/g, ":stripped_$1_log");
                file = file.replace(/has_log/g, "has_stripped_log");

                const destination = path + "/stripped_" + fileName;
                fs.writeFile(destination, file);
            }
        }
    }
})();
Prospector commented 3 years ago

Thank you, not sure how we missed this.