diff options
Diffstat (limited to 'src/main/java/com/raeids')
-rw-r--r-- | src/main/java/com/raeids/stratus/hook/GuiNewChatHook.java | 2 | ||||
-rw-r--r-- | src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java | 20 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/main/java/com/raeids/stratus/hook/GuiNewChatHook.java b/src/main/java/com/raeids/stratus/hook/GuiNewChatHook.java index 4db0b51..67552c4 100644 --- a/src/main/java/com/raeids/stratus/hook/GuiNewChatHook.java +++ b/src/main/java/com/raeids/stratus/hook/GuiNewChatHook.java @@ -18,4 +18,6 @@ public interface GuiNewChatHook { String getPrevText(); void setPrevText(String prevText); + + int getTextOpacity(); } diff --git a/src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java b/src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java index 4e79cac..e701758 100644 --- a/src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java +++ b/src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java @@ -3,9 +3,9 @@ package com.raeids.stratus.mixin; import com.raeids.stratus.Stratus; import com.raeids.stratus.chat.ChatSearchingManager; import com.raeids.stratus.chat.ChatTabs; -import com.raeids.stratus.utils.ModCompatHooks; import com.raeids.stratus.config.StratusConfig; import com.raeids.stratus.hook.GuiNewChatHook; +import com.raeids.stratus.utils.ModCompatHooks; import com.raeids.stratus.utils.RenderHelper; import gg.essential.universal.UMouse; import net.minecraft.client.Minecraft; @@ -15,7 +15,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; -import org.spongepowered.asm.lib.Opcodes; +import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -36,6 +36,7 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { @Unique private int stratus$right = 0; @Unique private boolean stratus$shouldCopy; @Unique private boolean stratus$chatCheck; + @Unique private int stratus$textOpacity; @Shadow @Final private Minecraft mc; @Shadow @Final private List<ChatLine> drawnChatLines; @SuppressWarnings({"FieldCanBeLocal", "unused"}) @@ -113,6 +114,16 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { return ChatSearchingManager.filterMessages(stratus$previousText, drawnChatLines); } + @ModifyVariable(method = "drawChat", at = @At("STORE"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/util/MathHelper;clamp_double(DDD)D"), to = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/ChatLine;getChatComponent()Lnet/minecraft/util/IChatComponent;")), name = "l1") + private int modifyYeah(int value) { + return stratus$textOpacity = value; + } + + @Redirect(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawStringWithShadow(Ljava/lang/String;FFI)I")) + private int redirectDrawString(FontRenderer instance, String text, float x, float y, int color) { + return ModCompatHooks.redirectDrawString(text, x, y, color); + } + @Inject(method = "drawChat", at = @At("RETURN")) private void checkStuff(int j2, CallbackInfo ci) { if (!stratus$chatCheck && stratus$shouldCopy) { @@ -221,4 +232,9 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { public void setPrevText(String prevText) { stratus$previousText = prevText; } + + @Override + public int getTextOpacity() { + return stratus$textOpacity; + } } |