question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Recipe loading conditions

See original GitHub issue

We could extend the recipe json format to allow conditionally skipping the loading of some recipes.

Example use case: loading certus quartz crystal -> certus quartz dust grinding recipes when AE2 is loaded.

A possible extension could look like this:

// Standard MI recipe format
{
  "type": "modern_industrialization:macerator",
  "eu": 2,
  "duration": 200,
  "item_inputs": { "tag": "c:certus_quartz_crystals" },
  "item_outputs": { "item": "appliedenergistics2:certus_quartz_dust" },
// Additional conditions, the recipe will be skipped if the conditions fail.
  "fabric:conditions": { "mod": "appliedenergistics2" }
}

The challenge is picking the exact format, designing an API that allows defining custom conditions and providing a set of useful conditions (mod loaded, AND, OR, others?).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
warjortcommented, Aug 20, 2021
Perhaps a "skipping recipe X because recipe conditions <json of the conditions here> are not satisfied." 
Well I don't want to have 100s of "failed to load recipe" errors just because some mod was missing.

You can probably put the failed ones in a HashSet/Map and print a summary? JsonElement and its derivatives implement equals() and hashCode() like the java collection framework. 100 recipes not loaded because {"mod_loaded": "foobar"} is false

DEBUG log could be useful though. 

Good luck getting a player to enable debug if your recipes aren’t appearing in their environment. 😃

0reactions
Technici4ncommented, Aug 20, 2021

Hmmm yes I meant JsonElement. 😄

Is this still going to work when Mojang move to Codecs for the whole datapack? I guess operating before the parsing is ok.

If that happens we’d probably get rid of the API, or replace it with a codec equivalent.

How will this interact with what KubeJS (and other mods) do to the recipes? https://github.com/KubeJS-Mods/KubeJS/blob/main/common/src/main/java/dev/latvian/kubejs/mixin/common/RecipeManagerMixin.java Note the ci.cancel() at priority 1100 to stop the vanilla code reparsing them.

RebornCore has a similar system and it works with KubeJS. I think the priority of 1100 is to run after RC’s handler, so if we use the default priority we should be fine. Will obviously test it in production (i.e. AOF4).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fabric Recipe Conditions (FRC) - Mods - Minecraft - CurseForge
Fabric Recipe Conditions is a library that adds the ability to load recipes conditionally. You may be familiar with Forge's recipe system.
Read more >
Recipe Requirements - Bush Cooking
Every recipe MUST be linked to a recipe contributor page, more information can be found about there here. There must be a minimum...
Read more >
Conditionally-Loaded Data - Forge Documentation
Currently, conditional loading is implemented for recipes and advancements. For any conditional recipe or advancement, a list of conditions to datum pair is ......
Read more >
recipes.pdf
Description A recipe prepares your data for modeling. We provide an ... Only rows where the condition evaluates to TRUE are.
Read more >
Carbohydrate-loading diet - Mayo Clinic
Carbohydrate loading is done the week before a high-endurance activity. One to three days before the event, increase your carbohydrate intake to about...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found