Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello, I got some code that won't register in Forge (MC=1.20.4), (FML=49.0.30) (It basically iterates through an array all supported Minecraft languages and picks at random one and reloads ResourceManager with it:

 

 

List<String> languageCountryCodes = new ArrayList<>();
        Collections.addAll(languageCountryCodes,
                "af_za", "ara_sa", "ast_es", "aze_az", "bak_ru", "bar_de", "bel_by", "bul_bg", "bre_fr", "qbr_nl",
                "bos_ba", "cat_es", "ces_cz", "cym_gb", "dan_dk", "bar_at", "gsw_ch", "deu_de", "ell_gr", "eng_au",
                "eng_ca", "eng_gb", "eng_nz", "qpe", "eng_qabs_gb", "en_ud", "epo", "spa_ar", "spa_cl", "spa_ec",
                "spa_es", "spa_mx", "spa_uy", "spa_ve", "spa_es_an", "est_ee", "eus_es", "fas_ir", "fin_fi", "fil_ph",
                "fao_fo", "fra_ca", "fra_fr", "fra_de", "fur_it", "fry_nl", "gle_ie", "gla_gb", "glg_es", "haw_us",
                "heb_il", "hin_in", "hrv_hr", "hun_hu", "hye_am", "id_id", "ibo_ng", "is_is", "qis", "ita_it", "jpn_jp",
                "jbo", "kat_ge", "kaz_kz", "kan_in", "kor_kr", "ksh_de", "kw_gb", "lat_va", "ltz_lu", "lim_nl", "lmo_it",
                "lao_la", "qll", "lit_lt", "lav_lv", "lzh", "mkd_mk", "mon_mn", "zlm_my", "mlt_mt", "nhe_mx", "vmf_de",
                "msa_my", "mlg_mg", "mar_in", "nld_be", "nld_nl", "nno_no", "nob_no", "quc_latn_gt", "pol_pl", "por_br",
                "por_pt", "qya", "ro_ro", "qpr", "rus_ru", "srp_latn_rs", "srp_cyrl_rs", "swe_se", "slk_sk", "slv_si",
                "som_so", "sqi_al", "ckb_ir", "sr_sp", "swa_ke", "swh_tz", "tam_in", "tha_th", "tgk_tj", "uig_cn",
                "ukr_ua", "urd_pk", "uzb_uz", "ven_za", "cymr", "xho_za", "yor_ng", "yue_hk", "zho_hans_cn", "zho_hant_hk",
                "zho_hant_tw");

        // Shuffle the list
        Collections.shuffle(languageCountryCodes);

        // Print one code at a time
        for (String code : languageCountryCodes) {
            LanguageManager languageManager = new LanguageManager(code);
            languageManager.onResourceManagerReload(TroubleshootingMod.getResourceManager());
            System.out.println(Minecraft.getInstance().getLocale());
            System.out.println(code);
            break; // Exit the loop after printing one code
        }

Minecraft.getInstance().getLanguageManager().setSelected("bar_de"); also does not appear to be functional..

 

Kind regards, Ensamisten

Edited by Ensamisten
Forgot code

Your new LanguageManager() is not the language manager that is being used when you call Minecraft.getInstant().getLocale().

Minecraft.getLanguageManager().setSelected(code);  should work.  Can you show that code?

Edited by GoldenPanda

  • Author
17 hours ago, GoldenPanda said:

Your new LanguageManager() is not the language manager that is being used when you call Minecraft.getInstant().getLocale().

Minecraft.getLanguageManager().setSelected(code);  should work.  Can you show that code?

  1. It is yet to function, subscribing to the different Forge stages doesn't change it at all.
  2. Forge does not seem to provide an interface for this, only for internal code.
 // Print one code at a time
        for (String code : languageCountryCodes) {
            Minecraft.getInstance().getLanguageManager().setSelected(code);
            Minecraft.getInstance().getLocale();
            break; // Exit the loop after printing one code
        }

 

  • Author

I found out the code works when doing what you said and subscribing to FMLClientSetupEvent!

Thanks a bunch!a<<

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.