Search in sources :

Example 1 with LoadPrefabs

use of org.terasology.engine.core.modes.loadProcesses.LoadPrefabs in project Terasology by MovingBlocks.

the class HeadlessEnvironment method loadPrefabs.

@Override
protected void loadPrefabs() {
    LoadPrefabs prefabLoadStep = new LoadPrefabs(context);
    boolean complete = false;
    prefabLoadStep.begin();
    while (!complete) {
        complete = prefabLoadStep.step();
    }
}
Also used : LoadPrefabs(org.terasology.engine.core.modes.loadProcesses.LoadPrefabs)

Example 2 with LoadPrefabs

use of org.terasology.engine.core.modes.loadProcesses.LoadPrefabs in project Terasology by MovingBlocks.

the class StateLoading method initClient.

private void initClient() {
    loadProcesses.add(new JoinServer(context, gameManifest, joinStatus));
    if (!headless) {
        loadProcesses.add(new InitialiseRendering(context));
    }
    loadProcesses.add(new InitialiseEntitySystem(context));
    loadProcesses.add(new RegisterBlocks(context, gameManifest));
    if (!headless) {
        loadProcesses.add(new InitialiseGraphics(context));
    }
    loadProcesses.add(new LoadPrefabs(context));
    loadProcesses.add(new ProcessBlockPrefabs(context));
    loadProcesses.add(new LoadExtraBlockData(context));
    loadProcesses.add(new InitialiseComponentSystemManager(context));
    if (!headless) {
        loadProcesses.add(new RegisterInputSystem(context));
    }
    loadProcesses.add(new RegisterSystems(context, netMode));
    loadProcesses.add(new InitialiseCommandSystem(context));
    loadProcesses.add(new InitialiseRemoteWorld(context, gameManifest));
    loadProcesses.add(new InitialisePhysics(context));
    loadProcesses.add(new InitialiseSystems(context));
    loadProcesses.add(new PreBeginSystems(context));
    loadProcesses.add(new CreateRemoteWorldEntity(context));
    loadProcesses.add(new PostBeginSystems(context));
    loadProcesses.add(new SetupRemotePlayer(context));
    loadProcesses.add(new AwaitCharacterSpawn(context));
    loadProcesses.add(new RegisterBlockFamilies(context));
    loadProcesses.add(new PrepareWorld(context));
}
Also used : CreateRemoteWorldEntity(org.terasology.engine.core.modes.loadProcesses.CreateRemoteWorldEntity) RegisterBlockFamilies(org.terasology.engine.core.modes.loadProcesses.RegisterBlockFamilies) InitialiseGraphics(org.terasology.engine.core.modes.loadProcesses.InitialiseGraphics) RegisterInputSystem(org.terasology.engine.core.modes.loadProcesses.RegisterInputSystem) PreBeginSystems(org.terasology.engine.core.modes.loadProcesses.PreBeginSystems) InitialiseComponentSystemManager(org.terasology.engine.core.modes.loadProcesses.InitialiseComponentSystemManager) SetupRemotePlayer(org.terasology.engine.core.modes.loadProcesses.SetupRemotePlayer) RegisterBlocks(org.terasology.engine.core.modes.loadProcesses.RegisterBlocks) InitialiseRemoteWorld(org.terasology.engine.core.modes.loadProcesses.InitialiseRemoteWorld) InitialiseSystems(org.terasology.engine.core.modes.loadProcesses.InitialiseSystems) InitialiseEntitySystem(org.terasology.engine.core.modes.loadProcesses.InitialiseEntitySystem) InitialiseRendering(org.terasology.engine.core.modes.loadProcesses.InitialiseRendering) RegisterSystems(org.terasology.engine.core.modes.loadProcesses.RegisterSystems) InitialisePhysics(org.terasology.engine.core.modes.loadProcesses.InitialisePhysics) PostBeginSystems(org.terasology.engine.core.modes.loadProcesses.PostBeginSystems) LoadPrefabs(org.terasology.engine.core.modes.loadProcesses.LoadPrefabs) ProcessBlockPrefabs(org.terasology.engine.core.modes.loadProcesses.ProcessBlockPrefabs) LoadExtraBlockData(org.terasology.engine.core.modes.loadProcesses.LoadExtraBlockData) InitialiseCommandSystem(org.terasology.engine.core.modes.loadProcesses.InitialiseCommandSystem) JoinServer(org.terasology.engine.core.modes.loadProcesses.JoinServer) AwaitCharacterSpawn(org.terasology.engine.core.modes.loadProcesses.AwaitCharacterSpawn) PrepareWorld(org.terasology.engine.core.modes.loadProcesses.PrepareWorld)

Example 3 with LoadPrefabs

use of org.terasology.engine.core.modes.loadProcesses.LoadPrefabs in project Terasology by MovingBlocks.

the class StateLoading method initHost.

private void initHost() {
    loadProcesses.add(new RegisterMods(context, gameManifest));
    if (!headless) {
        loadProcesses.add(new InitialiseRendering(context));
    }
    loadProcesses.add(new InitialiseEntitySystem(context));
    loadProcesses.add(new RegisterBlocks(context, gameManifest));
    if (!headless) {
        loadProcesses.add(new InitialiseGraphics(context));
    }
    loadProcesses.add(new LoadPrefabs(context));
    loadProcesses.add(new ProcessBlockPrefabs(context));
    loadProcesses.add(new InitialiseComponentSystemManager(context));
    if (!headless) {
        loadProcesses.add(new RegisterInputSystem(context));
    }
    loadProcesses.add(new RegisterSystems(context, netMode));
    loadProcesses.add(new InitialiseCommandSystem(context));
    loadProcesses.add(new LoadExtraBlockData(context));
    loadProcesses.add(new InitialiseWorld(gameManifest, context));
    loadProcesses.add(new RegisterBlockFamilies(context));
    loadProcesses.add(new EnsureSaveGameConsistency(context));
    loadProcesses.add(new InitialisePhysics(context));
    loadProcesses.add(new InitialiseSystems(context));
    loadProcesses.add(new PreBeginSystems(context));
    loadProcesses.add(new LoadEntities(context));
    loadProcesses.add(new InitialiseBlockTypeEntities(context));
    loadProcesses.add(new CreateWorldEntity(context, gameManifest));
    loadProcesses.add(new InitialiseWorldGenerator(context));
    loadProcesses.add(new InitialiseRecordAndReplay(context));
    if (netMode.isServer()) {
        boolean dedicated;
        if (netMode == NetworkMode.DEDICATED_SERVER) {
            dedicated = true;
        } else if (netMode == NetworkMode.LISTEN_SERVER) {
            dedicated = false;
        } else {
            throw new IllegalStateException("Invalid server mode: " + netMode);
        }
        loadProcesses.add(new StartServer(context, dedicated));
    }
    loadProcesses.add(new PostBeginSystems(context));
    if (netMode.hasLocalClient()) {
        loadProcesses.add(new SetupLocalPlayer(context));
        loadProcesses.add(new AwaitCharacterSpawn(context));
    }
    loadProcesses.add(new PrepareWorld(context));
}
Also used : InitialiseWorld(org.terasology.engine.core.modes.loadProcesses.InitialiseWorld) RegisterBlockFamilies(org.terasology.engine.core.modes.loadProcesses.RegisterBlockFamilies) InitialiseGraphics(org.terasology.engine.core.modes.loadProcesses.InitialiseGraphics) RegisterInputSystem(org.terasology.engine.core.modes.loadProcesses.RegisterInputSystem) PreBeginSystems(org.terasology.engine.core.modes.loadProcesses.PreBeginSystems) InitialiseComponentSystemManager(org.terasology.engine.core.modes.loadProcesses.InitialiseComponentSystemManager) RegisterBlocks(org.terasology.engine.core.modes.loadProcesses.RegisterBlocks) InitialiseSystems(org.terasology.engine.core.modes.loadProcesses.InitialiseSystems) SetupLocalPlayer(org.terasology.engine.core.modes.loadProcesses.SetupLocalPlayer) InitialisePhysics(org.terasology.engine.core.modes.loadProcesses.InitialisePhysics) PostBeginSystems(org.terasology.engine.core.modes.loadProcesses.PostBeginSystems) LoadPrefabs(org.terasology.engine.core.modes.loadProcesses.LoadPrefabs) ProcessBlockPrefabs(org.terasology.engine.core.modes.loadProcesses.ProcessBlockPrefabs) PrepareWorld(org.terasology.engine.core.modes.loadProcesses.PrepareWorld) LoadEntities(org.terasology.engine.core.modes.loadProcesses.LoadEntities) EnsureSaveGameConsistency(org.terasology.engine.core.modes.loadProcesses.EnsureSaveGameConsistency) RegisterMods(org.terasology.engine.core.modes.loadProcesses.RegisterMods) InitialiseBlockTypeEntities(org.terasology.engine.core.modes.loadProcesses.InitialiseBlockTypeEntities) CreateWorldEntity(org.terasology.engine.core.modes.loadProcesses.CreateWorldEntity) InitialiseEntitySystem(org.terasology.engine.core.modes.loadProcesses.InitialiseEntitySystem) InitialiseRendering(org.terasology.engine.core.modes.loadProcesses.InitialiseRendering) RegisterSystems(org.terasology.engine.core.modes.loadProcesses.RegisterSystems) InitialiseRecordAndReplay(org.terasology.engine.core.modes.loadProcesses.InitialiseRecordAndReplay) InitialiseWorldGenerator(org.terasology.engine.core.modes.loadProcesses.InitialiseWorldGenerator) LoadExtraBlockData(org.terasology.engine.core.modes.loadProcesses.LoadExtraBlockData) InitialiseCommandSystem(org.terasology.engine.core.modes.loadProcesses.InitialiseCommandSystem) AwaitCharacterSpawn(org.terasology.engine.core.modes.loadProcesses.AwaitCharacterSpawn) StartServer(org.terasology.engine.core.modes.loadProcesses.StartServer)

