本文整理汇总了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();
}
示例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));
}
}
}
}
示例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();
}
示例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();
}
}
示例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));
}
}
}
示例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();
}