Skip to content

Commit 6bfdfe8

Browse files
committed
Fix backportI18nSuppoprt break tweakermore translation logic (#153)
Signed-off-by: Hendrix-Shen <HendrixShen@hendrixshen.top>
1 parent bfe4b00 commit 6bfdfe8

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/main/java/com/plusls/MasaGadget/mixin/mod_tweak/malilib/backportI18nSupport/MixinConfigBase.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@ public abstract class MixinConfigBase implements IConfigBase {
3737
private static final ValueContainer<Class<?>> masa_gadget_mod$tweakerMoreIConfigBaseClass = ReflectionUtil
3838
.getClass("me.fallenbreath.tweakermore.config.options.TweakerMoreIConfigBase");
3939

40-
@Inject(
41-
method = "getComment",
42-
at = @At("RETURN"),
43-
cancellable = true
44-
)
40+
@Inject(method = "getComment", at = @At("RETURN"), cancellable = true)
4541
private void useI18nComment(CallbackInfoReturnable<String> cir) {
4642
if (Configs.backportI18nSupport.getBooleanValue()) {
4743
cir.setReturnValue(MiscUtil.getTranslatedOrFallback("config.comment." + this.getName().toLowerCase(),
@@ -56,20 +52,16 @@ public String getConfigGuiDisplayName() {
5652
}
5753

5854
@SuppressWarnings({"MixinAnnotationTarget", "UnresolvedMixinReference"})
59-
@Inject(
60-
method = "getConfigGuiDisplayName",
61-
at = @At("HEAD"),
62-
cancellable = true
63-
)
55+
@Inject(method = "getConfigGuiDisplayName", at = @At("HEAD"), cancellable = true)
6456
private void patchGetConfigGuiDisplayName(CallbackInfoReturnable<String> cir) {
6557
if (MixinConfigBase.masa_gadget_mod$tweakerMoreIConfigBaseClass
6658
.filter(clazz -> clazz.isInstance(this)).isPresent()) {
59+
cir.setReturnValue(I18n.tr("tweakermore.config.".concat(this.getName())));
6760
return;
6861
}
6962

7063
if (Configs.backportI18nSupport.getBooleanValue()) {
71-
cir.setReturnValue(I18n.translateOrFallback("config.name." + this.getName().toLowerCase(),
72-
this.getName()));
64+
cir.setReturnValue(I18n.translateOrFallback("config.name.".concat(this.getName().toLowerCase()), this.getName()));
7365
}
7466
}
7567
}

0 commit comments

Comments
 (0)