Fix Inscriber recipe registration (#3131)

Fixes #3129
This commit is contained in:
fscan 2017-10-02 22:03:22 +02:00 committed by GitHub
parent 1e15b23506
commit e8d554d69d
3 changed files with 13 additions and 12 deletions

View file

@ -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 );

View file

@ -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 )

View file

@ -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<ItemStack> 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() );
}
}