public DefaultWorldGeneratorPluginLibrary(ModuleEnvironment moduleEnvironment, Context context) { library = new DefaultClassLibrary<>(context); for (Class entry : moduleEnvironment.getTypesAnnotatedWith(RegisterPlugin.class)) { if (WorldGeneratorPlugin.class.isAssignableFrom(entry)) { library.register(new SimpleUri(moduleEnvironment.getModuleProviding(entry), entry.getSimpleName()), entry); } } }
public BlockFamilyLibrary(ModuleEnvironment moduleEnvironment, Context context) { library = new DefaultClassLibrary<>(context); for (Class<?> entry : moduleEnvironment.getTypesAnnotatedWith(RegisterBlockFamily.class)) { if (!BlockFamily.class.isAssignableFrom(entry)) { logger.error("Cannot load {}, must be a subclass of BlockFamily", entry.getSimpleName()); continue; } RegisterBlockFamily registerInfo = entry.getAnnotation(RegisterBlockFamily.class); String id = registerInfo.value(); logger.debug("Registering blockFamily {}", id); library.register(new SimpleUri(moduleEnvironment.getModuleProviding(entry), registerInfo.value()), (Class<? extends BlockFamily>) entry); } }