DataProvider.java 文件源码

java
阅读 28 收藏 0 点赞 0 评论 0

项目:MCPainter 作者:
/**
 * Initialize the mod configuration
 *
 * @param modsProvider
 * @param file
 * @return
 */
private static ModConfig initializeConfig(ModsProvider modsProvider, DataFile file) {
    Configuration config = file.getConfig();
    ModConfig result = new ModConfig(config);

    boolean statues = result.getMobs() != null;
    boolean blocks = result.getBlocks() != null;
    boolean valid = statues || blocks;
    if (!result.isValid() && !valid) {
        MCPainterMain.log("* " + file.getName() + "...bad file format.");
        return null;
    }

    String text = buildAssetsText(statues, blocks);
    if (result.isValid()) {
        Mod mod = modsProvider.get(result.getModIdRegex(), result.getVersionRegex());
        if (mod == null) {
            MCPainterMain.log("* " + file.getName()
                    + "...mod not available."
                    + (text.length() > 0 ? (" Using " + text) : "")
                    + ".");
        } else {
            result.setMod(mod);
            MCPainterMain.log("* " + file.getName() + " (" + result.getName()
                    + ") initialized texture"
                    + (text.length() > 0 ? (", " + text) : "")
                    + ".");
        }
    } else {
        MCPainterMain.log("* " + file.getName() + " (" + result.getName()
                + ") " + text + " definition initialized.");
    }

    return result;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号