[Q] Having trouble with adding recipes without Aliases/jsons

Hey guys,

I’m working on a new mod that will help manage food items after you’ve been playing a while. I’m putting my crates to use so I can craft the following.

 10 Berries + 1 Wood Resource = Berry Crate - Small

So that’s all done and dusted and it’s fine.

Now what I’m trying to do is create a recipe to tear down the Berry Crate - Small back into 10 baskets of berries. I’m sure I don’t need a json file or an alias in the manifest for this but this is my carpenters_recipie.json file. I’m sure this is where the error lies.

{
    "craftable_recipes": {
        "storage": {
            "ordinal": 6,
            "name": "Food Storage",
            "recipes": {
                "berry_small": {
                    "recipe": "file(/recipes/food/berry_small_recipe.json)"
                },
                "berry_medium": {
                    "recipe": "file(/recipes/food/berry_medium_recipe.json)"
                },
                "berry_large": {
                    "recipe": "file(/recipes/food/berry_large_recipe.json)"
                },
                "corn_small": {
                    "recipe": "file(/recipes/food/corn_small_recipe.json)"
                },
                "corn_medium": {
                    "recipe": "file(/recipes/food/corn_medium_recipe.json)"
                },
                "corn_large": {
                    "recipe": "file(/recipes/food/corn_large_recipe.json)"
                },
                "pumpkin_small": {
                    "recipe": "file(/recipes/food/pumpkin_small_recipe.json)"
                },
                "pumpkin_medium": {
                    "recipe": "file(/recipes/food/pumpkin_medium_recipe.json)"
                },
                "pumpkin_large": {
                    "recipe": "file(/recipes/food/pumpkin_large_recipe.json)"
                },
                "td_berry_small": {
                    "recipe": "file(/recipes/teardown/td_berry_small_recipe.json)"
                },
                "td_berry_medium": {
                    "recipe": "file(/recipes/teardown/td_berry_medium_recipe.json)"
                },
                "td_berry_large": {
                    "recipe": "file(/recipes/teardown/td_berry_large_recipe.json)"
                },
                "td_corn_small": {
                    "recipe": "file(/recipes/teardown/td_corn_small_recipe.json)"
                },
                "td_corn_medium": {
                    "recipe": "file(/recipes/teardown/td_corn_medium_recipe.json)"
                },
                "td_corn_large": {
                    "recipe": "file(/recipes/teardown/td_corn_large_recipe.json)"
                },
                "td_pumpkin_small": {
                    "recipe": "file(/recipes/teardown/td_pumpkin_small_recipe.json)"
                },
                "td_pumpkin_medium": {
                    "recipe": "file(/recipes/teardown/td_pumpkin_medium_recipe.json)"
                },
                "td_pumpkin_large": {
                    "recipe": "file(/recipes/teardown/td_pumpkin_large_recipe.json)"
                }
            }
        }
    }
}

Now everything is there is fine until I get to the aliases with the "td" , I don’t need aliases, so that’s obviously where the error is coming from. Or do I need an alias? The teardown recipes are all done and I’m certain that they are perfect.

This is probably very simple but it’s going over my head at the moment, any help would be appreciated.

Well, just checked and it’s valid JSON so it’s not a parsing problem. What’s the error that you’re seeing? Also, are you doing this as a mixinto? Can you post your mod manifest?

As Johnny 5 would say, Need more input!

1 Like

The carpenter_recipie.json above is the only mixins file. I am trying to add

I’ll try to explain it better. The following pieces of code can be found in the carpenters_recipe.json file. All these items are new, they have models and the proper json files to make them craftable and show up in the world.

            "berry_small": {
                "recipe": "file(/recipes/food/berry_small_recipe.json)"
            },
            "berry_medium": {
                "recipe": "file(/recipes/food/berry_medium_recipe.json)"
            },
            "berry_large": {
                "recipe": "file(/recipes/food/berry_large_recipe.json)"
            },
            "corn_small": {
                "recipe": "file(/recipes/food/corn_small_recipe.json)"
            },
            "corn_medium": {
                "recipe": "file(/recipes/food/corn_medium_recipe.json)"
            },
            "corn_large": {
                "recipe": "file(/recipes/food/corn_large_recipe.json)"
            },
            "pumpkin_small": {
                "recipe": "file(/recipes/food/pumpkin_small_recipe.json)"
            },
            "pumpkin_medium": {
                "recipe": "file(/recipes/food/pumpkin_medium_recipe.json)"
            },
            "pumpkin_large": {
                "recipe": "file(/recipes/food/pumpkin_large_recipe.json)"
            },

Now, this following pieces of codes shouldn’t need aliases, jsons and models because all they’re supposed to do is add a option in the carpenters menu to break down the crates back into their original food resource.

            "td_berry_small": {
                "recipe": "file(/recipes/teardown/td_berry_small_recipe.json)"
            },
            "td_berry_medium": {
                "recipe": "file(/recipes/teardown/td_berry_medium_recipe.json)"
            },
            "td_berry_large": {
                "recipe": "file(/recipes/teardown/td_berry_large_recipe.json)"
            },
            "td_corn_small": {
                "recipe": "file(/recipes/teardown/td_corn_small_recipe.json)"
            },
            "td_corn_medium": {
                "recipe": "file(/recipes/teardown/td_corn_medium_recipe.json)"
            },
            "td_corn_large": {
                "recipe": "file(/recipes/teardown/td_corn_large_recipe.json)"
            },
            "td_pumpkin_small": {
                "recipe": "file(/recipes/teardown/td_pumpkin_small_recipe.json)"
            },
            "td_pumpkin_medium": {
                "recipe": "file(/recipes/teardown/td_pumpkin_medium_recipe.json)"
            },
            "td_pumpkin_large": {
                "recipe": "file(/recipes/teardown/td_pumpkin_large_recipe.json)"
            }

Now this is taken from my GoblinTokens mod

Manifest.json

{
“info”: {
“name”: “Goblin Token”,
“version”: 1
},
“mixintos”: {
“/stonehearth/jobs/carpenter/recipes/recipes.json”: [
“file(mixins/carpenter_recipes.json)”
]
}
}

Notice how there is no aliases. But, in the carpenters_recipe.json below, I still have an alias, but it works.

{
   "craftable_recipes" : {
      "tools_weapons" : {
         "ordinal" : 1,
         "name" : "Tools & Weapons",
         "recipes" : {
            "Goblin Token Tear Down" : {
               "recipe" : "file(/recipes/oak_log_recipe.json)"
            }
         }
      }
   }
}

The error isn’t invalid JSON, it means that instead of a file path (a string), you pass anything else to load_json - for example, an array.

You’ve got the stack trace there, you just need to figure out what line 37 is loading and then maybe log it/print it to see what’s passed to radiant.resources.load_json.

1 Like

The error is that files like that one don’t have valid data in the produces-item section of the individual recipe. Can you post one of the recipe files?

It was as simple as changing uri to item in the recipe file. So much for that perfect recipe file.

Thanks for the help guys.

5 Likes