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

Support for recipes with empty output #1701

Merged
merged 1 commit into from
Apr 21, 2023

Conversation

Tictim
Copy link
Contributor

@Tictim Tictim commented Apr 12, 2023

What

This PR adds an extra flag in RecipeMap to enable creation of recipemaps with empty outputs allowed.

Implementation Details

Recipes with empty outputs are not allowed by default. The exceptions were for fuel recipes, which is checked with hardcoded convention of negative EU/t indicating the recipe is a fuel recipe.

In this PR, a new flag, allowEmptyOutput, is added to RecipeMap. Setting the flag to true makes empty output check to be bypassed during recipe validation. There's no option of un-setting the flag.

Additionally, I've removed the check right below empty output check, as it is already checked by above statements and does not affect the actual validation result.

The other changes are just minor documentation changes and cleanups.

Outcome

Addons may be able to

Additional Information

To retain compatibility, the negative EU/t is still explicitly checked. We should remove the check after giving some time for users to migrate to allowEmptyOutput flag.

Potential Compatibility Issues

None

@Tictim Tictim added the type: feature New feature or request label Apr 12, 2023
@@ -328,8 +336,9 @@ protected ValidationResult<Recipe> postValidateRecipe(@Nonnull ValidationResult<
}
recipeStatus = EnumValidationResult.INVALID;
}
boolean emptyOutputs = recipe.getOutputs().isEmpty() && recipe.getFluidOutputs().isEmpty() && recipe.getChancedOutputs().isEmpty();
if (recipe.getEUt() > 0 && emptyOutputs) {
boolean emptyOutputs = !this.allowEmptyOutput && recipe.getEUt() > 0 &&
Copy link
Member

Choose a reason for hiding this comment

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

Should the negative EUt check be removed now in order to require enabling empty outputs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left the negative EU checks to preserve add-on compatibility. It probably should be removed in the future, hopefully together with #1651.

@TechLord22 TechLord22 added this to the 2.6.2 milestone Apr 20, 2023
@TechLord22 TechLord22 merged commit 373135f into GregTechCEu:master Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants