public static void injectLocalization(Instrument instrument) { String localName = "item.clef.instrument." + instrument.info.itemName + ".name=" + instrument.info.shortdescription; String localDesc = "item.clef.instrument." + instrument.info.itemName + ".desc=" + instrument.info.description; InputStream streamName = new ByteArrayInputStream(localName.getBytes(StandardCharsets.UTF_8)); InputStream streamDesc = new ByteArrayInputStream(localDesc.getBytes(StandardCharsets.UTF_8)); LanguageMap.inject(streamName); LanguageMap.inject(streamDesc); }
public void onResourceManagerReload(IResourceManager resourceManager) { List<String> list = Lists.newArrayList(new String[] {"en_us"}); if (!"en_us".equals(this.currentLanguage)) { list.add(this.currentLanguage); } CURRENT_LOCALE.loadLocaleDataFiles(resourceManager, list); LanguageMap.replaceWith(CURRENT_LOCALE.properties); }
public void onResourceManagerReload(IResourceManager resourceManager) { List<String> list = Lists.newArrayList(new String[] {"en_US"}); if (!"en_US".equals(this.currentLanguage)) { list.add(this.currentLanguage); } CURRENT_LOCALE.loadLocaleDataFiles(resourceManager, list); LanguageMap.replaceWith(CURRENT_LOCALE.properties); }
/** * Called to apply the set (if not player-specific) */ @Override public void apply() { try { newNameStream.reset(); } catch (IOException e) { LogHelper.warn("Unable to reset new name stream when renaming {}", ItemUtility.outputItemName(what)); } LogHelper.info("Updating {} to be named {} instead of {}.", ItemUtility.outputItemName(what), name, oldName); LanguageMap.inject(newNameStream); }
/** * Called to remove the set (if not player-specific) */ @Override public void undo() { try { oldNameStream.reset(); } catch (IOException e) { LogHelper.warn("Unable to reset old name stream when renaming {}", ItemUtility.outputItemName(what)); } LanguageMap.inject(oldNameStream); }
public static void run() { //noinspection NullableProblems ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new IResourceManagerReloadListener() { @Override public void onResourceManagerReload(IResourceManager resourceManager) { D3LanguageInjectEvent event = new D3LanguageInjectEvent(); MinecraftForge.EVENT_BUS.post(event); LanguageMap.replaceWith(event.map); } }); }
/** * Utility method for getting the LanguageMap instance (the vanilla getter * is package-private) * * @return The LanguageMap instance */ public static LanguageMap getLanguageMapInstance() { return languageMapInstance; }