Search in sources :

Example 1 with IGenericProgressProvider

use of logisticspipes.proxy.interfaces.IGenericProgressProvider in project LogisticsPipes by RS485.

the class LogisticsWrapperHandler method getWrappedProgressProvider.

public static IGenericProgressProvider getWrappedProgressProvider(String modId, String name, Class<? extends IGenericProgressProvider> providerClass) {
    IGenericProgressProvider provider = null;
    Throwable e = null;
    if (ModStatusHelper.isModLoaded(modId)) {
        try {
            provider = providerClass.newInstance();
        } catch (Exception e1) {
            if (e1 instanceof VersionNotSupportedException) {
                throw (VersionNotSupportedException) e1;
            }
            e1.printStackTrace();
            e = e1;
        } catch (NoClassDefFoundError e1) {
            e1.printStackTrace();
            e = e1;
        }
    }
    GenericProgressProviderWrapper instance = new GenericProgressProviderWrapper(provider, modId + ": " + name);
    if (provider != null) {
        LogisticsPipes.log.info("Loaded " + modId + ", " + name + " ProgressProvider");
    } else {
        if (e != null) {
            instance.setState(WrapperState.Exception);
            instance.setReason(e);
            LogisticsPipes.log.info("Couldn't load " + modId + ", " + name + " ProgressProvider");
        } else {
            LogisticsPipes.log.info("Didn't load " + modId + ", " + name + " ProgressProvider");
            instance.setState(WrapperState.ModMissing);
        }
    }
    instance.setModId(modId);
    LogisticsWrapperHandler.wrapperController.add(instance);
    return instance;
}
Also used : IGenericProgressProvider(logisticspipes.proxy.interfaces.IGenericProgressProvider) VersionNotSupportedException(logisticspipes.proxy.VersionNotSupportedException) VersionNotSupportedException(logisticspipes.proxy.VersionNotSupportedException) IOException(java.io.IOException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 VersionNotSupportedException (logisticspipes.proxy.VersionNotSupportedException)1 IGenericProgressProvider (logisticspipes.proxy.interfaces.IGenericProgressProvider)1