Search in sources :

Example 1 with SunlightRegenPropagationRules

use of org.terasology.world.propagation.light.SunlightRegenPropagationRules in project Terasology by MovingBlocks.

the class BulkSunlightPropagationTest method setup.

@Before
public void setup() throws Exception {
    super.setup();
    regenRules = new SunlightRegenPropagationRules();
    AssetManager assetManager = CoreRegistry.get(AssetManager.class);
    blockManager = new BlockManagerImpl(new NullWorldAtlas(), assetManager, true);
    CoreRegistry.put(BlockManager.class, blockManager);
    BlockFamilyDefinitionData solidData = new BlockFamilyDefinitionData();
    solidData.getBaseSection().setDisplayName("Stone");
    solidData.getBaseSection().setShape(assetManager.getAsset("engine:cube", BlockShape.class).get());
    solidData.getBaseSection().setTranslucent(false);
    solidData.setFamilyFactory(new SymmetricBlockFamilyFactory());
    assetManager.loadAsset(new ResourceUrn("engine:stone"), solidData, BlockFamilyDefinition.class);
    solid = blockManager.getBlock(new BlockUri(new ResourceUrn("engine:stone")));
    air = blockManager.getBlock(BlockManager.AIR_ID);
    Map<Vector3i, Block> blockData = Maps.newHashMap();
    regenWorldView = new StubPropagatorWorldView(ChunkConstants.CHUNK_REGION, air, blockData);
    lightWorldView = new StubPropagatorWorldView(ChunkConstants.CHUNK_REGION, air, blockData);
    lightRules = new SunlightPropagationRules(regenWorldView);
    sunlightPropagator = new StandardBatchPropagator(lightRules, lightWorldView);
    propagator = new SunlightRegenBatchPropagator(regenRules, regenWorldView, sunlightPropagator, lightWorldView);
}
Also used : BlockUri(org.terasology.world.block.BlockUri) AssetManager(org.terasology.assets.management.AssetManager) SunlightPropagationRules(org.terasology.world.propagation.light.SunlightPropagationRules) BlockFamilyDefinitionData(org.terasology.world.block.loader.BlockFamilyDefinitionData) Vector3i(org.terasology.math.geom.Vector3i) Block(org.terasology.world.block.Block) NullWorldAtlas(org.terasology.world.block.tiles.NullWorldAtlas) ResourceUrn(org.terasology.assets.ResourceUrn) SunlightRegenPropagationRules(org.terasology.world.propagation.light.SunlightRegenPropagationRules) SymmetricBlockFamilyFactory(org.terasology.world.block.family.SymmetricBlockFamilyFactory) BlockManagerImpl(org.terasology.world.block.internal.BlockManagerImpl) Before(org.junit.Before)

Example 2 with SunlightRegenPropagationRules

use of org.terasology.world.propagation.light.SunlightRegenPropagationRules in project Terasology by MovingBlocks.

the class BetweenChunkPropagationTest method setup.

@Before
@Override
public void setup() throws Exception {
    super.setup();
    AssetManager assetManager = CoreRegistry.get(AssetManager.class);
    regenRules = new SunlightRegenPropagationRules();
    blockManager = new BlockManagerImpl(new NullWorldAtlas(), assetManager, true);
    biomeManager = Mockito.mock(BiomeManager.class);
    CoreRegistry.put(BlockManager.class, blockManager);
    BlockFamilyDefinitionData solidData = new BlockFamilyDefinitionData();
    solidData.getBaseSection().setDisplayName("Stone");
    solidData.getBaseSection().setShape(assetManager.getAsset("engine:cube", BlockShape.class).get());
    solidData.getBaseSection().setTranslucent(false);
    solidData.setFamilyFactory(new SymmetricBlockFamilyFactory());
    assetManager.loadAsset(new ResourceUrn("engine:stone"), solidData, BlockFamilyDefinition.class);
    solid = blockManager.getBlock(new BlockUri(new ResourceUrn("engine:stone")));
    regenWorldView = new SunlightRegenWorldView(provider);
    lightWorldView = new SunlightWorldView(provider);
    lightRules = new SunlightPropagationRules(regenWorldView);
    sunlightPropagator = new StandardBatchPropagator(lightRules, lightWorldView);
    propagator = new SunlightRegenBatchPropagator(regenRules, regenWorldView, sunlightPropagator, lightWorldView);
}
Also used : BiomeManager(org.terasology.world.biomes.BiomeManager) BlockUri(org.terasology.world.block.BlockUri) AssetManager(org.terasology.assets.management.AssetManager) SunlightRegenWorldView(org.terasology.world.propagation.light.SunlightRegenWorldView) SunlightPropagationRules(org.terasology.world.propagation.light.SunlightPropagationRules) SunlightWorldView(org.terasology.world.propagation.light.SunlightWorldView) BlockFamilyDefinitionData(org.terasology.world.block.loader.BlockFamilyDefinitionData) NullWorldAtlas(org.terasology.world.block.tiles.NullWorldAtlas) ResourceUrn(org.terasology.assets.ResourceUrn) SunlightRegenPropagationRules(org.terasology.world.propagation.light.SunlightRegenPropagationRules) SymmetricBlockFamilyFactory(org.terasology.world.block.family.SymmetricBlockFamilyFactory) BlockManagerImpl(org.terasology.world.block.internal.BlockManagerImpl) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)2 ResourceUrn (org.terasology.assets.ResourceUrn)2 AssetManager (org.terasology.assets.management.AssetManager)2 BlockUri (org.terasology.world.block.BlockUri)2 SymmetricBlockFamilyFactory (org.terasology.world.block.family.SymmetricBlockFamilyFactory)2 BlockManagerImpl (org.terasology.world.block.internal.BlockManagerImpl)2 BlockFamilyDefinitionData (org.terasology.world.block.loader.BlockFamilyDefinitionData)2 NullWorldAtlas (org.terasology.world.block.tiles.NullWorldAtlas)2 SunlightPropagationRules (org.terasology.world.propagation.light.SunlightPropagationRules)2 SunlightRegenPropagationRules (org.terasology.world.propagation.light.SunlightRegenPropagationRules)2 Vector3i (org.terasology.math.geom.Vector3i)1 BiomeManager (org.terasology.world.biomes.BiomeManager)1 Block (org.terasology.world.block.Block)1 SunlightRegenWorldView (org.terasology.world.propagation.light.SunlightRegenWorldView)1 SunlightWorldView (org.terasology.world.propagation.light.SunlightWorldView)1