Search in sources :

Example 1 with WorldAtlasImpl

use of org.terasology.engine.world.block.tiles.WorldAtlasImpl 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;
}
Also used : WorldAtlasImpl(org.terasology.engine.world.block.tiles.WorldAtlasImpl) Config(org.terasology.engine.config.Config) ModuleEnvironment(org.terasology.gestalt.module.ModuleEnvironment) TypeHandlerLibrary(org.terasology.persistence.typeHandling.TypeHandlerLibrary) NetworkSystem(org.terasology.engine.network.NetworkSystem) BlockFamilyLibrary(org.terasology.engine.world.block.family.BlockFamilyLibrary) ModuleManager(org.terasology.engine.core.module.ModuleManager) BlockTypeHandler(org.terasology.engine.persistence.typeHandling.extensionTypes.BlockTypeHandler) WorldAtlas(org.terasology.engine.world.block.tiles.WorldAtlas) BlockManagerImpl(org.terasology.engine.world.block.internal.BlockManagerImpl) BlockFamilyTypeHandler(org.terasology.engine.persistence.typeHandling.extensionTypes.BlockFamilyTypeHandler)

Aggregations

Config (org.terasology.engine.config.Config)1 ModuleManager (org.terasology.engine.core.module.ModuleManager)1 NetworkSystem (org.terasology.engine.network.NetworkSystem)1 BlockFamilyTypeHandler (org.terasology.engine.persistence.typeHandling.extensionTypes.BlockFamilyTypeHandler)1 BlockTypeHandler (org.terasology.engine.persistence.typeHandling.extensionTypes.BlockTypeHandler)1 BlockFamilyLibrary (org.terasology.engine.world.block.family.BlockFamilyLibrary)1 BlockManagerImpl (org.terasology.engine.world.block.internal.BlockManagerImpl)1 WorldAtlas (org.terasology.engine.world.block.tiles.WorldAtlas)1 WorldAtlasImpl (org.terasology.engine.world.block.tiles.WorldAtlasImpl)1 ModuleEnvironment (org.terasology.gestalt.module.ModuleEnvironment)1 TypeHandlerLibrary (org.terasology.persistence.typeHandling.TypeHandlerLibrary)1