Refactored GrinderRegistry. (#2644)
* Refactored GrinderRegistry. Changed IGrinderRegistry#getRecipes to return an unmodifiable collection. Added a way to remove recipes explicitly instead the internal list. Added a cache to lookup recipes instead of iterating a list. Renamed IGrinderEntry to IGrinderRecipe Made IGrindRecipe immutable for easy caching. Improved GrinderLogging and Exception Handling JEI Workaround as it expects a List instead Collection. * Added blacklist of explicit oredict names for the grindstone. This can be used should the automatic recipe generation create unintended loopholes.
This commit is contained in:
@@ -31,15 +31,15 @@ import net.minecraft.item.ItemStack;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
|
||||
import appeng.api.features.IGrinderEntry;
|
||||
import appeng.api.features.IGrinderRecipe;
|
||||
|
||||
|
||||
class GrinderRecipeWrapper extends BlankRecipeWrapper
|
||||
{
|
||||
|
||||
private final IGrinderEntry recipe;
|
||||
private final IGrinderRecipe recipe;
|
||||
|
||||
GrinderRecipeWrapper( IGrinderEntry recipe )
|
||||
GrinderRecipeWrapper( IGrinderRecipe recipe )
|
||||
{
|
||||
this.recipe = recipe;
|
||||
}
|
||||
@@ -50,14 +50,8 @@ class GrinderRecipeWrapper extends BlankRecipeWrapper
|
||||
ingredients.setInput( ItemStack.class, recipe.getInput() );
|
||||
List<ItemStack> outputs = new ArrayList<>( 3 );
|
||||
outputs.add( recipe.getOutput() );
|
||||
if( recipe.getOptionalOutput() != null )
|
||||
{
|
||||
outputs.add( recipe.getOptionalOutput() );
|
||||
}
|
||||
if( recipe.getSecondOptionalOutput() != null )
|
||||
{
|
||||
outputs.add( recipe.getSecondOptionalOutput() );
|
||||
}
|
||||
recipe.getOptionalOutput().ifPresent( outputs::add );
|
||||
recipe.getSecondOptionalOutput().ifPresent( outputs::add );
|
||||
ingredients.setOutputs( ItemStack.class, outputs );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user