diff options
author | Wyvest <wyvestbusiness@gmail.com> | 2023-11-22 08:18:19 +0900 |
---|---|---|
committer | Wyvest <wyvestbusiness@gmail.com> | 2023-11-22 08:18:19 +0900 |
commit | 8b373f577d9c6dde26357ef3fc86691f1efef9b4 (patch) | |
tree | a5328e995d8f4df21a9fe94ac8e384be08833c70 /src/main/java/org/polyfrost/chatting/mixin/GuiUtilsMixin.java | |
parent | 64230799777473246b5f98efbc596206c5bbf42d (diff) | |
download | Chatting-8b373f577d9c6dde26357ef3fc86691f1efef9b4.tar.gz Chatting-8b373f577d9c6dde26357ef3fc86691f1efef9b4.tar.bz2 Chatting-8b373f577d9c6dde26357ef3fc86691f1efef9b4.zip |
update PGT and relocate to org.polyfrost
Diffstat (limited to 'src/main/java/org/polyfrost/chatting/mixin/GuiUtilsMixin.java')
-rw-r--r-- | src/main/java/org/polyfrost/chatting/mixin/GuiUtilsMixin.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/org/polyfrost/chatting/mixin/GuiUtilsMixin.java b/src/main/java/org/polyfrost/chatting/mixin/GuiUtilsMixin.java new file mode 100644 index 0000000..1e2d0e6 --- /dev/null +++ b/src/main/java/org/polyfrost/chatting/mixin/GuiUtilsMixin.java @@ -0,0 +1,36 @@ +package org.polyfrost.chatting.mixin; + +import cc.polyfrost.oneconfig.renderer.TextRenderer; +import net.minecraft.client.gui.FontRenderer; +import net.minecraftforge.fml.client.config.GuiUtils; +import org.polyfrost.chatting.config.ChattingConfig; +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.Redirect; + +@Mixin(value = GuiUtils.class, remap = false) +public class GuiUtilsMixin { + @Shadow + public static void drawGradientRect(int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) { + } + + @Redirect(method = "drawHoveringText", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/config/GuiUtils;drawGradientRect(IIIIIII)V")) + private static void redirectBackground(int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) { + if (!ChattingConfig.INSTANCE.getRemoveTooltipBackground()) { + drawGradientRect(zLevel, left, top, right, bottom, startColor, endColor); + } + } + + @Redirect(method = "drawHoveringText", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawStringWithShadow(Ljava/lang/String;FFI)I")) + private static int redirectText(FontRenderer instance, String text, float x, float y, int color) { + switch (ChattingConfig.INSTANCE.getTooltipTextRenderType()) { + case 0: + return instance.drawString(text, x, y, color, false); + case 2: + return TextRenderer.drawBorderedText(text, x, y, color, 255); + default: + return instance.drawStringWithShadow(text, x, y, color); + } + } +} |