Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recipe conflict detection #525

Merged
merged 7 commits into from
Jan 20, 2022
Merged

Recipe conflict detection #525

merged 7 commits into from
Jan 20, 2022

Conversation

kumquat-ir
Copy link
Contributor

@kumquat-ir kumquat-ir commented Jan 16, 2022

What:
Adds a command to check all Recipes in all RecipeMaps to see if anything seems to conflict with them.

How solved:
Iterate over all recipes in each map, and for each one:

  • Generate a list of inputs that has 100x the number of items and 10000x the amount of fluid as usual
  • Use RecipeMap.findRecipe on the input list
  • Check if the recipe object returned is the same as the input recipe object

Afterwards, pretty-print all detected conflicts to the log.

Outcome:
Less recipe conflicts

Additional info:
Example conflict messages:

In map arc_furnace
Tried: EU/t: 30, Duration: 3312
Item inputs:
    { gregtech:meta_block_compressed_26 * 1 (Meta 15) } * 1
Fluid inputs:
    material.oxygen * 3312
Item outputs:
    gregtech:meta_block_compressed_26 * 1 (Meta 15)

Found: EU/t: 30, Duration: 368
Item inputs:
    { gregtech:meta_block_compressed_26 * 1 (Meta 15) } * 1
Fluid inputs:
    material.oxygen * 368
Item outputs:
    (MetaItem) OrePrefix: ingot, Material: enriched_naquadah_trinium_europium_duranide

(There unfortunately does not seem to be a good way to get the oredict name from the CountableIngredient)

In map assembler
Tried: EU/t: 4, Duration: 300
Item inputs:
    { minecraft:planks * 1 (Meta 3) } * 1
    { Config circuit #3 } * 0
Item outputs:
    minecraft:jungle_fence * 1 (Meta 0)

Found: EU/t: 4, Duration: 300
Item inputs:
    (OreDict) { minecraft:planks * 1 (Meta 0) minecraft:planks * 1 (Meta 1) minecraft:planks * 1 (Meta 2) minecraft:planks * 1 (Meta 3) minecraft:planks * 1 (Meta 4) minecraft:planks * 1 (Meta 5) gregtech:planks * 1 (Meta 0) (MetaItem) OrePrefix: plate, Material: wood } * 3
    { Config circuit #3 } * 0
Item outputs:
    minecraft:trapdoor * 2 (Meta 0)
In map macerator
Tried: EU/t: 2, Duration: 98
Item inputs:
    { } * 1
Item outputs:
    (MetaItem) OrePrefix: dust, Material: paper

Found: null (Is something else going wrong?)

Possible compatibility issue:
Will not detect conflicts only present when extra items are required to present the conflict, or conflicts that just happen to produce the correct recipe and do not occur when running the conflicting recipe due to extra inputs

@brachy84
Copy link
Contributor

brachy84 commented Jan 17, 2022

this will conflict with #504 where i removed the util part of the command
Also, translating command output is somewhat unessecary imo

@kumquat-ir
Copy link
Contributor Author

Due to the difficulty of bootstrapping the test environment to a point where all our recipes have been registered, the ci test will unfortunately not be happening in this PR. Someone else can feel free to try to implement it.

@kumquat-ir
Copy link
Contributor Author

This is basically done, but the recipe matching code will most likely will need to be redone for #329 and #530.
Could refactor the pretty-printing stuff into its own class, if we want them for other places.

Current list of recipe conflicts detected, for reference (in the order they are printed in the log):

  • Duplicate recipes for glowstone plates in cutter
  • Duplicate recipes for coke bricks in alloy smelter
  • Duplicate recipes for glowstone blocks in fluid solidifier
  • Redstone block and plate conflict in compressor
  • Arc furnacing polymer block conflicts with outputs of either ash or 9 ingots
  • Arc furnacing non-polymer block conflicts with outputs of either the block itself or 9 ingots
  • Some macerator recipe with no inputs outputting 3 chad
  • Duplicate recipes for wheat dust in macerator
  • Conflict between large steel cell and normal cell in extruder
  • Conflict between wood stairs and doors in assembler (config 6)
  • Conflict between stone wall and stairs in assembler (config 6)
  • Conflict between wood fence and trapdoors in assembler (config 3)

All recipe configs are on their default values, there may be more on other config combinations

@kumquat-ir kumquat-ir marked this pull request as ready for review January 19, 2022 20:09
@serenibyss serenibyss merged commit f59602f into master Jan 20, 2022
@serenibyss serenibyss deleted the recipe-conflicts branch January 20, 2022 00:52
@Vliro
Copy link

Vliro commented Jan 21, 2022

In #530 all recipes are stored as a Collection, so if at any leaf size() > 1 you get a conflict (it simply means the same input can react multiple recipes) You can supply a predicate simply being a -> true and it won't check ingredient counts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants