-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge
1.5.4
changes to 1.16.5 (#231)
- Loading branch information
Showing
39 changed files
with
709 additions
and
611 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
common/src/main/java/com/rpmtw/rpmtw_platform_mod/mixins/LoadGameOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.rpmtw.rpmtw_platform_mod.mixins; | ||
|
||
import com.rpmtw.rpmtw_platform_mod.RPMTWPlatformMod; | ||
import com.rpmtw.rpmtw_platform_mod.translation.resourcepack.TranslateResourcePack; | ||
import net.minecraft.client.Options; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(Options.class) | ||
public class LoadGameOptions { | ||
private boolean called = false; | ||
|
||
@Inject(method = "load", at = @At("HEAD")) | ||
public void loading(CallbackInfo ci) { | ||
if (called) return; | ||
|
||
RPMTWPlatformMod.LOGGER.info("Loading the game options..."); | ||
TranslateResourcePack.INSTANCE.init(); | ||
called = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 21 additions & 5 deletions
26
common/src/main/kotlin/com/rpmtw/rpmtw_platform_mod/events/OnClientStarted.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,34 @@ | ||
package com.rpmtw.rpmtw_platform_mod.events | ||
|
||
import com.rpmtw.rpmtw_platform_mod.RPMTWPlatformMod | ||
import com.rpmtw.rpmtw_platform_mod.config.RPMTWConfig | ||
import com.rpmtw.rpmtw_platform_mod.handlers.UniverseChatHandler | ||
import com.rpmtw.rpmtw_platform_mod.translation.GameLanguage | ||
import com.rpmtw.rpmtw_platform_mod.translation.machineTranslation.MTManager | ||
import me.shedaniel.architectury.event.events.client.ClientLifecycleEvent | ||
import net.fabricmc.api.EnvType | ||
import net.fabricmc.api.Environment | ||
import net.minecraft.client.Minecraft | ||
import net.minecraft.client.resources.language.LanguageInfo | ||
import java.util.* | ||
|
||
@Environment(EnvType.CLIENT) | ||
class OnClientStarted : ClientLifecycleEvent.ClientState { | ||
override fun stateChanged(instance: Minecraft?) { | ||
if (instance != null) { | ||
UniverseChatHandler.handle() | ||
MTManager.readCache() | ||
} | ||
override fun stateChanged(instance: Minecraft) { | ||
toggleLanguage(instance) | ||
UniverseChatHandler.handle() | ||
MTManager.readCache() | ||
} | ||
|
||
private fun toggleLanguage(instance: Minecraft) { | ||
if (!RPMTWConfig.get().translate.autoToggleLanguage) return | ||
|
||
val manger = instance.languageManager | ||
val language = GameLanguage.getSystem() | ||
|
||
if (language == null || language == GameLanguage.English) return | ||
|
||
manger.selected = LanguageInfo(language.code, "", "", false) | ||
RPMTWPlatformMod.LOGGER.info("Auto toggle language to ${language.code}(${language.isO3Code})") | ||
} | ||
} |
Oops, something went wrong.