diff --git a/src/main/java/club/sk1er/patcher/config/PatcherConfig.java b/src/main/java/club/sk1er/patcher/config/PatcherConfig.java index 5d1cbc87a..d88fca736 100644 --- a/src/main/java/club/sk1er/patcher/config/PatcherConfig.java +++ b/src/main/java/club/sk1er/patcher/config/PatcherConfig.java @@ -918,6 +918,13 @@ public static int getInventoryScale() { ) public static boolean transparentChat; + @Property( + type = PropertyType.SWITCH, name = "Chat Background When Open", + description = "Add back the background when chat is open.", + category = "Screens", subcategory = "Chat" + ) + public static boolean transparentChatOnlyWhenClosed; + @Property( type = PropertyType.SWITCH, name = "Transparent Chat Input Field", description = "Remove the background from chat's input field.\n§eCan positively impact performance.", @@ -1272,6 +1279,7 @@ public PatcherConfig() { addDependency("timestampsStyle", "timestamps"); addDependency("secondsOnTimestamps", "timestamps"); addDependency("imagePreviewWidth", "imagePreview"); + addDependency("transparentChatOnlyWhenClosed", "transparentChat"); Arrays.asList( "slownessFovModifierFloat", "speedFovModifierFloat", diff --git a/src/main/java/club/sk1er/patcher/mixins/features/GuiNewChatMixin_TransparentChat.java b/src/main/java/club/sk1er/patcher/mixins/features/GuiNewChatMixin_TransparentChat.java index 5fbcf793c..26f0f1a84 100644 --- a/src/main/java/club/sk1er/patcher/mixins/features/GuiNewChatMixin_TransparentChat.java +++ b/src/main/java/club/sk1er/patcher/mixins/features/GuiNewChatMixin_TransparentChat.java @@ -5,12 +5,20 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiNewChat; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @Mixin(GuiNewChat.class) public abstract class GuiNewChatMixin_TransparentChat extends Gui { + + @Shadow + public abstract boolean getChatOpen(); + @WrapWithCondition(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;drawRect(IIIII)V", ordinal = 0)) private boolean patcher$transparentChat(int left, int top, int right, int bottom, int color) { - return !PatcherConfig.transparentChat; + if (PatcherConfig.transparentChat) { + return PatcherConfig.transparentChatOnlyWhenClosed && getChatOpen(); + } + return true; } }