Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Commit 295e069

Browse files
committed
I hate when I cant disable mods, lets fix it
1 parent 48ef606 commit 295e069

3 files changed

Lines changed: 18 additions & 12 deletions

File tree

src/main/java/com/github/chromaticforge/chat/ChatMod.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ public class ChatMod {
1414
public static final String NAME = "@MOD_NAME@";
1515
public static final String VERSION = "@MOD_VERSION@";
1616

17+
public static ChatConfig config;
18+
1719
@Mod.EventHandler
1820
public void onInit(FMLInitializationEvent event) {
19-
new ChatConfig();
21+
config = new ChatConfig();
2022
}
2123
}

src/main/java/com/github/chromaticforge/chat/mixins/GuiChatMixin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.github.chromaticforge.chat.mixins;
22

3+
import com.github.chromaticforge.chat.ChatMod;
34
import com.github.chromaticforge.chat.config.ChatConfig;
45
import net.minecraft.client.gui.Gui;
56
import net.minecraft.client.gui.GuiChat;
@@ -11,7 +12,7 @@
1112
public class GuiChatMixin {
1213
@Redirect(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiChat;drawRect(IIIII)V"))
1314
private void chat$backgroundColor(int left, int top, int right, int bottom, int oldcolor) {
14-
int color = ChatConfig.background ? ChatConfig.backgroundColor.getRGB() : 0x00000000;
15+
int color = ChatMod.config.enabled ? ChatConfig.background ? ChatConfig.backgroundColor.getRGB() : 0x00000000 : oldcolor;
1516
Gui.drawRect(left, top, right, bottom, color);
1617
}
1718
}

src/main/java/com/github/chromaticforge/chat/mixins/GuiNewChatMixin.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import cc.polyfrost.oneconfig.platform.Platform;
44
import cc.polyfrost.oneconfig.renderer.TextRenderer;
5+
import com.github.chromaticforge.chat.ChatMod;
56
import com.github.chromaticforge.chat.config.ChatConfig;
67
import net.minecraft.client.gui.FontRenderer;
78
import net.minecraft.client.gui.Gui;
@@ -14,21 +15,23 @@
1415
public class GuiNewChatMixin {
1516
@Redirect(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawStringWithShadow(Ljava/lang/String;FFI)I"))
1617
private int chat$textShadow(FontRenderer instance, String text, float x, float y, int color) {
17-
switch (ChatConfig.textShadow) {
18-
case 0:
19-
return (int) Platform.getGLPlatform().drawText(text, x, y, color, false);
20-
case 1:
21-
return (int) Platform.getGLPlatform().drawText(text, x, y, color, true);
22-
case 2:
23-
return TextRenderer.drawBorderedText(text, x, y, color, (color >> 24) & 0xFF);
24-
default:
25-
return instance.drawString(text, x, y, color, true);
18+
if (ChatMod.config.enabled) {
19+
switch (ChatConfig.textShadow) {
20+
case 0:
21+
return (int) Platform.getGLPlatform().drawText(text, x, y, color, false);
22+
case 1:
23+
return (int) Platform.getGLPlatform().drawText(text, x, y, color, true);
24+
case 2:
25+
return TextRenderer.drawBorderedText(text, x, y, color, (color >> 24) & 0xFF);
26+
}
2627
}
28+
29+
return instance.drawString(text, x, y, color, true);
2730
}
2831

2932
@Redirect(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;drawRect(IIIII)V"))
3033
private void chat$backgroundColor(int left, int top, int right, int bottom, int oldcolor) {
31-
int color = ChatConfig.background ? ChatConfig.backgroundColor.getRGB() : 0x00000000;
34+
int color = ChatMod.config.enabled ? ChatConfig.background ? ChatConfig.backgroundColor.getRGB() : 0x00000000 : oldcolor;
3235
Gui.drawRect(left, top, right, bottom, color);
3336
}
3437
}

0 commit comments

Comments
 (0)