Skip to content

Commit

Permalink
fix: switch language freezing
Browse files Browse the repository at this point in the history
  • Loading branch information
opZywl committed Jan 21, 2025
1 parent 6c39db3 commit cc97335
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,20 +204,22 @@ class GuiClientConfiguration(val prevGui: GuiScreen) : AbstractScreen() {
7 -> {
val languageIndex = LanguageManager.knownLanguages.indexOf(overrideLanguage)

// If the language is not found, set it to the first language
if (languageIndex == -1) {
overrideLanguage = LanguageManager.knownLanguages.first()
} else {
// If the language is the last one, set it to blank
if (languageIndex == LanguageManager.knownLanguages.size - 1) {
overrideLanguage = ""
} else {
overrideLanguage = when (languageIndex) {
-1 -> {
// If the language is not found, set it to the first language
LanguageManager.knownLanguages.first()
}
LanguageManager.knownLanguages.size - 1 -> {
// If the language is the last one, set it to blank
""
}
else -> {
// Otherwise, set it to the next language
overrideLanguage = LanguageManager.knownLanguages[languageIndex + 1]
LanguageManager.knownLanguages[languageIndex + 1]
}
}

initGui()
languageButton.displayString = "Language (${overrideLanguage.ifBlank { "Game" }})"
}

8 -> mc.displayGuiScreen(prevGui)
Expand Down

0 comments on commit cc97335

Please sign in to comment.