use of org.spongepowered.common.launch.Lifecycle in project SpongeCommon by SpongePowered.
the class SpongeForge method onClientSetup.
private void onClientSetup(final FMLClientSetupEvent event) {
final Client minecraft = (Client) event.getMinecraftSupplier().get();
final Lifecycle lifecycle = Launch.instance().lifecycle();
lifecycle.establishGlobalRegistries();
lifecycle.establishDataProviders();
lifecycle.callRegisterDataEvent();
lifecycle.establishClientRegistries(minecraft);
lifecycle.callStartingEngineEvent(minecraft);
}
use of org.spongepowered.common.launch.Lifecycle in project SpongeCommon by SpongePowered.
the class SpongeForge method onCommonSetup.
private void onCommonSetup(final FMLCommonSetupEvent event) {
final Lifecycle lifecycle = Launch.instance().lifecycle();
lifecycle.callConstructEvent();
lifecycle.callRegisterFactoryEvent();
lifecycle.callRegisterBuilderEvent();
lifecycle.callRegisterChannelEvent();
lifecycle.establishGameServices();
lifecycle.establishDataKeyListeners();
SpongePacketHandler.init((SpongeChannelManager) Sponge.channelManager());
// TODO Add attributes for HumanEntity to relevant event
this.logger.info("SpongeForge v{} initialized", Launch.instance().platformPlugin().metadata().version());
}
use of org.spongepowered.common.launch.Lifecycle in project SpongeCommon by SpongePowered.
the class MainMixin method impl$configurePackRepository.
@Redirect(method = "main", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/storage/LevelStorageSource$LevelStorageAccess;getLevelPath(Lnet/minecraft/world/level/storage/LevelResource;)Ljava/nio/file/Path;"))
private static Path impl$configurePackRepository(final LevelStorageSource.LevelStorageAccess levelSave, final LevelResource folderName) {
final Path datapackDir = levelSave.getLevelPath(folderName);
final Lifecycle lifecycle = Launch.instance().lifecycle();
lifecycle.establishGlobalRegistries();
lifecycle.establishDataProviders();
lifecycle.callRegisterDataEvent();
lifecycle.callRegisterDataPackValueEvent(datapackDir);
return datapackDir;
}
use of org.spongepowered.common.launch.Lifecycle in project SpongeCommon by SpongePowered.
the class MinecraftMixin method impl$callStartedEngineAndLoadedGame.
@Inject(method = "<init>", at = @At("RETURN"))
private void impl$callStartedEngineAndLoadedGame(CallbackInfo ci) {
// Save config now that registries have been initialized
ConfigHandle.setSaveSuppressed(false);
final Lifecycle lifecycle = Launch.instance().lifecycle();
lifecycle.callStartedEngineEvent(this);
lifecycle.callLoadedGameEvent();
}
use of org.spongepowered.common.launch.Lifecycle in project SpongeCommon by SpongePowered.
the class SpongeForge method onServerAboutToStart.
@SubscribeEvent
public void onServerAboutToStart(final FMLServerAboutToStartEvent event) {
// Save config now that registries have been initialized
ConfigHandle.setSaveSuppressed(false);
final Lifecycle lifecycle = Launch.instance().lifecycle();
lifecycle.establishServerServices();
lifecycle.establishServerFeatures();
lifecycle.establishServerRegistries((Server) event.getServer());
lifecycle.callStartingEngineEvent((Server) event.getServer());
}
Aggregations