aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java12
3 files changed, 25 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java
index 7446063ba..45e2d12ac 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java
@@ -83,11 +83,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.ignoreChat = false;
SkyHanniMod.getFeature().chroma.chromaDirection = Direction.FORWARD_RIGHT;
}
}
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 d8a4e8344..4959bda33 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
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 bc7ea9019..49d4f1949 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<Boolean> 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);
+ }
}