Search in sources :

Example 1 with Lifecycle

use of org.spongepowered.common.launch.Lifecycle in project SpongeCommon by SpongePowered.

the class IntegrationTestLaunch method performIntegrationTests.

private void performIntegrationTests() {
    try {
        // Prepare Vanilla
        Bootstrap.bootStrap();
        Bootstrap.validate();
        // Prepare Sponge
        final Lifecycle lifecycle = Launch.instance().lifecycle();
        lifecycle.establishGlobalRegistries();
        lifecycle.establishDataProviders();
        lifecycle.callRegisterDataEvent();
        this.logger().info("Performing Mixin audit");
        Launch.instance().auditMixins();
    } finally {
        final Queue<String> capturedMessages = this.capturedMessages;
        if (capturedMessages.peek() != null) {
            this.logger().error("Invalid conditions were detected while applying mixins (see MixinLoggerInjector):");
            String message;
            while ((message = capturedMessages.poll()) != null) {
                this.logger().error("- {}", message);
            }
            System.exit(1);
        }
    }
    this.logger().info("Testing complete, goodbye!");
    SpongeCommon.game().asyncScheduler().close();
    System.exit(0);
}
Also used : Lifecycle(org.spongepowered.common.launch.Lifecycle)

Example 2 with Lifecycle

use of org.spongepowered.common.launch.Lifecycle in project SpongeCommon by SpongePowered.

the class IntegratedServerMixin_Vanilla method vanilla$runEngineStartLifecycle.

@SuppressWarnings("ConstantConditions")
@Inject(method = "initServer", at = @At("HEAD"))
private void vanilla$runEngineStartLifecycle(final CallbackInfoReturnable<Boolean> cir) {
    if (!Sponge.isServerAvailable()) {
        ((MinecraftBridge) Minecraft.getInstance()).bridge$setTemporaryIntegratedServer((IntegratedServer) (Object) this);
    }
    final Lifecycle lifecycle = Launch.instance().lifecycle();
    lifecycle.establishServerServices();
    lifecycle.establishServerFeatures();
    lifecycle.establishServerRegistries(this);
    lifecycle.callStartingEngineEvent(this);
}
Also used : Lifecycle(org.spongepowered.common.launch.Lifecycle) MinecraftBridge(org.spongepowered.common.bridge.client.MinecraftBridge) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 3 with Lifecycle

use of org.spongepowered.common.launch.Lifecycle in project SpongeCommon by SpongePowered.

the class DedicatedServerMixin_Vanilla method vanilla$runEngineStartLifecycle.

@Inject(method = "initServer", at = @At("HEAD"))
private void vanilla$runEngineStartLifecycle(final CallbackInfoReturnable<Boolean> cir) {
    // Save config now that registries have been initialized
    ConfigHandle.setSaveSuppressed(false);
    final Lifecycle lifecycle = Launch.instance().lifecycle();
    lifecycle.establishServerServices();
    lifecycle.establishServerFeatures();
    lifecycle.establishServerRegistries(this);
    lifecycle.callStartingEngineEvent(this);
}
Also used : Lifecycle(org.spongepowered.common.launch.Lifecycle) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 4 with Lifecycle

use of org.spongepowered.common.launch.Lifecycle in project SpongeCommon by SpongePowered.

the class MinecraftMixin_Vanilla method vanilla$establishRegistriesAndStartingEngine.

@Inject(method = "run", at = @At("HEAD"))
private void vanilla$establishRegistriesAndStartingEngine(CallbackInfo ci) {
    final Lifecycle lifecycle = Launch.instance().lifecycle();
    lifecycle.establishGlobalRegistries();
    lifecycle.establishDataProviders();
    lifecycle.callRegisterDataEvent();
    lifecycle.establishClientRegistries(this);
    lifecycle.callStartingEngineEvent(this);
}
Also used : Lifecycle(org.spongepowered.common.launch.Lifecycle) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 5 with Lifecycle

use of org.spongepowered.common.launch.Lifecycle in project SpongeCommon by SpongePowered.

the class SpongeForge method onServerStarted.

@SubscribeEvent
public void onServerStarted(final FMLServerStartedEvent event) {
    final Lifecycle lifecycle = Launch.instance().lifecycle();
    lifecycle.callStartedEngineEvent((Server) event.getServer());
}
Also used : Lifecycle(org.spongepowered.common.launch.Lifecycle) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Aggregations

Lifecycle (org.spongepowered.common.launch.Lifecycle)12 Inject (org.spongepowered.asm.mixin.injection.Inject)5 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)3 Path (java.nio.file.Path)1 Client (org.spongepowered.api.Client)1 Redirect (org.spongepowered.asm.mixin.injection.Redirect)1 MinecraftBridge (org.spongepowered.common.bridge.client.MinecraftBridge)1