use of net.minecraftforge.forgespi.language.ModFileScanData in project MinecraftForge by MinecraftForge.
the class ForgeGameTestHooks method registerGametests.
@SuppressWarnings("deprecation")
public static void registerGametests() {
if (!registeredGametests && isGametestEnabled()) {
Set<String> enabledNamespaces = getEnabledNamespaces();
LOGGER.info("Enabled Gametest Namespaces: {}", enabledNamespaces);
Set<Method> gameTestMethods = new HashSet<>();
RegisterGameTestsEvent event = new RegisterGameTestsEvent(gameTestMethods);
ModLoader.get().postEvent(event);
ModList.get().getAllScanData().stream().map(ModFileScanData::getAnnotations).flatMap(Collection::stream).filter(a -> GAME_TEST_HOLDER.equals(a.annotationType())).forEach(a -> addGameTestMethods(a, gameTestMethods));
for (Method gameTestMethod : gameTestMethods) {
GameTestRegistry.register(gameTestMethod, enabledNamespaces);
}
registeredGametests = true;
}
}
use of net.minecraftforge.forgespi.language.ModFileScanData in project MinecraftForge by MinecraftForge.
the class Scanner method scan.
public ModFileScanData scan() {
ModFileScanData result = new ModFileScanData();
result.addModFileInfo(fileToScan.getModFileInfo());
fileToScan.scanFile(p -> fileVisitor(p, result));
final List<IModLanguageProvider> loaders = fileToScan.getLoaders();
if (loaders != null) {
loaders.forEach(loader -> {
LOGGER.debug(LogMarkers.SCAN, "Scanning {} with language loader {}", fileToScan.getFilePath(), loader.name());
loader.getFileVisitor().accept(result);
});
}
return result;
}
Aggregations