Search in sources :

Example 16 with ContextImpl

use of org.terasology.context.internal.ContextImpl in project Terasology by MovingBlocks.

the class BaseEntityRefTest method setupClass.

@BeforeClass
public static void setupClass() throws Exception {
    context = new ContextImpl();
    ModuleManager moduleManager = ModuleManagerFactory.create();
    context.put(ModuleManager.class, moduleManager);
    ModuleAwareAssetTypeManager assetTypeManager = new ModuleAwareAssetTypeManager();
    assetTypeManager.registerCoreAssetType(Prefab.class, (AssetFactory<Prefab, PrefabData>) PojoPrefab::new, "prefabs");
    assetTypeManager.switchEnvironment(moduleManager.getEnvironment());
    context.put(AssetManager.class, assetTypeManager.getAssetManager());
    CoreRegistry.setContext(context);
}
Also used : PrefabData(org.terasology.entitySystem.prefab.PrefabData) ModuleAwareAssetTypeManager(org.terasology.assets.module.ModuleAwareAssetTypeManager) ContextImpl(org.terasology.context.internal.ContextImpl) ModuleManager(org.terasology.engine.module.ModuleManager) Prefab(org.terasology.entitySystem.prefab.Prefab) PojoPrefab(org.terasology.entitySystem.prefab.internal.PojoPrefab) BeforeClass(org.junit.BeforeClass)

Example 17 with ContextImpl

use of org.terasology.context.internal.ContextImpl in project Terasology by MovingBlocks.

the class OwnershipHelperTest method setup.

@Before
public void setup() {
    ContextImpl context = new ContextImpl();
    context.put(ModuleManager.class, moduleManager);
    context.put(NetworkSystem.class, mock(NetworkSystem.class));
    CoreRegistry.setContext(context);
    EntitySystemSetupUtil.addReflectionBasedLibraries(context);
    EntitySystemSetupUtil.addEntityManagementRelatedClasses(context);
    entityManager = context.get(EngineEntityManager.class);
}
Also used : EngineEntityManager(org.terasology.entitySystem.entity.internal.EngineEntityManager) NetworkSystem(org.terasology.network.NetworkSystem) ContextImpl(org.terasology.context.internal.ContextImpl) Before(org.junit.Before)

Example 18 with ContextImpl

use of org.terasology.context.internal.ContextImpl in project Terasology by MovingBlocks.

the class PojoEntityPoolTest method setupClass.

@BeforeClass
public static void setupClass() throws Exception {
    context = new ContextImpl();
    ModuleManager moduleManager = ModuleManagerFactory.create();
    context.put(ModuleManager.class, moduleManager);
    ModuleAwareAssetTypeManager assetTypeManager = new ModuleAwareAssetTypeManager();
    assetTypeManager.registerCoreAssetType(Prefab.class, (AssetFactory<Prefab, PrefabData>) PojoPrefab::new, "prefabs");
    assetTypeManager.switchEnvironment(moduleManager.getEnvironment());
    context.put(AssetManager.class, assetTypeManager.getAssetManager());
    CoreRegistry.setContext(context);
}
Also used : PrefabData(org.terasology.entitySystem.prefab.PrefabData) ModuleAwareAssetTypeManager(org.terasology.assets.module.ModuleAwareAssetTypeManager) ContextImpl(org.terasology.context.internal.ContextImpl) ModuleManager(org.terasology.engine.module.ModuleManager) Prefab(org.terasology.entitySystem.prefab.Prefab) PojoPrefab(org.terasology.entitySystem.prefab.internal.PojoPrefab) BeforeClass(org.junit.BeforeClass)

Example 19 with ContextImpl

use of org.terasology.context.internal.ContextImpl in project Terasology by MovingBlocks.

the class PojoPrefabManagerTest method setup.

