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

Add a callback for RecipeMap that called when a recipe is added #3942

Closed
wants to merge 6 commits into from

Conversation

Taskeren
Copy link
Contributor

This feature gives the convenience to the 3rd-party mods that need to either read or modify the existing recipes, so they don't need to iterate them after the mod that owns the machine initialized.

@Taskeren Taskeren marked this pull request as ready for review February 13, 2025 02:20
Copy link
Member

@serenibyss serenibyss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this functionality not be achieved already by a downstream recipemap?

@serenibyss serenibyss added the chore Buildscript update, dep update, adaptation to trivial breaking changes, etc. label Feb 13, 2025
@Taskeren
Copy link
Contributor Author

Taskeren commented Feb 13, 2025

I don't use downstream before.
In my case, I want to know every recipe from a RecipeMap, and have something changed and add to my other RecipeMaps.
My solution for now, is to iterate the recipes after GT5U, but sometimes it loses some recipe maybe because some mods are registering later. With callbacks, no matter how late the recipe is added, it always triggers the callback, and I can handle them without loading phase restriction.

@Dream-Master Dream-Master added the 🚧 Testing on Zeta Do not merge yet, testing this PR on Zeta label Feb 13, 2025
@serenibyss
Copy link
Member

I don't use downstream before. In my case, I want to know every recipe from a RecipeMap, and have something changed and add to my other RecipeMaps. My solution for now, is to iterate the recipes after GT5U, but sometimes it loses some recipe maybe because some mods are registering later. With callbacks, no matter how late the recipe is added, it always triggers the callback, and I can handle them without loading phase restriction.

You can do this with a downstream recipe map just fine. For example for the implosion compressor, electric implosion compressor recipes are added via a downstream map:

RecipeMaps.implosionRecipes.addDownstream(
IRecipeMap.newRecipeMap(
b -> BartWorksRecipeMaps.electricImplosionCompressorRecipes.doAdd(
b.copy()
.duration(1 * TICK)
.eut(TierEU.RECIPE_UEV))));

@serenibyss serenibyss closed this Feb 14, 2025
@Taskeren
Copy link
Contributor Author

I don't use downstream before. In my case, I want to know every recipe from a RecipeMap, and have something changed and add to my other RecipeMaps. My solution for now, is to iterate the recipes after GT5U, but sometimes it loses some recipe maybe because some mods are registering later. With callbacks, no matter how late the recipe is added, it always triggers the callback, and I can handle them without loading phase restriction.

You can do this with a downstream recipe map just fine. For example for the implosion compressor, electric implosion compressor recipes are added via a downstream map:

RecipeMaps.implosionRecipes.addDownstream(
IRecipeMap.newRecipeMap(
b -> BartWorksRecipeMaps.electricImplosionCompressorRecipes.doAdd(
b.copy()
.duration(1 * TICK)
.eut(TierEU.RECIPE_UEV))));

Replied on https://discord.com/channels/181078474394566657/603348502637969419/1339848796556755039
I think it's better to talk on Discord.

@serenibyss serenibyss removed the 🚧 Testing on Zeta Do not merge yet, testing this PR on Zeta label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Buildscript update, dep update, adaptation to trivial breaking changes, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants