Search in sources :

Example 1 with WorldProviderCoreStub

use of org.terasology.testUtil.WorldProviderCoreStub in project Terasology by MovingBlocks.

the class EntityAwareWorldProviderTest method setup.

@Before
public void setup() throws Exception {
    super.setup();
    GameThread.setToCurrentThread();
    this.entityManager = context.get(EngineEntityManager.class);
    AssetManager assetManager = context.get(AssetManager.class);
    BlockManager blockManager = context.get(BlockManager.class);
    airBlock = blockManager.getBlock(BlockManager.AIR_ID);
    worldStub = new WorldProviderCoreStub(airBlock, null);
    worldProvider = new EntityAwareWorldProvider(worldStub, context);
    plainBlock = createBlock("test:plainblock", assetManager, blockManager);
    prefabWithString = createPrefabWithString("test:prefabWithString", "Test", assetManager);
    blockWithString = createBlockWithPrefab("test:blockWithString", prefabWithString, false, assetManager, blockManager);
    keepActiveBlock = createBlockWithPrefab("test:keepActiveBlock", prefabWithString, true, assetManager, blockManager);
    Prefab prefabWithDifferentString = createPrefabWithString("test:prefabWithDifferentString", "Test2", assetManager);
    blockWithDifferentString = createBlockWithPrefab("test:prefabWithDifferentString", prefabWithDifferentString, false, assetManager, blockManager);
    BlockFamily blockFamily = createBlockFamily("test:blockFamily", prefabWithString, assetManager, blockManager);
    Iterator<Block> iterator = blockFamily.getBlocks().iterator();
    blockInFamilyOne = iterator.next();
    blockInFamilyTwo = iterator.next();
    PrefabData retainedPrefabData = new PrefabData();
    retainedPrefabData.addComponent(new RetainedOnBlockChangeComponent(3));
    Prefab retainedPrefab = assetManager.loadAsset(new ResourceUrn("test:retainedPrefab"), retainedPrefabData, Prefab.class);
    blockWithRetainedComponent = createBlockWithPrefab("test:blockWithRetainedComponent", retainedPrefab, false, assetManager, blockManager);
    worldProvider.initialise();
}
Also used : EngineEntityManager(org.terasology.entitySystem.entity.internal.EngineEntityManager) AssetManager(org.terasology.assets.management.AssetManager) PrefabData(org.terasology.entitySystem.prefab.PrefabData) RetainedOnBlockChangeComponent(org.terasology.entitySystem.stubs.RetainedOnBlockChangeComponent) BlockManager(org.terasology.world.block.BlockManager) Block(org.terasology.world.block.Block) BlockFamily(org.terasology.world.block.family.BlockFamily) EntityAwareWorldProvider(org.terasology.world.internal.EntityAwareWorldProvider) ResourceUrn(org.terasology.assets.ResourceUrn) Prefab(org.terasology.entitySystem.prefab.Prefab) WorldProviderCoreStub(org.terasology.testUtil.WorldProviderCoreStub) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 ResourceUrn (org.terasology.assets.ResourceUrn)1 AssetManager (org.terasology.assets.management.AssetManager)1 EngineEntityManager (org.terasology.entitySystem.entity.internal.EngineEntityManager)1 Prefab (org.terasology.entitySystem.prefab.Prefab)1 PrefabData (org.terasology.entitySystem.prefab.PrefabData)1 RetainedOnBlockChangeComponent (org.terasology.entitySystem.stubs.RetainedOnBlockChangeComponent)1 WorldProviderCoreStub (org.terasology.testUtil.WorldProviderCoreStub)1 Block (org.terasology.world.block.Block)1 BlockManager (org.terasology.world.block.BlockManager)1 BlockFamily (org.terasology.world.block.family.BlockFamily)1 EntityAwareWorldProvider (org.terasology.world.internal.EntityAwareWorldProvider)1