Example 4 with LoadPrefabs

use of org.terasology.engine.core.modes.loadProcesses.LoadPrefabs in project Terasology by MovingBlocks.

the class TerasologyTestingEnvironment method setup.

@BeforeEach
public void setup() throws Exception {
    context.put(ModuleManager.class, moduleManager);
    RecordAndReplayCurrentStatus recordAndReplayCurrentStatus = context.get(RecordAndReplayCurrentStatus.class);
    mockTime = mock(EngineTime.class);
    context.put(Time.class, mockTime);
    NetworkSystemImpl networkSystem = new NetworkSystemImpl(mockTime, context);
    context.put(Game.class, new Game());
    context.put(NetworkSystem.class, networkSystem);
    EntitySystemSetupUtil.addReflectionBasedLibraries(context);
    EntitySystemSetupUtil.addEntityManagementRelatedClasses(context);
    engineEntityManager = context.get(EngineEntityManager.class);
    // 'mock' added to avoid hiding a field
    BlockManager mockBlockManager = context.get(BlockManager.class);
    ExtraBlockDataManager extraDataManager = context.get(ExtraBlockDataManager.class);
    RecordedEventStore recordedEventStore = new RecordedEventStore();
    RecordAndReplayUtils recordAndReplayUtils = new RecordAndReplayUtils();
    context.put(RecordAndReplayUtils.class, recordAndReplayUtils);
    CharacterStateEventPositionMap characterStateEventPositionMap = new CharacterStateEventPositionMap();
    context.put(CharacterStateEventPositionMap.class, characterStateEventPositionMap);
    DirectionAndOriginPosRecorderList directionAndOriginPosRecorderList = new DirectionAndOriginPosRecorderList();
    context.put(DirectionAndOriginPosRecorderList.class, directionAndOriginPosRecorderList);
    RecordAndReplaySerializer recordAndReplaySerializer = new RecordAndReplaySerializer(engineEntityManager, recordedEventStore, recordAndReplayUtils, characterStateEventPositionMap, directionAndOriginPosRecorderList, moduleManager, context.get(TypeRegistry.class));
    context.put(RecordAndReplaySerializer.class, recordAndReplaySerializer);
    Path savePath = PathManager.getInstance().getSavePath("world1");
    context.put(StorageManager.class, new ReadWriteStorageManager(savePath, moduleManager.getEnvironment(), engineEntityManager, mockBlockManager, extraDataManager, recordAndReplaySerializer, recordAndReplayUtils, recordAndReplayCurrentStatus));
    ComponentSystemManager componentSystemManager = new ComponentSystemManager(context);
    context.put(ComponentSystemManager.class, componentSystemManager);
    LoadPrefabs prefabLoadStep = new LoadPrefabs(context);
    boolean complete = false;
    prefabLoadStep.begin();
    while (!complete) {
        complete = prefabLoadStep.step();
    }
    context.get(ComponentSystemManager.class).initialise();
    context.put(Console.class, new ConsoleImpl(context));
}
Also used : EngineEntityManager(org.terasology.engine.entitySystem.entity.internal.EngineEntityManager) Path(java.nio.file.Path) ConsoleImpl(org.terasology.engine.logic.console.ConsoleImpl) EngineTime(org.terasology.engine.core.EngineTime) RecordedEventStore(org.terasology.engine.recording.RecordedEventStore) ExtraBlockDataManager(org.terasology.engine.world.chunks.blockdata.ExtraBlockDataManager) TypeRegistry(org.terasology.reflection.TypeRegistry) NetworkSystemImpl(org.terasology.engine.network.internal.NetworkSystemImpl) RecordAndReplaySerializer(org.terasology.engine.recording.RecordAndReplaySerializer) ComponentSystemManager(org.terasology.engine.core.ComponentSystemManager) DirectionAndOriginPosRecorderList(org.terasology.engine.recording.DirectionAndOriginPosRecorderList) Game(org.terasology.engine.game.Game) LoadPrefabs(org.terasology.engine.core.modes.loadProcesses.LoadPrefabs) BlockManager(org.terasology.engine.world.block.BlockManager) RecordAndReplayUtils(org.terasology.engine.recording.RecordAndReplayUtils) RecordAndReplayCurrentStatus(org.terasology.engine.recording.RecordAndReplayCurrentStatus) ReadWriteStorageManager(org.terasology.engine.persistence.internal.ReadWriteStorageManager) CharacterStateEventPositionMap(org.terasology.engine.recording.CharacterStateEventPositionMap) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

