Cleaning Up Mod Integrations (#2581)

* Cleaned up unused Mod integrations other than for mods that are likely to be integrated soon.
* Introduced an easier Facade class to access mod integration abstractions (called Integrations).
* Removed the link between IntegrationType and integration abstraction. Integrations are now explicitly instantiated inside of IntegrationNode.
This commit is contained in:
shartte
2016-11-06 20:23:14 +01:00
committed by yueh
parent fbb0c05c7f
commit 0e7981d717
73 changed files with 689 additions and 1295 deletions
@@ -22,8 +22,6 @@ package appeng.integration;
import java.util.Collection;
import java.util.LinkedList;
import javax.annotation.Nonnull;
import net.minecraftforge.fml.relauncher.FMLLaunchHandler;
import net.minecraftforge.fml.relauncher.Side;
@@ -32,8 +30,6 @@ public enum IntegrationRegistry
{
INSTANCE;
private static final String PACKAGE_PREFIX = "appeng.integration.modules.";
private final Collection<IntegrationNode> modules = new LinkedList<IntegrationNode>();
public void add( final IntegrationType type )
@@ -48,7 +44,7 @@ public enum IntegrationRegistry
return;
}
this.modules.add( new IntegrationNode( type.dspName, type.modID, type, PACKAGE_PREFIX + type.name() ) );
this.modules.add( new IntegrationNode( type.dspName, type.modID, type ) );
}
public void init()
@@ -83,7 +79,7 @@ public enum IntegrationRegistry
builder.append( ", " );
}
final String integrationState = node.getShortName() + ":" + ( node.getState() == IntegrationStage.FAILED ? "OFF" : "ON" );
final String integrationState = node.getType() + ":" + ( node.getState() == IntegrationStage.FAILED ? "OFF" : "ON" );
builder.append( integrationState );
}
@@ -94,7 +90,7 @@ public enum IntegrationRegistry
{
for( final IntegrationNode node : this.modules )
{
if( node.getShortName() == name )
if( node.getType() == name )
{
return node.isActive();
}
@@ -102,18 +98,4 @@ public enum IntegrationRegistry
return false;
}
@Nonnull
public Object getInstance( final IntegrationType name )
{
for( final IntegrationNode node : this.modules )
{
if( node.getShortName() == name && node.isActive() )
{
return node.getInstance();
}
}
throw new IllegalStateException( "integration with " + name.name() + " is disabled." );
}
}