Search in sources :

Example 1 with ResourcePackFactoryModule

use of org.spongepowered.common.registry.factory.ResourcePackFactoryModule in project SpongeCommon by SpongePowered.

the class CommonModuleRegistry method registerFactories.

private void registerFactories() {
    final List<FactoryRegistry<?, ?>> factoryRegistries = new ArrayList<>();
    factoryRegistries.add(new ResourcePackFactoryModule());
    factoryRegistries.add(new TimingsFactoryModule());
    try {
        Field modifierField = Field.class.getDeclaredField("modifiers");
        modifierField.setAccessible(true);
        for (FactoryRegistry<?, ?> registry : factoryRegistries) {
            RegistryHelper.setFactory(registry.getFactoryOwner(), registry.provideFactory());
            registry.initialize();
        }
    } catch (Exception e) {
        SpongeImpl.getLogger().error("Could not initialize a factory!", e);
    }
}
Also used : TimingsFactoryModule(org.spongepowered.common.registry.factory.TimingsFactoryModule) Field(java.lang.reflect.Field) ResourcePackFactoryModule(org.spongepowered.common.registry.factory.ResourcePackFactoryModule) FactoryRegistry(org.spongepowered.api.registry.FactoryRegistry) ArrayList(java.util.ArrayList)

Aggregations

Field (java.lang.reflect.Field)1 ArrayList (java.util.ArrayList)1 FactoryRegistry (org.spongepowered.api.registry.FactoryRegistry)1 ResourcePackFactoryModule (org.spongepowered.common.registry.factory.ResourcePackFactoryModule)1 TimingsFactoryModule (org.spongepowered.common.registry.factory.TimingsFactoryModule)1