Search in sources :

Example 1 with WorldAtlasImpl

use of org.terasology.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);
    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(TypeSerializationLibrary.class).add(Block.class, new BlockTypeHandler(blockManager));
    context.get(TypeSerializationLibrary.class).add(BlockFamily.class, new BlockFamilyTypeHandler(blockManager));
    blockManager.initialise(gameManifest.getRegisteredBlockFamilies(), gameManifest.getBlockIdMap());
    return true;
}
Also used : WorldAtlasImpl(org.terasology.world.block.tiles.WorldAtlasImpl) Config(org.terasology.config.Config) NetworkSystem(org.terasology.network.NetworkSystem) TypeSerializationLibrary(org.terasology.persistence.typeHandling.TypeSerializationLibrary) BlockTypeHandler(org.terasology.persistence.typeHandling.extensionTypes.BlockTypeHandler) WorldAtlas(org.terasology.world.block.tiles.WorldAtlas) BlockManagerImpl(org.terasology.world.block.internal.BlockManagerImpl) BlockFamilyTypeHandler(org.terasology.persistence.typeHandling.extensionTypes.BlockFamilyTypeHandler)

Aggregations

Config (org.terasology.config.Config)1 NetworkSystem (org.terasology.network.NetworkSystem)1 TypeSerializationLibrary (org.terasology.persistence.typeHandling.TypeSerializationLibrary)1 BlockFamilyTypeHandler (org.terasology.persistence.typeHandling.extensionTypes.BlockFamilyTypeHandler)1 BlockTypeHandler (org.terasology.persistence.typeHandling.extensionTypes.BlockTypeHandler)1 BlockManagerImpl (org.terasology.world.block.internal.BlockManagerImpl)1 WorldAtlas (org.terasology.world.block.tiles.WorldAtlas)1 WorldAtlasImpl (org.terasology.world.block.tiles.WorldAtlasImpl)1