LoadPrefabs (org.terasology.engine.core.modes.loadProcesses.LoadPrefabs)4 AwaitCharacterSpawn (org.terasology.engine.core.modes.loadProcesses.AwaitCharacterSpawn)2 InitialiseCommandSystem (org.terasology.engine.core.modes.loadProcesses.InitialiseCommandSystem)2 InitialiseComponentSystemManager (org.terasology.engine.core.modes.loadProcesses.InitialiseComponentSystemManager)2 InitialiseEntitySystem (org.terasology.engine.core.modes.loadProcesses.InitialiseEntitySystem)2 InitialiseGraphics (org.terasology.engine.core.modes.loadProcesses.InitialiseGraphics)2 InitialisePhysics (org.terasology.engine.core.modes.loadProcesses.InitialisePhysics)2 InitialiseRendering (org.terasology.engine.core.modes.loadProcesses.InitialiseRendering)2 InitialiseSystems (org.terasology.engine.core.modes.loadProcesses.InitialiseSystems)2 LoadExtraBlockData (org.terasology.engine.core.modes.loadProcesses.LoadExtraBlockData)2 PostBeginSystems (org.terasology.engine.core.modes.loadProcesses.PostBeginSystems)2 PreBeginSystems (org.terasology.engine.core.modes.loadProcesses.PreBeginSystems)2 PrepareWorld (org.terasology.engine.core.modes.loadProcesses.PrepareWorld)2 ProcessBlockPrefabs (org.terasology.engine.core.modes.loadProcesses.ProcessBlockPrefabs)2 RegisterBlockFamilies (org.terasology.engine.core.modes.loadProcesses.RegisterBlockFamilies)2 RegisterBlocks (org.terasology.engine.core.modes.loadProcesses.RegisterBlocks)2 RegisterInputSystem (org.terasology.engine.core.modes.loadProcesses.RegisterInputSystem)2 RegisterSystems (org.terasology.engine.core.modes.loadProcesses.RegisterSystems)2 Path (java.nio.file.Path)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1