Search in sources :

Example 1 with ForgeLaunch

use of org.spongepowered.forge.launch.ForgeLaunch in project SpongeCommon by SpongePowered.

the class MainMixin_Forge method forge$initLaunch.

@Inject(method = "<clinit>", at = @At("RETURN"))
private static void forge$initLaunch(final CallbackInfo ci) {
    final PluginPlatform pluginPlatform = AppLaunch.pluginPlatform();
    final ForgeLaunch launch = new ForgeLaunch(pluginPlatform);
    Launch.setInstance(launch);
}
Also used : ForgeLaunch(org.spongepowered.forge.launch.ForgeLaunch) PluginPlatform(org.spongepowered.common.applaunch.plugin.PluginPlatform) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 2 with ForgeLaunch

use of org.spongepowered.forge.launch.ForgeLaunch in project SpongeCommon by SpongePowered.

the class MainMixin_Forge method forge$initLaunch.

@Inject(method = "<clinit>", at = @At("RETURN"))
private static void forge$initLaunch(final CallbackInfo ci) {
    if (Launch.instance() != null) {
        return;
    }
    final PluginPlatform pluginPlatform = AppLaunch.pluginPlatform();
    final ForgeLaunch launch = new ForgeLaunch(pluginPlatform);
    Launch.setInstance(launch);
}
Also used : ForgeLaunch(org.spongepowered.forge.launch.ForgeLaunch) PluginPlatform(org.spongepowered.common.applaunch.plugin.PluginPlatform) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 3 with ForgeLaunch

use of org.spongepowered.forge.launch.ForgeLaunch in project SpongeCommon by SpongePowered.

the class BootstrapMixin_Forge method forge$startLifecycle.

// @formatter:on
@Inject(method = "bootStrap", at = @At("HEAD"))
private static void forge$startLifecycle(final CallbackInfo ci) {
    if (BootstrapMixin_Forge.isBootstrapped) {
        return;
    }
    final ForgeLaunch launch = Launch.instance();
    final Stage stage = SpongeGuice.getInjectorStage(launch.injectionStage());
    SpongeCommon.logger().debug("Creating injector in stage '{}'", stage);
    final Injector bootstrapInjector = launch.createInjector();
    final SpongeLifecycle lifecycle = bootstrapInjector.getInstance(SpongeLifecycle.class);
    launch.setLifecycle(lifecycle);
    lifecycle.establishFactories();
    lifecycle.establishBuilders();
    lifecycle.initTimings();
}
Also used : Injector(com.google.inject.Injector) Stage(com.google.inject.Stage) SpongeLifecycle(org.spongepowered.common.SpongeLifecycle) ForgeLaunch(org.spongepowered.forge.launch.ForgeLaunch) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

Inject (org.spongepowered.asm.mixin.injection.Inject)3 ForgeLaunch (org.spongepowered.forge.launch.ForgeLaunch)3 PluginPlatform (org.spongepowered.common.applaunch.plugin.PluginPlatform)2 Injector (com.google.inject.Injector)1 Stage (com.google.inject.Stage)1 SpongeLifecycle (org.spongepowered.common.SpongeLifecycle)1