#Using the sections of one mod's JSON recipes to fill in the JSON recipes of another
2 messages · Page 1 of 1 (latest)
Update: I have managed to get my script to the following:
ServerEvents.recipes(event => {
event.forEachRecipe({type:'farmersdelight:cooking'}, recipe => {
var parsedResultString = JSON.stringify(JSON.parse(recipe.json).result);
var parsedContainerString = (JSON.parse(recipe.json).container == undefined) ? '{"item": "minecraft:air"}' : JSON.stringify(JSON.parse(recipe.json).container);
var parsedIngredientsString = JSON.stringify(JSON.parse(recipe.json).ingredients);
console.log(parsedContainerString);
console.log(parsedResultString);
console.log(parsedIngredientsString);
var newJson = '{"type": "farm_and_charm:pot_cooking", "ingredients":' + parsedIngredientsString + ', "container":' + parsedContainerString + ', "result":' + parsedResultString + '}';
console.log(newJson);
event.custom(newJson);
})
});```
Now I get a JSON out but the recipes don't seem to form nonetheless...