Search in sources :

Example 6 with StateLoading

use of org.terasology.engine.modes.StateLoading in project Terasology by MovingBlocks.

the class SelectGameScreen method loadGame.

private void loadGame(GameInfo item) {
    try {
        GameManifest manifest = item.getManifest();
        config.getWorldGeneration().setDefaultSeed(manifest.getSeed());
        config.getWorldGeneration().setWorldTitle(manifest.getTitle());
        CoreRegistry.get(GameEngine.class).changeState(new StateLoading(manifest, (loadingAsServer) ? NetworkMode.DEDICATED_SERVER : NetworkMode.NONE));
    } catch (Exception e) {
        logger.error("Failed to load saved game", e);
        getManager().pushScreen(MessagePopup.ASSET_URI, MessagePopup.class).setMessage("Error Loading Game", e.getMessage());
    }
}
Also used : GameManifest(org.terasology.game.GameManifest) StateLoading(org.terasology.engine.modes.StateLoading) GameEngine(org.terasology.engine.GameEngine)

Aggregations

StateLoading (org.terasology.engine.modes.StateLoading)6 GameManifest (org.terasology.game.GameManifest)4 JoinStatus (org.terasology.network.JoinStatus)2 List (java.util.List)1 Set (java.util.Set)1 ComponentSystemManager (org.terasology.engine.ComponentSystemManager)1 GameEngine (org.terasology.engine.GameEngine)1 StateMainMenu (org.terasology.engine.modes.StateMainMenu)1 ThreadManager (org.terasology.engine.subsystem.common.ThreadManager)1 HeadlessStateChangeListener (org.terasology.engine.subsystem.headless.mode.HeadlessStateChangeListener)1 StateHeadlessSetup (org.terasology.engine.subsystem.headless.mode.StateHeadlessSetup)1 EntityRef (org.terasology.entitySystem.entity.EntityRef)1 EngineEntityManager (org.terasology.entitySystem.entity.internal.EngineEntityManager)1 EventSystem (org.terasology.entitySystem.event.internal.EventSystem)1 InputSystem (org.terasology.input.InputSystem)1 ConsoleImpl (org.terasology.logic.console.ConsoleImpl)1 ConsoleSystem (org.terasology.logic.console.ConsoleSystem)1 ConsoleCommand (org.terasology.logic.console.commandSystem.ConsoleCommand)1 Command (org.terasology.logic.console.commandSystem.annotations.Command)1 CoreCommands (org.terasology.logic.console.commands.CoreCommands)1