本文整理了Java中net.minecraft.client.Minecraft.getLanguageManager()
方法的一些代码示例,展示了Minecraft.getLanguageManager()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Minecraft.getLanguageManager()
方法的具体详情如下:
包路径:net.minecraft.client.Minecraft
类名称:Minecraft
方法名:getLanguageManager
暂无
代码示例来源:origin: CFPAOrg/I18nUpdateMod
/**
* 将语言换成中文
*/
public static void setupLang() {
Minecraft mc = Minecraft.getMinecraft();
GameSettings gameSettings = mc.gameSettings;
// 强行修改为简体中文
if (!gameSettings.language.equals("zh_cn")) {
mc.getLanguageManager().currentLanguage = "zh_cn";
gameSettings.language = "zh_cn";
}
}
代码示例来源:origin: McJtyMods/RFToolsControl
public GuiRFToolsManual(int manual) {
String gameLocale = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode().toLowerCase(java.util.Locale.ENGLISH);
if (manual == MANUAL_CONTROL) {
if (gameLocale.equals("en_us")) {
manualText = manualControlText;
} else {
manualText = new ResourceLocation(RFToolsControl.MODID, "text/manual_control-" + gameLocale + ".txt");
}
}
}
代码示例来源:origin: mezz/JustEnoughItems
@SuppressWarnings("ConstantConditions")
private static Locale getLocale() {
Minecraft minecraft = Minecraft.getMinecraft();
if (minecraft != null) {
LanguageManager languageManager = minecraft.getLanguageManager();
if (languageManager != null) {
Language currentLanguage = languageManager.getCurrentLanguage();
if (currentLanguage != null) {
return currentLanguage.getJavaLocale();
}
}
}
return Locale.getDefault();
}
}
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
@Override
public void parse(JsonObject json) {
String lang = JsonUtils.getString(json, "lang").toLowerCase();
String currentLang = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode();
if (!lang.equals("en_us") && !lang.equals(currentLang)) {
return;
}
String category = JsonUtils.getString(json, "category");
List<IContentElement> contents = new ArrayList<>();
if (lang.equals("en_us") && !currentLang.equals(lang)) {
englishCategoryContents.put(category, contents);
} else {
categoryContents.put(category, contents);
}
JsonArray elements = JsonUtils.getJsonArray(json, "content");
for (JsonElement el : elements) {
JsonObject elementJson = JsonUtils.getJsonObject(el, "");
contents.add(parseElement(elementJson));
}
}
代码示例来源:origin: TeamLapen/Vampirism
@Override
public String getActiveLanguage() {
return Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().toString();
}
代码示例来源:origin: jabelar/ExampleMod-1.12
/**
* Refresh lang resources.
*/
@SuppressWarnings("unlikely-arg-type")
public void refreshLangResources()
{
// DEBUG
System.out.println("Refreshing lang files with proper precedence");
// Minecraft.getMinecraft().refreshResources();
List<String> list = Lists.newArrayList("en_us");
if (!"en_us".equals(Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage()))
{
list.add(Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().toString());
}
// This is a fix for problem where lang files are not properly replaced by resource packs
MOD_LOCALE.loadLocaleDataFiles(Minecraft.getMinecraft().getResourceManager(), list);
LanguageMap.replaceWith(MOD_LOCALE.properties);
}
代码示例来源:origin: ForestryMC/Binnie
@SuppressWarnings("ConstantConditions")
@SideOnly(Side.CLIENT)
public static Locale getLocale() {
Minecraft minecraft = Minecraft.getMinecraft();
if (minecraft != null) {
LanguageManager languageManager = minecraft.getLanguageManager();
if (languageManager != null) {
Language currentLanguage = languageManager.getCurrentLanguage();
if (currentLanguage != null) {
return currentLanguage.getJavaLocale();
}
}
}
return Locale.getDefault();
}
}
代码示例来源:origin: Vazkii/Patchouli
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
currentLang = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode();
if(!firstLoad)
BookRegistry.INSTANCE.reload();
firstLoad = false;
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
private FontRenderer getFont(){
FontRenderer font;
if(IceAndFire.CONFIG.useVanillaFont || !Minecraft.getMinecraft().gameSettings.language.equalsIgnoreCase("en_us")){
font = Minecraft.getMinecraft().fontRenderer;
}else{
font = (FontRenderer) IceAndFire.PROXY.getFontRenderer();
}
font.setUnicodeFlag(Minecraft.getMinecraft().getLanguageManager().isCurrentLocaleUnicode());
font.setBidiFlag(Minecraft.getMinecraft().getLanguageManager().isCurrentLanguageBidirectional());
return font;
}
代码示例来源:origin: ForestryMC/ForestryMC
@Nullable
public static IResource getResource(String path) {
IResource resource;
if (!path.contains(":")) {
Language currentLanguage = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage();
String lang = currentLanguage.getLanguageCode();
ResourceLocation location = new ResourceLocation(String.format(BOOK_LOCATION_LANG, lang, path));
resource = ResourceUtil.getResource(location);
if (resource != null) {
return resource;
}
location = new ResourceLocation(String.format(BOOK_LOCATION_LANG, DEFAULT_LANG, path));
resource = ResourceUtil.getResource(location);
if (resource != null) {
return resource;
}
location = new ResourceLocation(BOOK_LOCATION + path);
return ResourceUtil.getResource(location);
}
ResourceLocation location = new ResourceLocation(path);
return ResourceUtil.getResource(location);
}
代码示例来源:origin: CFPAOrg/I18nUpdateMod
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) {
Minecraft.getMinecraft().getLanguageManager().onResourceManagerReload(Minecraft.getMinecraft().getResourceManager());
Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation("message.i18nmod.cmd_reload.success"));
}
}
代码示例来源:origin: CFPAOrg/I18nUpdateMod
@Override
public void install() {
super.install();
if (updateResourcePack) {
DownloadManager downloader = new DownloadManager(I18nConfig.download.langPackURL, I18nConfig.download.langPackName, Minecraft.getMinecraft().getResourcePackRepository().getDirResourcepacks().toString());
downloader.start("I18n-Download-Thread");
downloader.setSuccessTask(() -> {
setResourcesRepository();
Minecraft.getMinecraft().getLanguageManager().onResourceManagerReload(Minecraft.getMinecraft().getResourceManager());
DownloadInfoHelper.info.add("资源包更新成功。");
});
}
}
}
代码示例来源:origin: CFPAOrg/I18nUpdateMod
/**
* 单独功能,快速重载语言文件
*
* @return 是否成功
*/
private boolean reloadKeyHandler() {
if (keyCodeCheck(reportKey.getKeyCode()) && Keyboard.isKeyDown(mainKey.getKeyCode()) && Keyboard.getEventKey() == reloadKey.getKeyCode()) {
Minecraft.getMinecraft().getLanguageManager().onResourceManagerReload(Minecraft.getMinecraft().getResourceManager());
Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation("message.i18nmod.cmd_reload.success"));
return true;
}
return false;
}
代码示例来源:origin: CoFH/CoFHCore
@Override
public void postInit(FMLPostInitializationEvent event) {
super.postInit(event);
fontRenderer = new FontRendererCore(Minecraft.getMinecraft().gameSettings, new ResourceLocation("textures/font/ascii.png"), Minecraft.getMinecraft().renderEngine, Minecraft.getMinecraft().gameSettings.forceUnicodeFont);
if (Minecraft.getMinecraft().gameSettings.language != null) {
fontRenderer.setUnicodeFlag(Minecraft.getMinecraft().isUnicode());
fontRenderer.setBidiFlag(Minecraft.getMinecraft().getLanguageManager().isCurrentLanguageBidirectional());
}
((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(fontRenderer);
((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(EventHandlerRender.INSTANCE);
fontRenderer.initSpecialCharacters();
}
内容来源于网络,如有侵权,请联系作者删除!