use of org.terasology.engine.world.block.internal.BlockManagerImpl in project Terasology by MovingBlocks.
the class BlockShapeTest method setup.
@BeforeEach
public void setup() throws Exception {
super.setup();
this.assetManager = CoreRegistry.get(AssetManager.class);
blockManager = new BlockManagerImpl(new NullWorldAtlas(), assetManager);
CoreRegistry.put(BlockManager.class, blockManager);
}
use of org.terasology.engine.world.block.internal.BlockManagerImpl in project Terasology by MovingBlocks.
the class InternalLightGeneratorTest 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);
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")));
BlockFamilyDefinitionData fullLightData = new BlockFamilyDefinitionData();
fullLightData.getBaseSection().setDisplayName("Torch");
fullLightData.getBaseSection().setShape(assetManager.getAsset("engine:cube", BlockShape.class).get());
fullLightData.getBaseSection().setLuminance(Chunks.MAX_LIGHT);
fullLightData.setBlockFamily(SymmetricFamily.class);
assetManager.loadAsset(new ResourceUrn("engine:torch"), fullLightData, BlockFamilyDefinition.class);
fullLight = blockManager.getBlock(new BlockUri(new ResourceUrn("engine:torch")));
}
use of org.terasology.engine.world.block.internal.BlockManagerImpl in project Terasology by MovingBlocks.
the class HeadlessEnvironment method setupBlockManager.
@Override
protected void setupBlockManager(AssetManager assetManager) {
WorldAtlas worldAtlas = new NullWorldAtlas();
BlockManagerImpl blockManager = new BlockManagerImpl(worldAtlas, assetManager);
context.put(BlockManager.class, blockManager);
TypeHandlerLibrary typeHandlerLibrary = context.get(TypeHandlerLibrary.class);
typeHandlerLibrary.addTypeHandler(BlockFamily.class, new BlockFamilyTypeHandler(blockManager));
typeHandlerLibrary.addTypeHandler(Block.class, new BlockTypeHandler(blockManager));
}
use of org.terasology.engine.world.block.internal.BlockManagerImpl in project Terasology by MovingBlocks.
the class RegisterBlocks method step.
@Override
public boolean step() {
NetworkSystem networkSystem = context.get(NetworkSystem.class);
WorldAtlas atlas = new WorldAtlasImpl(context.get(Config.class).getRendering().getMaxTextureAtlasResolution());
context.put(WorldAtlas.class, atlas);
ModuleEnvironment environment = context.get(ModuleManager.class).getEnvironment();
context.put(BlockFamilyLibrary.class, new BlockFamilyLibrary(environment, context));
BlockManagerImpl blockManager;
if (networkSystem.getMode().isAuthority()) {
blockManager = new BlockManagerImpl(atlas, context.get(AssetManager.class), true);
blockManager.subscribe(context.get(NetworkSystem.class));
} else {
blockManager = new BlockManagerImpl(atlas, context.get(AssetManager.class), false);
}
context.put(BlockManager.class, blockManager);
context.get(TypeHandlerLibrary.class).addTypeHandler(Block.class, new BlockTypeHandler(blockManager));
context.get(TypeHandlerLibrary.class).addTypeHandler(BlockFamily.class, new BlockFamilyTypeHandler(blockManager));
blockManager.initialise(gameManifest.getRegisteredBlockFamilies(), gameManifest.getBlockIdMap());
return true;
}
use of org.terasology.engine.world.block.internal.BlockManagerImpl in project Terasology by MovingBlocks.
the class BetweenChunkPropagationTest method setup.
@BeforeEach
@Override
public void setup() throws Exception {
super.setup();
AssetManager assetManager = CoreRegistry.get(AssetManager.class);
regenRules = new SunlightRegenPropagationRules();
blockManager = new BlockManagerImpl(new NullWorldAtlas(), assetManager, true);
CoreRegistry.put(BlockManager.class, blockManager);
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);
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);
}
Aggregations