Skip to content

Commit

Permalink
new: chat background when open (Sk1erLLC#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexdoru authored Nov 16, 2022
1 parent 6f61d33 commit 8854d74
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/main/java/club/sk1er/patcher/config/PatcherConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -1272,6 +1279,7 @@ public PatcherConfig() {
addDependency("timestampsStyle", "timestamps");
addDependency("secondsOnTimestamps", "timestamps");
addDependency("imagePreviewWidth", "imagePreview");
addDependency("transparentChatOnlyWhenClosed", "transparentChat");

Arrays.asList(
"slownessFovModifierFloat", "speedFovModifierFloat",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 8854d74

Please sign in to comment.