use of org.terasology.gestalt.assets.module.ModuleAwareAssetTypeManager in project Terasology by MovingBlocks.
the class PojoEntityPoolTest method setupClass.
@BeforeAll
public static void setupClass() throws Exception {
context = new ContextImpl();
ModuleManager moduleManager = ModuleManagerFactory.create();
context.put(ModuleManager.class, moduleManager);
ModuleAwareAssetTypeManager assetTypeManager = new ModuleAwareAssetTypeManagerImpl();
assetTypeManager.createAssetType(Prefab.class, PojoPrefab::new, "prefabs");
assetTypeManager.switchEnvironment(moduleManager.getEnvironment());
context.put(AssetManager.class, assetTypeManager.getAssetManager());
context.put(RecordAndReplayCurrentStatus.class, new RecordAndReplayCurrentStatus());
CoreRegistry.setContext(context);
}
use of org.terasology.gestalt.assets.module.ModuleAwareAssetTypeManager in project Terasology by MovingBlocks.
the class EnvironmentSwitchHandler method cheapAssetManagerUpdate.
/**
* Switches the environment of the asset manager to the specified one. It does not register the prefab formats
* as they require a proper ComponentLibrary.
*
* The existence of this method call is questionable. It has only be introduced to make sure that
* the asset type manager has never prefab formats that reference an old ComponentLibrary.
*/
private void cheapAssetManagerUpdate(Context context, ModuleEnvironment environment) {
ModuleAwareAssetTypeManager moduleAwareAssetTypeManager = context.get(ModuleAwareAssetTypeManager.class);
unregisterPrefabFormats(moduleAwareAssetTypeManager);
moduleAwareAssetTypeManager.switchEnvironment(environment);
}
Aggregations