use of org.terasology.engine.persistence.typeHandling.extensionTypes.BlockTypeHandler 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.persistence.typeHandling.extensionTypes.BlockTypeHandler 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;
}
Aggregations