diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2023-10-14 21:45:26 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-14 12:45:26 +0200 |
commit | 7a634386ec4dd842e946bd3ba331c0d565faf173 (patch) | |
tree | 558cc86b80b6e1af0d2a8ba857324b1d72ed774b /src/main/java/at/hannibal2/skyhanni/mixins | |
parent | 16ef943b3c2ce8db2331332261143a12bdba61cf (diff) | |
download | skyhanni-7a634386ec4dd842e946bd3ba331c0d565faf173.tar.gz skyhanni-7a634386ec4dd842e946bd3ba331c0d565faf173.tar.bz2 skyhanni-7a634386ec4dd842e946bd3ba331c0d565faf173.zip |
Feature: Modify Visual Words (#492)
Added /shwords. #492
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/mixins')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinFontRenderer.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinFontRenderer.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinFontRenderer.java index cf357eb74..7b6631ae4 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinFontRenderer.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinFontRenderer.java @@ -1,12 +1,17 @@ package at.hannibal2.skyhanni.mixins.transformers; import at.hannibal2.skyhanni.SkyHanniMod; +import at.hannibal2.skyhanni.features.misc.visualwords.ModifyVisualWords; import at.hannibal2.skyhanni.mixins.hooks.FontRendererHook; import net.minecraft.client.gui.FontRenderer; import org.spongepowered.asm.lib.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.*; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyConstant; +import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @@ -72,4 +77,14 @@ public abstract class MixinFontRenderer { public void insertEndOfString(String text, boolean shadow, CallbackInfo ci) { FontRendererHook.endChromaRendering(); } + + @ModifyVariable(method = "renderStringAtPos", at = @At("HEAD"), argsOnly = true) + private String renderStringAtPos(String text) { + return ModifyVisualWords.INSTANCE.modifyText(text); + } + + @ModifyVariable(method = "getStringWidth", at = @At("HEAD"), argsOnly = true) + private String getStringWidth(String text) { + return ModifyVisualWords.INSTANCE.modifyText(text); + } } |