Make `IRecipeBuilder.setMirrored` accept a boolean
ChiriVulpes opened this issue ยท 3 comments
IRecipeBuilder.setMirrored()
is a one-way operation, but I believe recipe builders are otherwise completely reusable (IE: from any recipe builder for a table, you can modify it via its methods to reflect any other recipe builder for that same table).
To be consistent, this method could accept a boolean
for whether the recipe can be mirrored. This would match the setConsume
and setHidden
methods.
I agree that these three methods could use some conformity:
RecipeBuilder setMirrored();
RecipeBuilder setConsumeExperience(boolean consumeExperience);
RecipeBuilder setHidden(@Optional(default = true) hidden);
I think all three methods should conform and have @Optional(default = true)
as a parameter. Making the parameter optional would have the least impact on existing scripts.
RecipeBuilder
's are not reusable, they only give the illusion of reusability.
When RecipeBuilder.get("sometable")
is called a new recipe builder is internally created and used until .create()
is called, then the internal builder is interrogated and discarded, after which a new builder is internally assigned and used.
Now, I think there is a case where a script might create a builder, then maybe pass it to several methods each of which, based on criteria, would set these boolean flags, potentially overwriting the flag previously set by another method. I think it's an edge case, and weird / bad scripting, but a case nonetheless.
I can't immediately think of any other cases where the flag would be set to true
by a script, then set back to false
before calling .create()
.
Ah, so basically, from the user's perspective, everything set is discarded on the RecipeBuilder
after calling .create()
? My bad, I misunderstood. I assumed you could design a recipe, change like one thing, then create another.
It might be worth noting that users of the static API can't make use of the @Optional
, and would be required to pass a boolean unless a no-arg override is added?
There is also the method setConsumeSecondaryIngredients
which accepts a boolean
, by the way.
I plan to work on automation soon(TM) and may have to make changes (hopefully only additions) to the API. When that happens, it would be a good time to make these adjustments.
RecipeBuilder setMirrored(@Optional(default = true) boolean mirrored);
RecipeBuilder setConsumeExperience(@Optional(default = true) boolean consumeExperience);
RecipeBuilder setHidden(@Optional(default = true) boolean hidden);
RecipeBuilder setConsumeSecondaryIngredients(@Optional(default = true) boolean consumeSecondaryIngredients);
IRecipeBuilder setMirrored();
IRecipeBuilder setMirrored(boolean mirrored);
IRecipeBuilder setConsumeSecondaryIngredients();
IRecipeBuilder setConsumeSecondaryIngredients(boolean consumeSecondaryIngredients);
IRecipeBuilder setConsumeExperience();
IRecipeBuilder setConsumeExperience(boolean consumeExperience);
IRecipeBuilder setHidden();
IRecipeBuilder setHidden(boolean hidden);