Basic error display GUI.

This commit is contained in:
cpw committed 2018-09-28 21:07:46 -04:00
1 parent dec65732ce
commit bb9eca96a8
26 files changed
+451 -83

No files matched your search

@@ -23,12 +23,13 @@ import net.minecraftforge.eventbus.EventBusErrorMessage;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.IEventListener;
import net.minecraftforge.fml.AutomaticEventSubscriber;
import net.minecraftforge.fml.LifecycleEventProvider;
import net.minecraftforge.fml.ModContainer;
import net.minecraftforge.fml.ModLoadingException;
import net.minecraftforge.fml.ModLoadingStage;
import net.minecraftforge.fml.ModThreadContext;
import net.minecraftforge.fml.common.event.ModLifecycleEvent;
import net.minecraftforge.fml.AutomaticEventSubscriber;
import net.minecraftforge.fml.ModLoadingStage;
import net.minecraftforge.fml.ModContainer;
import net.minecraftforge.fml.language.IModInfo;
import net.minecraftforge.fml.language.ModFileScanData;
@@ -67,7 +68,7 @@ public class FMLModContainer extends ModContainer
catch (Throwable e)
{
LOGGER.error(LOADING, "Failed to load class {}", className, e);
throw new RuntimeException(e);
throw new ModLoadingException(info, ModLoadingStage.CONSTRUCT, "fml.modloading.failedtoloadmodclass", e);
}
}
@@ -86,7 +87,7 @@ public class FMLModContainer extends ModContainer
private void onEventFailed(IEventBus iEventBus, Event event, IEventListener[] iEventListeners, int i, Throwable throwable)
{
LOGGER.error(new EventBusErrorMessage(event, i, iEventListeners, throwable));
modLoadingError.add(throwable);
}
private void beforeEvent(LifecycleEventProvider.LifecycleEvent lifecycleEvent) {
@@ -105,8 +106,7 @@ public class FMLModContainer extends ModContainer
catch (Throwable e)
{
LOGGER.error(LOADING,"Caught exception during event {} dispatch for modid {}", event, this.getModId(), e);
modLoadingStage = ModLoadingStage.ERROR;
modLoadingError.add(e);
throw new ModLoadingException(modInfo, lifecycleEvent.fromStage(), "fml.modloading.errorduringevent", e);
}
}
@@ -120,7 +120,9 @@ public class FMLModContainer extends ModContainer
private void preinitMod(LifecycleEventProvider.LifecycleEvent lifecycleEvent)
{
LOGGER.debug(LOADING, "Injecting Automatic event subscribers for {}", getModId());
AutomaticEventSubscriber.inject(this, this.scanResults, this.modClass.getClassLoader());
LOGGER.debug(LOADING, "Completed Automatic event subscribers for {}", getModId());
}
private void constructMod(LifecycleEventProvider.LifecycleEvent event)
@@ -134,8 +136,7 @@ public class FMLModContainer extends ModContainer
catch (Throwable e)
{
LOGGER.error(LOADING,"Failed to create mod instance. ModID: {}, class {}", getModId(), modClass.getName(), e);
modLoadingStage = ModLoadingStage.ERROR;
modLoadingError.add(e);
throw new ModLoadingException(modInfo, event.fromStage(), "fml.modloading.failedtoloadmod", e, modClass);
}
}