Modify lex's data handler to use proper mod lifecycle event mechanisms

instead. New Lifecycle Event for requesting data harvesting. Mods will
be constructed, the registry will fire, and then a new Data event will
fire. Submit new data tag files to the data gatherer if you wish.
The game will shutdown after this. No other mod elements will happen.

Signed-off-by: cpw <[email protected]>
This commit is contained in:
cpw committed 2019-06-15 21:24:45 -04:00
1 parent 37a896fe1b
commit d821514372
8 files changed
+147 -83

No files matched your search

@@ -37,7 +37,8 @@ public enum LifecycleEventProvider
SIDED_SETUP(()->new LifecycleEvent(ModLoadingStage.SIDED_SETUP)),
ENQUEUE_IMC(()->new LifecycleEvent(ModLoadingStage.ENQUEUE_IMC)),
PROCESS_IMC(()->new LifecycleEvent(ModLoadingStage.PROCESS_IMC)),
COMPLETE(()->new LifecycleEvent(ModLoadingStage.COMPLETE));
COMPLETE(()->new LifecycleEvent(ModLoadingStage.COMPLETE)),
GATHERDATA(()->new GatherDataLifecycleEvent(ModLoadingStage.GATHERDATA), ModList.inlineDispatcher);
private final Supplier<? extends LifecycleEvent> event;
private final BiConsumer<LifecycleEvent, Consumer<List<ModLoadingException>>> eventDispatcher;
@@ -130,4 +131,20 @@ public enum LifecycleEventProvider
}
}
}
private static class GatherDataLifecycleEvent extends LifecycleEvent {
GatherDataLifecycleEvent(final ModLoadingStage stage) {
super(stage);
}
@Override
public ModLoadingStage fromStage() {
return ModLoadingStage.COMMON_SETUP;
}
@Override
public ModLoadingStage toStage() {
return ModLoadingStage.DONE;
}
}
}