当前位置: 首页>>代码示例>>Java>>正文


Java StringTranslate.inject方法代码示例

本文整理汇总了Java中net.minecraft.util.StringTranslate.inject方法的典型用法代码示例。如果您正苦于以下问题:Java StringTranslate.inject方法的具体用法?Java StringTranslate.inject怎么用?Java StringTranslate.inject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.util.StringTranslate的用法示例。


在下文中一共展示了StringTranslate.inject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: searchZipForLanguages

import net.minecraft.util.StringTranslate; //导入方法依赖的package包/类
private void searchZipForLanguages(File source, Side side) throws IOException
{
    ZipFile zf = new ZipFile(source);
    List<String> added = Lists.newArrayList();
    for (ZipEntry ze : Collections.list(zf.entries()))
    {
        Matcher matcher = assetENUSLang.matcher(ze.getName());
        if (matcher.matches())
        {
            String lang = matcher.group(2);
            //FMLLog.fine("Injecting found translation data for lang %s in zip file %s at %s into language system", lang, source.getName(), ze.getName());
            added.add(lang);
            LanguageRegistry.instance().injectLanguage(lang, StringTranslate.parseLangFile(zf.getInputStream(ze)));
            // Ensure en_US is available to StringTranslate on the server
            if ("en_US".equals(lang) && side == Side.SERVER)
            {
                StringTranslate.inject(zf.getInputStream(ze));
            }
        }
    }
    if (added.size() > 0)
        FMLLog.fine("Found translations in %s [%s]", source.getName(), Joiner.on(", ").join(added));
    zf.close();
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:25,代码来源:LanguageRegistry.java

示例2: searchDirForLanguages

import net.minecraft.util.StringTranslate; //导入方法依赖的package包/类
private void searchDirForLanguages(File source, String path, Side side) throws IOException
{
    for (File file : source.listFiles())
    {
        String currPath = path+file.getName();
        if (file.isDirectory())
        {
            searchDirForLanguages(file, currPath+'/', side);
        }
        Matcher matcher = assetENUSLang.matcher(currPath);
        if (matcher.matches())
        {
            String lang = matcher.group(2);
            FMLLog.fine("Injecting found translation assets for lang %s at %s into language system", lang, currPath);
            LanguageRegistry.instance().injectLanguage(lang, StringTranslate.parseLangFile(new FileInputStream(file)));
            // Ensure en_US is available to StringTranslate on the server
            if ("en_US".equals(lang) && side == Side.SERVER)
            {
                StringTranslate.inject(new FileInputStream(file));
            }
        }
    }
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:24,代码来源:LanguageRegistry.java

示例3: searchZipForLanguages

import net.minecraft.util.StringTranslate; //导入方法依赖的package包/类
private void searchZipForLanguages(File source, Side side) throws IOException
{
    ZipFile zf = new ZipFile(source);
    for (ZipEntry ze : Collections.list(zf.entries()))
    {
        Matcher matcher = assetENUSLang.matcher(ze.getName());
        if (matcher.matches())
        {
            String lang = matcher.group(2);
            FMLLog.fine("Injecting found translation data for lang %s in zip file %s at %s into language system", lang, source.getName(), ze.getName());
            LanguageRegistry.instance().injectLanguage(lang, StringTranslate.parseLangFile(zf.getInputStream(ze)));
            // Ensure en_US is available to StringTranslate on the server
            if ("en_US".equals(lang) && side == Side.SERVER)
            {
                StringTranslate.inject(zf.getInputStream(ze));
            }
        }
    }
    zf.close();
}
 
开发者ID:alexandrage,项目名称:CauldronGit,代码行数:21,代码来源:LanguageRegistry.java

示例4: injectLanguage

import net.minecraft.util.StringTranslate; //导入方法依赖的package包/类
public static void injectLanguage(File source, Side side) {
    try {
        ZipFile zf = new ZipFile(source);
        for (ZipEntry ze : Collections.list(zf.entries())) {
            Matcher matcher = Pattern.compile("(?:.+/|)([\\w_-]+).lang").matcher(ze.getName());
            if (matcher.matches()) {
                String lang = matcher.group(1);
                FMLLog.fine("Injecting found translation data for lang %s in zip file %s at %s into language system", lang, source.getName(), ze.getName());
                LanguageRegistry.instance().injectLanguage(lang, StringTranslate.parseLangFile(zf.getInputStream(ze)));
                // Ensure en_US is available to StringTranslate on the server
                if ("en_US".equals(lang) && side == Side.SERVER)
                    StringTranslate.inject(zf.getInputStream(ze));
            }
        }
        zf.close();
    } catch (Exception e) {
        Logger.logError("Could not inject language file!");
        e.printStackTrace();
    }
}
 
开发者ID:Lomeli12,项目名称:AchieveSON,代码行数:21,代码来源:AchievementHandler.java

示例5: searchDirForENUSLanguage

import net.minecraft.util.StringTranslate; //导入方法依赖的package包/类
private void searchDirForENUSLanguage(File source, String path) throws IOException
{
    for (File file : source.listFiles())
    {
        String currPath = path+file.getName();
        if (file.isDirectory())
        {
            searchDirForENUSLanguage(file, currPath+'/');
        }
        Matcher matcher = assetENUSLang.matcher(currPath);
        if (matcher.matches())
        {
            FMLLog.fine("Injecting found translation data at %s into language system", currPath);
            StringTranslate.inject(new FileInputStream(file));
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:18,代码来源:FMLServerHandler.java

示例6: searchZipForENUSLanguage

import net.minecraft.util.StringTranslate; //导入方法依赖的package包/类
private void searchZipForENUSLanguage(File source) throws IOException
{
    ZipFile zf = new ZipFile(source);
    for (ZipEntry ze : Collections.list(zf.entries()))
    {
        Matcher matcher = assetENUSLang.matcher(ze.getName());
        if (matcher.matches())
        {
            FMLLog.fine("Injecting found translation data in zip file %s at %s into language system", source.getName(), ze.getName());
            StringTranslate.inject(zf.getInputStream(ze));
        }
    }
    zf.close();
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:15,代码来源:FMLServerHandler.java


注:本文中的net.minecraft.util.StringTranslate.inject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。