use of net.minecraftforge.fml.loading.moddiscovery.NightConfigWrapper in project SpongeCommon by SpongePowered.
the class ModFileParsers method dummySpongeModParser.
public static IModFileInfo dummySpongeModParser(final IModFile realModFile, final String fileName, final IModFile iModFile) {
final ModFile modFile = (ModFile) iModFile;
AppLaunch.logger().debug("Considering sponge platform candidate {}", modFile.getFilePath());
final Path modsjson = modFile.getLocator().findPath(realModFile, fileName + ".toml");
if (!Files.exists(modsjson)) {
AppLaunch.logger().warn("Sponge platform file '{}' is missing the '{}' file", modFile, fileName + ".toml");
return null;
} else {
final FileConfig fileConfig = FileConfig.builder(modsjson).build();
fileConfig.load();
fileConfig.close();
final NightConfigWrapper configWrapper = new NightConfigWrapper(fileConfig);
try {
return ModFileParsers.generateModFileMetadata(modFile, configWrapper);
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
}
use of net.minecraftforge.fml.loading.moddiscovery.NightConfigWrapper in project SpongeCommon by SpongePowered.
the class ModFileParsers method generateModFileMetadata.
private static ModFileInfo generateModFileMetadata(final ModFile file, final IConfigurable configurable) throws Exception {
ModFileParsers.modFileInfoConstructor.setAccessible(true);
final ModFileInfo modFileInfo = ModFileParsers.modFileInfoConstructor.newInstance(file, configurable);
ModFileParsers.modFileInfoConstructor.setAccessible(false);
if (configurable instanceof NightConfigWrapper) {
ModFileParsers.modFileInfoField.setAccessible(true);
ModFileParsers.modFileInfoField.set(configurable, modFileInfo);
ModFileParsers.modFileInfoField.setAccessible(false);
}
return modFileInfo;
}
Aggregations