Search in sources :

Example 6 with NetworkSystemImpl

use of org.terasology.network.internal.NetworkSystemImpl in project Terasology by MovingBlocks.

the class TerasologyTestingEnvironment method setup.

@Before
public void setup() throws Exception {
    context.put(ModuleManager.class, moduleManager);
    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);
    BiomeManager biomeManager = context.get(BiomeManager.class);
    Path savePath = PathManager.getInstance().getSavePath("world1");
    context.put(StorageManager.class, new ReadWriteStorageManager(savePath, moduleManager.getEnvironment(), engineEntityManager, mockBlockManager, biomeManager));
    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.entitySystem.entity.internal.EngineEntityManager) BiomeManager(org.terasology.world.biomes.BiomeManager) Path(java.nio.file.Path) Game(org.terasology.game.Game) LoadPrefabs(org.terasology.engine.modes.loadProcesses.LoadPrefabs) ConsoleImpl(org.terasology.logic.console.ConsoleImpl) BlockManager(org.terasology.world.block.BlockManager) EngineTime(org.terasology.engine.EngineTime) ReadWriteStorageManager(org.terasology.persistence.internal.ReadWriteStorageManager) NetworkSystemImpl(org.terasology.network.internal.NetworkSystemImpl) ComponentSystemManager(org.terasology.engine.ComponentSystemManager) Before(org.junit.Before)

Aggregations

NetworkSystemImpl (org.terasology.network.internal.NetworkSystemImpl)6 EngineTime (org.terasology.engine.EngineTime)4 EngineEntityManager (org.terasology.entitySystem.entity.internal.EngineEntityManager)3 Test (org.junit.Test)2 EntityRef (org.terasology.entitySystem.entity.EntityRef)2 EventLibrary (org.terasology.entitySystem.metadata.EventLibrary)2 NetworkSystem (org.terasology.network.NetworkSystem)2 Path (java.nio.file.Path)1 Before (org.junit.Before)1 ComponentSystemManager (org.terasology.engine.ComponentSystemManager)1 LoadPrefabs (org.terasology.engine.modes.loadProcesses.LoadPrefabs)1 Game (org.terasology.game.Game)1 ConsoleImpl (org.terasology.logic.console.ConsoleImpl)1 LocalPlayer (org.terasology.logic.players.LocalPlayer)1 ReadWriteStorageManager (org.terasology.persistence.internal.ReadWriteStorageManager)1 BiomeManager (org.terasology.world.biomes.BiomeManager)1 BlockManager (org.terasology.world.block.BlockManager)1