mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 02:55:17 +00:00
Shut down all other mod handlers if the loading cycle errors.
This prevents other mods from throwing errors and being blamed for initial cause. This is a temporary hack until cpw re-writes the mod event dispatcher.
This commit is contained in:
1 parent
30bad1e26d
commit
7592bbe87e
3 files changed
+10
No files matched your search
@@ -104,6 +104,7 @@ public abstract class ModContainer
|
|||||||
*/
|
*/
|
||||||
public final void transitionState(LifecycleEventProvider.LifecycleEvent event, Consumer<List<ModLoadingException>> errorHandler)
|
public final void transitionState(LifecycleEventProvider.LifecycleEvent event, Consumer<List<ModLoadingException>> errorHandler)
|
||||||
{
|
{
|
||||||
|
if (shutdown) return; //TODO: Remove
|
||||||
if (modLoadingStage == event.fromStage())
|
if (modLoadingStage == event.fromStage())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -165,4 +166,11 @@ public abstract class ModContainer
|
|||||||
* @param e Event to accept
|
* @param e Event to accept
|
||||||
*/
|
*/
|
||||||
protected void acceptEvent(Event e) {}
|
protected void acceptEvent(Event e) {}
|
||||||
|
|
||||||
|
//TEMPORARY INTERNAL FUNCTION UNTIL net.minecraftforge.fml.ModList.dispatchParallelEvent is fixed.
|
||||||
|
@Deprecated protected boolean shutdown = false;
|
||||||
|
@Deprecated protected void shutdown()
|
||||||
|
{
|
||||||
|
this.shutdown = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -141,6 +141,7 @@ public class ModList
|
|||||||
catch (InterruptedException | ExecutionException e)
|
catch (InterruptedException | ExecutionException e)
|
||||||
{
|
{
|
||||||
LOGGER.error(LOADING, "Encountered an exception during parallel processing - sleeping 10 seconds to wait for jobs to finish", e);
|
LOGGER.error(LOADING, "Encountered an exception during parallel processing - sleeping 10 seconds to wait for jobs to finish", e);
|
||||||
|
this.mods.forEach(ModContainer::shutdown); //Prevent all future events from being sent out.
|
||||||
errorHandler.accept(Collections.singletonList(new UncaughtModLoadingException(lifecycleEvent.fromStage(), e)));
|
errorHandler.accept(Collections.singletonList(new UncaughtModLoadingException(lifecycleEvent.fromStage(), e)));
|
||||||
modLoadingThreadPool.awaitQuiescence(10, TimeUnit.SECONDS);
|
modLoadingThreadPool.awaitQuiescence(10, TimeUnit.SECONDS);
|
||||||
if (!modLoadingThreadPool.isQuiescent()) {
|
if (!modLoadingThreadPool.isQuiescent()) {
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ public class FMLModContainer extends ModContainer
|
|||||||
@Override
|
@Override
|
||||||
protected void acceptEvent(final Event e)
|
protected void acceptEvent(final Event e)
|
||||||
{
|
{
|
||||||
|
if (this.shutdown) return;
|
||||||
this.eventBus.post(e);
|
this.eventBus.post(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user