diff --git a/src/main/java/appeng/core/features/registries/inscriber/InscriberRegistry.java b/src/main/java/appeng/core/features/registries/inscriber/InscriberRegistry.java index 3e4723fae..7bd3e33b2 100644 --- a/src/main/java/appeng/core/features/registries/inscriber/InscriberRegistry.java +++ b/src/main/java/appeng/core/features/registries/inscriber/InscriberRegistry.java @@ -92,8 +92,6 @@ public final class InscriberRegistry implements IInscriberRegistry if( this.recipes.add( recipe ) ) { - this.recipes.add( recipe ); - recipe.getTopOptional().ifPresent( this.optionals::add ); recipe.getBottomOptional().ifPresent( this.optionals::add ); diff --git a/src/main/java/appeng/recipes/RecipeHandler.java b/src/main/java/appeng/recipes/RecipeHandler.java index f2eca06dd..aba06616d 100644 --- a/src/main/java/appeng/recipes/RecipeHandler.java +++ b/src/main/java/appeng/recipes/RecipeHandler.java @@ -403,7 +403,7 @@ public class RecipeHandler implements IRecipeHandler } } } - catch( final Throwable e ) + catch( final RegistrationError e ) { AELog.warn( "Unable to register a recipe: " + e.getMessage() ); if( this.data.exceptions ) diff --git a/src/main/java/appeng/recipes/handlers/Inscribe.java b/src/main/java/appeng/recipes/handlers/Inscribe.java index 58a177f79..d92cffce9 100644 --- a/src/main/java/appeng/recipes/handlers/Inscribe.java +++ b/src/main/java/appeng/recipes/handlers/Inscribe.java @@ -28,7 +28,6 @@ import net.minecraft.item.ItemStack; import appeng.api.AEApi; import appeng.api.exceptions.MissingIngredientError; import appeng.api.exceptions.RegistrationError; -import appeng.api.features.IInscriberRecipe; import appeng.api.features.IInscriberRecipeBuilder; import appeng.api.features.InscriberProcessType; @@ -59,18 +58,22 @@ public final class Inscribe extends InscriberProcess final ItemStack[] realInput = this.getImprintable().getItemStackSet(); final List inputs = new ArrayList<>( realInput.length ); Collections.addAll( inputs, realInput ); - final ItemStack top = ( this.getTopOptional() == null ) ? ItemStack.EMPTY : this.getTopOptional().getItemStack(); - final ItemStack bot = ( this.getBotOptional() == null ) ? ItemStack.EMPTY : this.getBotOptional().getItemStack(); final ItemStack output = this.getOutput().getItemStack(); final InscriberProcessType type = InscriberProcessType.INSCRIBE; - final IInscriberRecipe recipe = builder.withInputs( inputs ) + builder.withInputs( inputs ) .withOutput( output ) - .withTopOptional( top ) - .withBottomOptional( bot ) - .withProcessType( type ) - .build(); + .withProcessType( type ); - AEApi.instance().registries().inscriber().addRecipe( recipe ); + if( this.getTopOptional() != null && !this.getTopOptional().getItemStack().isEmpty() ) + { + builder.withTopOptional( this.getTopOptional().getItemStack() ); + } + if( this.getBotOptional() != null && !this.getBotOptional().getItemStack().isEmpty() ) + { + builder.withBottomOptional( this.getBotOptional().getItemStack() ); + } + + AEApi.instance().registries().inscriber().addRecipe( builder.build() ); } }