fix: add client-side compatibility with nucleoid serverside translation
Some checks are pending
ci/woodpecker/push/jfmod Pipeline is pending
Some checks are pending
ci/woodpecker/push/jfmod Pipeline is pending
This commit is contained in:
parent
acaf46b835
commit
f0a479d7c5
@ -5,19 +5,19 @@ import net.minecraft.client.resource.language.TranslationStorage;
|
||||
import net.minecraft.util.Language;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.*;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mixin(Language.class)
|
||||
@Mixin(value = Language.class, priority = 900)
|
||||
public class LanguageMixin {
|
||||
@Inject(at = @At("HEAD"), method = "setInstance")
|
||||
private static void languageSetInstance(Language language, CallbackInfo ci) {
|
||||
@ModifyVariable(at = @At("HEAD"), method = "setInstance", argsOnly = true)
|
||||
private static Language languageSetInstance(Language language) {
|
||||
if (language instanceof TranslationStorage t) {
|
||||
TranslationStorageAccessor ta = (TranslationStorageAccessor) t;
|
||||
ta.setTranslations(Translater.getMap(ta.getTranslations()));
|
||||
Translater.LOGGER.info("Set translater backend 2");
|
||||
} else Translater.LOGGER.warn("Unsupported language configured: {}", language);
|
||||
} else Translater.LOGGER.error("Unsupported language configured: {}", language);
|
||||
return language;
|
||||
}
|
||||
|
||||
@ModifyArg(
|
||||
|
Loading…
Reference in New Issue
Block a user