Search in sources :

Example 11 with BlockFamilyDefinitionData

use of org.terasology.engine.world.block.loader.BlockFamilyDefinitionData in project Terasology by MovingBlocks.

the class ChunkTest method setup.

@BeforeEach
public void setup() throws Exception {
    super.setup();
    AssetManager assetManager = CoreRegistry.get(AssetManager.class);
    blockManager = new BlockManagerImpl(new NullWorldAtlas(), assetManager);
    CoreRegistry.put(BlockManager.class, blockManager);
    ExtraBlockDataManager extraDataManager = new ExtraBlockDataManager();
    chunk = new ChunkImpl(new Vector3i(0, 0, 0), blockManager, extraDataManager);
    BlockFamilyDefinitionData solidData = new BlockFamilyDefinitionData();
    solidData.getBaseSection().setDisplayName("Stone");
    solidData.getBaseSection().setShape(assetManager.getAsset("engine:cube", BlockShape.class).get());
    solidData.getBaseSection().setTranslucent(false);
    solidData.setBlockFamily(SymmetricFamily.class);
    assetManager.loadAsset(new ResourceUrn("engine:stone"), solidData, BlockFamilyDefinition.class);
    solid = blockManager.getBlock(new BlockUri(new ResourceUrn("engine:stone")));
}
Also used : BlockUri(org.terasology.engine.world.block.BlockUri) AssetManager(org.terasology.gestalt.assets.management.AssetManager) BlockFamilyDefinitionData(org.terasology.engine.world.block.loader.BlockFamilyDefinitionData) ChunkImpl(org.terasology.engine.world.chunks.internal.ChunkImpl) Vector3i(org.joml.Vector3i) NullWorldAtlas(org.terasology.engine.world.block.tiles.NullWorldAtlas) ExtraBlockDataManager(org.terasology.engine.world.chunks.blockdata.ExtraBlockDataManager) ResourceUrn(org.terasology.gestalt.assets.ResourceUrn) BlockManagerImpl(org.terasology.engine.world.block.internal.BlockManagerImpl) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 12 with BlockFamilyDefinitionData

use of org.terasology.engine.world.block.loader.BlockFamilyDefinitionData in project Terasology by MovingBlocks.

the class EntityAwareWorldProviderTest method createBlock.

private Block createBlock(String urn, AssetManager assetManager, BlockManager blockManager) {
    BlockFamilyDefinitionData data = new BlockFamilyDefinitionData();
    data.setBlockFamily(SymmetricFamily.class);
    assetManager.loadAsset(new ResourceUrn(urn), data, BlockFamilyDefinition.class);
    return blockManager.getBlock(urn);
}
Also used : BlockFamilyDefinitionData(org.terasology.engine.world.block.loader.BlockFamilyDefinitionData) ResourceUrn(org.terasology.gestalt.assets.ResourceUrn)

Example 13 with BlockFamilyDefinitionData

use of org.terasology.engine.world.block.loader.BlockFamilyDefinitionData in project Terasology by MovingBlocks.

the class ChunkViewTest method setup.

@BeforeEach
public void setup() throws IOException {
    AssetManager assetManager = CoreRegistry.get(AssetManager.class);
    blockManager = new BlockManagerImpl(new NullWorldAtlas(), assetManager);
    CoreRegistry.put(BlockManager.class, blockManager);
    airBlock = blockManager.getBlock(BlockManager.AIR_ID);
    extraDataManager = new ExtraBlockDataManager();
    BlockFamilyDefinitionData solidData = new BlockFamilyDefinitionData();
    solidData.getBaseSection().setDisplayName("Stone");
    solidData.getBaseSection().setShape(assetManager.getAsset("engine:cube", BlockShape.class).get());
    solidData.getBaseSection().setTranslucent(false);
    solidData.setBlockFamily(SymmetricFamily.class);
    assetManager.loadAsset(new ResourceUrn("engine:stone"), solidData, BlockFamilyDefinition.class);
    solidBlock = blockManager.getBlock(new BlockUri(new ResourceUrn("engine:stone")));
}
Also used : BlockUri(org.terasology.engine.world.block.BlockUri) AssetManager(org.terasology.gestalt.assets.management.AssetManager) BlockFamilyDefinitionData(org.terasology.engine.world.block.loader.BlockFamilyDefinitionData) NullWorldAtlas(org.terasology.engine.world.block.tiles.NullWorldAtlas) ExtraBlockDataManager(org.terasology.engine.world.chunks.blockdata.ExtraBlockDataManager) ResourceUrn(org.terasology.gestalt.assets.ResourceUrn) BlockManagerImpl(org.terasology.engine.world.block.internal.BlockManagerImpl) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

BlockFamilyDefinitionData (org.terasology.engine.world.block.loader.BlockFamilyDefinitionData)13 ResourceUrn (org.terasology.gestalt.assets.ResourceUrn)10 AssetManager (org.terasology.gestalt.assets.management.AssetManager)8 BeforeEach (org.junit.jupiter.api.BeforeEach)7 BlockManagerImpl (org.terasology.engine.world.block.internal.BlockManagerImpl)7 NullWorldAtlas (org.terasology.engine.world.block.tiles.NullWorldAtlas)7 BlockUri (org.terasology.engine.world.block.BlockUri)6 ExtraBlockDataManager (org.terasology.engine.world.chunks.blockdata.ExtraBlockDataManager)6 ModuleManager (org.terasology.engine.core.module.ModuleManager)3 PojoPrefab (org.terasology.engine.entitySystem.prefab.internal.PojoPrefab)2 BehaviorTree (org.terasology.engine.logic.behavior.asset.BehaviorTree)2 Block (org.terasology.engine.world.block.Block)2 BlockFamilyDefinition (org.terasology.engine.world.block.loader.BlockFamilyDefinition)2 BlockFamilyDefinitionFormat (org.terasology.engine.world.block.loader.BlockFamilyDefinitionFormat)2 BlockShapeImpl (org.terasology.engine.world.block.shapes.BlockShapeImpl)2 BlockSounds (org.terasology.engine.world.block.sounds.BlockSounds)2 BlockTile (org.terasology.engine.world.block.tiles.BlockTile)2 SunlightPropagationRules (org.terasology.engine.world.propagation.light.SunlightPropagationRules)2 SunlightRegenPropagationRules (org.terasology.engine.world.propagation.light.SunlightRegenPropagationRules)2 ModuleEnvironment (org.terasology.gestalt.module.ModuleEnvironment)2