diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/ChromaConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/ChromaConfig.java index 80c40cd9843e..9e819f8e7855 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/ChromaConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/ChromaConfig.java @@ -52,11 +52,17 @@ public class ChromaConfig { @ConfigEditorBoolean public boolean allChroma = false; + @Expose + @ConfigOption(name = "Ignore Chat", desc = "Prevents Everything Chroma from applying to the chat if you unironically use that feature...") + @ConfigEditorBoolean + public boolean ignoreChat = false; + private void resetChromaSettings() { SkyHanniMod.getFeature().chroma.chromaSize = 30f; SkyHanniMod.getFeature().chroma.chromaSpeed = 6f; SkyHanniMod.getFeature().chroma.chromaSaturation = 0.75f; SkyHanniMod.getFeature().chroma.allChroma = false; SkyHanniMod.getFeature().chroma.chromaDirection = 0; + SkyHanniMod.getFeature().chroma.ignoreChat = false; } } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt index a2fc3ad7660c..f11acc235d32 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.features.chroma.ChromaFontRenderer import at.hannibal2.skyhanni.mixins.transformers.AccessorFontRenderer import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.shader.ShaderManager import net.minecraft.client.Minecraft import net.minecraft.client.renderer.GlStateManager import org.spongepowered.asm.mixin.injection.callback.CallbackInfo @@ -24,6 +25,8 @@ object FontRendererHook { private var currentDrawState: ChromaFontRenderer? = null private var previewChroma = false + var cameFromChat = false + /** * Setups the [ChromaFontRenderer][at.hannibal2.skyhanni.features.chroma.ChromaFontRenderer] for rendering text * in chroma. This should only be used when you don't have control over the color code a string uses, or it @@ -61,6 +64,10 @@ object FontRendererHook { fun beginChromaRendering(text: String, shadow: Boolean) { if (!LorenzUtils.inSkyBlock) return if (!SkyHanniMod.feature.chroma.enabled) return + if (SkyHanniMod.feature.chroma.allChroma && SkyHanniMod.feature.chroma.ignoreChat && cameFromChat) { + endChromaFont() + return + } if (text == "§fPlease star the mod on GitHub!") { previewChroma = true @@ -151,4 +158,4 @@ object FontRendererHook { } return false } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java index bc7ea90191fa..49d4f1949210 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java @@ -1,10 +1,12 @@ package at.hannibal2.skyhanni.mixins.transformers.gui; import at.hannibal2.skyhanni.features.chat.ChatPeek; +import at.hannibal2.skyhanni.mixins.hooks.FontRendererHook; import net.minecraft.client.gui.GuiNewChat; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(GuiNewChat.class) @@ -14,4 +16,14 @@ public class MixinGuiNewChat { public void onIsOpen(CallbackInfoReturnable cir) { if (ChatPeek.peek()) cir.setReturnValue(true); } + + @Inject(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;enableBlend()V", shift = At.Shift.AFTER)) + private void setTextRenderIsFromChat(int updateCounter, CallbackInfo ci) { + FontRendererHook.INSTANCE.setCameFromChat(true); + } + + @Inject(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;disableAlpha()V", shift = At.Shift.BEFORE)) + private void setTextRenderIsntFromChat(int updateCounter, CallbackInfo ci) { + FontRendererHook.INSTANCE.setCameFromChat(false); + } }