@Override @SuppressWarnings("deprecation") public void preInit(FMLPreInitializationEvent evt) { this.languageMap.forEach((language, map) -> { String lang = language.replace('-', '_'); map.forEach((key, value) -> LanguageRegistry.instance().addStringLocalization(key, lang, value)); }); Game.events().on(LanguageEvent.RegisterTranslation.class).withPriority(EventBus.PRIORITY_LOW).bind(this::register); }
/** * Localizes the names of all compounds. */ @SuppressWarnings("deprecation") public static void localizeCompounds() { for (int i = 0; i < compound.getNumSubtypes(); i++) { ItemStack stack = new ItemStack(compound, 1, i); LanguageRegistry.addName(stack, PropertyLoader.getName(CompoundItem.getCompound(i).getChemFormula())); } }
@SuppressWarnings("deprecation") public void register(LanguageEvent.RegisterTranslation evt) { LanguageRegistry.instance().addStringLocalization(evt.key, evt.language.replace('-', '_'), evt.value); }
protected void registerLanguage( String lang ) { String path = "/assets/" + mod + "/lang/" + lang + ".lang"; LanguageRegistry.instance().loadLocalization( path, lang, false ); }