Skip to content

Commit 82824da

Browse files
committed
fix space not incrementing x
1 parent 2ad6e27 commit 82824da

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,41 @@
11
package gregtech.mixins.mui2;
22

3+
import net.minecraft.client.gui.FontRenderer;
4+
5+
import com.cleanroommc.modularui.api.drawable.IKey;
36
import com.cleanroommc.modularui.drawable.text.RichTextCompiler;
7+
import com.llamalad7.mixinextras.sugar.Local;
48
import org.spongepowered.asm.mixin.Mixin;
9+
import org.spongepowered.asm.mixin.Shadow;
510
import org.spongepowered.asm.mixin.injection.At;
11+
import org.spongepowered.asm.mixin.injection.Inject;
612
import org.spongepowered.asm.mixin.injection.ModifyArg;
13+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
14+
15+
import java.util.List;
716

817
@Mixin(value = RichTextCompiler.class, remap = false)
918
public class RichTextCompilerMixin {
1019

20+
@Shadow
21+
private int x;
22+
23+
@Shadow
24+
private FontRenderer fr;
25+
1126
@ModifyArg(method = "trimRight",
1227
at = @At(value = "INVOKE",
1328
target = "Ljava/lang/String;substring(II)Ljava/lang/String;"),
1429
index = 1)
1530
private static int fixTrim(int beginIndex) {
1631
return beginIndex + 1;
1732
}
33+
34+
@Inject(method = "compile",
35+
at = @At(value = "INVOKE",
36+
target = "Lcom/cleanroommc/modularui/drawable/text/RichTextCompiler;addLineElement(Ljava/lang/Object;)V",
37+
ordinal = 0))
38+
private void moveXString(List<Object> raw, CallbackInfo ci, @Local IKey key) {
39+
x += fr.getStringWidth(key.get());
40+
}
1841
}

0 commit comments

Comments
 (0)