Skip to content

Commit

Permalink
also replace /n with \n
Browse files Browse the repository at this point in the history
  • Loading branch information
ghzdude committed Feb 1, 2025
1 parent 5b4c2c2 commit e275ace
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/java/gregtech/mixins/mui2/LangKeyMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.cleanroommc.modularui.drawable.text.BaseKey;
import com.cleanroommc.modularui.drawable.text.LangKey;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
Expand All @@ -16,6 +17,15 @@ public abstract class LangKeyMixin extends BaseKey {
at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/resources/I18n;format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;"))
public String getTranslateKey(String translateKey, Object[] parameters) {
return LocaleAccessor.getRawKey(translateKey).replace("\\n", "\n");
return LocaleAccessor.getRawKey(translateKey)
.replace("\\n", "\n")
.replace("/n", "\n");
}

@ModifyExpressionValue(method = "get",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/resources/I18n;format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;"))
public String switchNewLines(String original) {
return original.replace("/n", "\n");
}
}

0 comments on commit e275ace

Please sign in to comment.