diff options
Diffstat (limited to 'src')
5 files changed, 31 insertions, 6 deletions
diff --git a/src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java b/src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java index e701758..f606d4e 100644 --- a/src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java +++ b/src/main/java/com/raeids/stratus/mixin/GuiNewChatMixin.java @@ -114,9 +114,9 @@ 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") + @ModifyVariable(method = "drawChat", at = @At("STORE"), ordinal = 7) private int modifyYeah(int value) { - return stratus$textOpacity = value; + return stratus$textOpacity = (int) (((float) (getChatOpen() ? 255 : value)) * (mc.gameSettings.chatOpacity * 0.9F + 0.1F)); } @Redirect(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawStringWithShadow(Ljava/lang/String;FFI)I")) diff --git a/src/main/java/com/raeids/stratus/mixin/WyvtilsListenerMixin.java b/src/main/java/com/raeids/stratus/mixin/WyvtilsListenerMixin.java new file mode 100644 index 0000000..768b7c7 --- /dev/null +++ b/src/main/java/com/raeids/stratus/mixin/WyvtilsListenerMixin.java @@ -0,0 +1,21 @@ +package com.raeids.stratus.mixin; + +import com.raeids.stratus.utils.RenderHelper; +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Coerce; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Pseudo +@Mixin(targets = "net.wyvest.wyvtils.core.listener.Listener") +public class WyvtilsListenerMixin { + + @Dynamic("Wyvtils") + @Inject(method = "onStringRendered", at = @At("HEAD"), cancellable = true) + private void cancelStringRender(@Coerce Object a, CallbackInfo ci) { + if (RenderHelper.INSTANCE.getBypassWyvtils()) ci.cancel(); + } +} diff --git a/src/main/kotlin/com/raeids/stratus/gui/ChatShortcutViewGui.kt b/src/main/kotlin/com/raeids/stratus/gui/ChatShortcutViewGui.kt index 6efd29c..86989c4 100644 --- a/src/main/kotlin/com/raeids/stratus/gui/ChatShortcutViewGui.kt +++ b/src/main/kotlin/com/raeids/stratus/gui/ChatShortcutViewGui.kt @@ -16,10 +16,10 @@ import gg.essential.vigilance.gui.settings.ButtonComponent class ChatShortcutViewGui : WindowScreen(version = ElementaVersion.V1) { override fun initScreen(width: Int, height: Int) { super.initScreen(width, height) - for ((yes, shortcut) in ChatShortcuts.shortcuts.withIndex()) { + for ((index, shortcut) in ChatShortcuts.shortcuts.withIndex()) { val block = UIBlock(VigilancePalette.getBackground()).constrain { x = 3.percent() - y = (yes * 12).percent() + y = (index * 12).percent() this.width = 94.percent() this.height = 25.pixels() } childOf this.window diff --git a/src/main/kotlin/com/raeids/stratus/utils/RenderHelper.kt b/src/main/kotlin/com/raeids/stratus/utils/RenderHelper.kt index 8fd417b..9e454d7 100644 --- a/src/main/kotlin/com/raeids/stratus/utils/RenderHelper.kt +++ b/src/main/kotlin/com/raeids/stratus/utils/RenderHelper.kt @@ -21,11 +21,12 @@ import java.lang.reflect.Method import java.nio.ByteBuffer import java.nio.ByteOrder import javax.imageio.ImageIO -import kotlin.math.roundToInt object RenderHelper { private val regex = Regex("(?i)\\u00A7[0-9a-f]") + var bypassWyvtils = false + private set /** * Taken from https://github.com/Moulberry/HyChat @@ -228,6 +229,7 @@ object RenderHelper { val noColors = text.replace(regex, "\u00A7r") var yes = 0 if (((Minecraft.getMinecraft().ingameGUI.chatGUI as GuiNewChatHook).textOpacity / 4) > 3) { + bypassWyvtils = true for (xOff in -2..2) { for (yOff in -2..2) { if (xOff * xOff != yOff * yOff) { @@ -238,6 +240,7 @@ object RenderHelper { } } } + bypassWyvtils = false } yes += fontRendererIn.drawString(text, x, y, color) return yes diff --git a/src/main/resources/mixins.stratus.json b/src/main/resources/mixins.stratus.json index 71ce68e..b7deede 100644 --- a/src/main/resources/mixins.stratus.json +++ b/src/main/resources/mixins.stratus.json @@ -9,7 +9,8 @@ "GuiChatMixin", "GuiNewChatAccessor", "GuiNewChatMapMixin", - "GuiNewChatMixin" + "GuiNewChatMixin", + "WyvtilsListenerMixin" ], "verbose": true }
\ No newline at end of file |