@Before
public void setup() throws Exception {
    ContextImpl context = new ContextImpl();
    CoreRegistry.setContext(context);
    ModuleManager moduleManager = ModuleManagerFactory.create();
    ReflectFactory reflectFactory = new ReflectionReflectFactory();
    CopyStrategyLibrary copyStrategyLibrary = new CopyStrategyLibrary(reflectFactory);
    TypeSerializationLibrary lib = new TypeSerializationLibrary(reflectFactory, copyStrategyLibrary);
    lib.add(Vector3f.class, new Vector3fTypeHandler());
    lib.add(Quat4f.class, new Quat4fTypeHandler());
    entitySystemLibrary = new EntitySystemLibrary(context, lib);
    componentLibrary = entitySystemLibrary.getComponentLibrary();
    ModuleAwareAssetTypeManager assetTypeManager = new ModuleAwareAssetTypeManager();
    assetTypeManager.registerCoreAssetType(Prefab.class, (AssetFactory<Prefab, PrefabData>) PojoPrefab::new, "prefabs");
    assetTypeManager.switchEnvironment(moduleManager.getEnvironment());
    context.put(AssetManager.class, assetTypeManager.getAssetManager());
    prefabManager = new PojoPrefabManager(context);
}
Also used : PojoPrefabManager(org.terasology.entitySystem.prefab.internal.PojoPrefabManager) PrefabData(org.terasology.entitySystem.prefab.PrefabData) ModuleAwareAssetTypeManager(org.terasology.assets.module.ModuleAwareAssetTypeManager) CopyStrategyLibrary(org.terasology.reflection.copy.CopyStrategyLibrary) ContextImpl(org.terasology.context.internal.ContextImpl) ModuleManager(org.terasology.engine.module.ModuleManager) ReflectionReflectFactory(org.terasology.reflection.reflect.ReflectionReflectFactory) ReflectionReflectFactory(org.terasology.reflection.reflect.ReflectionReflectFactory) ReflectFactory(org.terasology.reflection.reflect.ReflectFactory) Vector3fTypeHandler(org.terasology.persistence.typeHandling.mathTypes.Vector3fTypeHandler) EntitySystemLibrary(org.terasology.entitySystem.metadata.EntitySystemLibrary) TypeSerializationLibrary(org.terasology.persistence.typeHandling.TypeSerializationLibrary) Quat4fTypeHandler(org.terasology.persistence.typeHandling.mathTypes.Quat4fTypeHandler) Prefab(org.terasology.entitySystem.prefab.Prefab) PojoPrefab(org.terasology.entitySystem.prefab.internal.PojoPrefab) Before(org.junit.Before)

Example 20 with ContextImpl

use of org.terasology.context.internal.ContextImpl in project Terasology by MovingBlocks.

the class ComponentMetadataTest method prepare.

@Before
public void prepare() {
    context = new ContextImpl();
    context.put(ReflectFactory.class, reflectFactory);
    context.put(CopyStrategyLibrary.class, copyStrategies);
}
Also used : ContextImpl(org.terasology.context.internal.ContextImpl) Before(org.junit.Before)

Aggregations

ContextImpl (org.terasology.context.internal.ContextImpl)23 Before (org.junit.Before)11 ModuleAwareAssetTypeManager (org.terasology.assets.module.ModuleAwareAssetTypeManager)7 Context (org.terasology.context.Context)7 ModuleManager (org.terasology.engine.module.ModuleManager)6 Prefab (org.terasology.entitySystem.prefab.Prefab)6 PrefabData (org.terasology.entitySystem.prefab.PrefabData)6 PojoPrefab (org.terasology.entitySystem.prefab.internal.PojoPrefab)6 BeforeClass (org.junit.BeforeClass)5 Test (org.junit.Test)5 Config (org.terasology.config.Config)4 NetworkSystem (org.terasology.network.NetworkSystem)4 TypeSerializationLibrary (org.terasology.persistence.typeHandling.TypeSerializationLibrary)4 MockContext (org.terasology.context.internal.MockContext)3 ComponentLibrary (org.terasology.entitySystem.metadata.ComponentLibrary)3 PojoPrefabManager (org.terasology.entitySystem.prefab.internal.PojoPrefabManager)3 SimpleUri (org.terasology.engine.SimpleUri)2 EngineEntityManager (org.terasology.entitySystem.entity.internal.EngineEntityManager)2 EntitySystemLibrary (org.terasology.entitySystem.metadata.EntitySystemLibrary)2 Quat4fTypeHandler (org.terasology.persistence.typeHandling.mathTypes.Quat4fTypeHandler)2