Fixes #624 Missing check to disable features
This commit is contained in:
parent
608d58277f
commit
21b70d0dda
1 changed files with 20 additions and 12 deletions
|
@ -118,6 +118,7 @@ import appeng.core.features.AEFeature;
|
||||||
import appeng.core.features.ColoredItemDefinition;
|
import appeng.core.features.ColoredItemDefinition;
|
||||||
import appeng.core.features.DamagedItemDefinition;
|
import appeng.core.features.DamagedItemDefinition;
|
||||||
import appeng.core.features.IAEFeature;
|
import appeng.core.features.IAEFeature;
|
||||||
|
import appeng.core.features.IFeatureHandler;
|
||||||
import appeng.core.features.IStackSrc;
|
import appeng.core.features.IStackSrc;
|
||||||
import appeng.core.features.ItemStackSrc;
|
import appeng.core.features.ItemStackSrc;
|
||||||
import appeng.core.features.NullItemDefinition;
|
import appeng.core.features.NullItemDefinition;
|
||||||
|
@ -506,26 +507,33 @@ public class Registration
|
||||||
|
|
||||||
private AEItemDefinition addFeature( Class<? extends IAEFeature> featureClass, Object... args )
|
private AEItemDefinition addFeature( Class<? extends IAEFeature> featureClass, Object... args )
|
||||||
{
|
{
|
||||||
ClassInstantiation<IAEFeature> instantiation = new ClassInstantiation<IAEFeature>( featureClass, args );
|
final ClassInstantiation<IAEFeature> instantiation = new ClassInstantiation<IAEFeature>( featureClass, args );
|
||||||
Optional<IAEFeature> instance = instantiation.get();
|
final Optional<IAEFeature> instance = instantiation.get();
|
||||||
|
|
||||||
if ( instance.isPresent() )
|
if ( instance.isPresent() )
|
||||||
{
|
{
|
||||||
IAEFeature feature = instance.get();
|
final IAEFeature feature = instance.get();
|
||||||
|
final IFeatureHandler handler = feature.handler();
|
||||||
for ( AEFeature f : feature.handler().getFeatures() )
|
if ( handler.isFeatureAvailable() )
|
||||||
|
{
|
||||||
|
for ( AEFeature f : handler.getFeatures() )
|
||||||
{
|
{
|
||||||
this.featuresToEntities.put( f, featureClass );
|
this.featuresToEntities.put( f, featureClass );
|
||||||
}
|
}
|
||||||
|
|
||||||
feature.handler().register();
|
handler.register();
|
||||||
feature.postInit();
|
feature.postInit();
|
||||||
|
|
||||||
return feature.handler().getDefinition();
|
return handler.getDefinition();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new RuntimeException( "Error with Feature: " + featureClass.getName() );
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new RuntimeException( "Error upon Class Instantiation with Feature: " + featureClass.getName() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue