Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/main/java/gregtech/mixins/mui2/LangKeyMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@
import com.cleanroommc.modularui.drawable.text.BaseKey;
import com.cleanroommc.modularui.drawable.text.LangKey;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.function.Supplier;

// all this mixin does is switch newlines to the expected format
@Mixin(value = LangKey.class, remap = false)
public abstract class LangKeyMixin extends BaseKey {

@Shadow
private long time;

@ModifyExpressionValue(method = "getFormatted",
at = @At(value = "INVOKE",
target = "Lcom/cleanroommc/modularui/drawable/text/FontRenderHelper;formatArgs([Ljava/lang/Object;Lcom/cleanroommc/modularui/drawable/text/FormattingState;Ljava/lang/String;Z)Ljava/lang/String;"))
Expand All @@ -25,4 +34,11 @@ public String getTranslateKey(String original) {
public String switchNewLines(String original) {
return original.replace("/n", "\n");
}

@Inject(method = "<init>(Ljava/util/function/Supplier;Ljava/util/function/Supplier;)V",
at = @At(value = "RETURN"))
private void setTimeToNegativeOne(@NotNull Supplier<String> keySupplier, @NotNull Supplier<Object[]> argsSupplier,
CallbackInfo ci) {
time = -1;
}
}
Loading