Fixes registration of recipes when one of the recipes throws an unexpected unchecked exception during registration. Before, the registration would simply cancel and not log any errors in this case. Fixes issues with outdated IC2 integration (Macerator recipes) causing certain recipes to become non-functional.
This commit is contained in:
parent
af54883fd3
commit
2f8013a49b
|
@ -32,7 +32,6 @@ import java.util.Map.Entry;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
@ -371,65 +370,52 @@ public class RecipeHandler implements IRecipeHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
final Map<Class, Integer> processed = new HashMap<Class, Integer>();
|
final Map<Class, Integer> processed = new HashMap<Class, Integer>();
|
||||||
try
|
for( final ICraftHandler ch : this.data.handlers )
|
||||||
{
|
{
|
||||||
for( final ICraftHandler ch : this.data.handlers )
|
try
|
||||||
{
|
{
|
||||||
try
|
ch.register();
|
||||||
{
|
|
||||||
ch.register();
|
|
||||||
|
|
||||||
final Class clz = ch.getClass();
|
final Class clz = ch.getClass();
|
||||||
final Integer i = processed.get( clz );
|
final Integer i = processed.get( clz );
|
||||||
if( i == null )
|
if( i == null )
|
||||||
{
|
|
||||||
processed.put( clz, 1 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
processed.put( clz, i + 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch( final RegistrationError e )
|
|
||||||
{
|
{
|
||||||
AELog.warn( "Unable to register a recipe: " + e.getMessage() );
|
processed.put( clz, 1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
processed.put( clz, i + 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( final MissingIngredientError e )
|
||||||
|
{
|
||||||
|
if( this.data.errorOnMissing )
|
||||||
|
{
|
||||||
|
AELog.warn( "Unable to register a recipe:" + e.getMessage() );
|
||||||
if( this.data.exceptions )
|
if( this.data.exceptions )
|
||||||
{
|
{
|
||||||
AELog.debug( e );
|
AELog.debug( e );
|
||||||
}
|
}
|
||||||
if( this.data.crash )
|
if( this.data.crash )
|
||||||
{
|
{
|
||||||
throw e;
|
throw new IllegalStateException( e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( final MissingIngredientError e )
|
}
|
||||||
|
catch( final Throwable e )
|
||||||
|
{
|
||||||
|
AELog.warn( "Unable to register a recipe: " + e.getMessage() );
|
||||||
|
if( this.data.exceptions )
|
||||||
{
|
{
|
||||||
if( this.data.errorOnMissing )
|
AELog.debug( e );
|
||||||
{
|
}
|
||||||
AELog.warn( "Unable to register a recipe:" + e.getMessage() );
|
if( this.data.crash )
|
||||||
if( this.data.exceptions )
|
{
|
||||||
{
|
throw new IllegalStateException( e );
|
||||||
AELog.debug( e );
|
|
||||||
}
|
|
||||||
if( this.data.crash )
|
|
||||||
{
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( final Throwable e )
|
|
||||||
{
|
|
||||||
if( this.data.exceptions )
|
|
||||||
{
|
|
||||||
AELog.debug( e );
|
|
||||||
}
|
|
||||||
if( this.data.crash )
|
|
||||||
{
|
|
||||||
throw new IllegalStateException( e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for( final Entry<Class, Integer> e : processed.entrySet() )
|
for( final Entry<Class, Integer> e : processed.entrySet() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue