aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/firmament/mixins/ChatPeekingPatch.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/moe/nea/firmament/mixins/ChatPeekingPatch.java')
-rw-r--r--src/main/java/moe/nea/firmament/mixins/ChatPeekingPatch.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/ChatPeekingPatch.java b/src/main/java/moe/nea/firmament/mixins/ChatPeekingPatch.java
new file mode 100644
index 0000000..25ba0eb
--- /dev/null
+++ b/src/main/java/moe/nea/firmament/mixins/ChatPeekingPatch.java
@@ -0,0 +1,28 @@
+/*
+ * SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+package moe.nea.firmament.mixins;
+
+import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
+import moe.nea.firmament.features.fixes.Fixes;
+import net.minecraft.client.gui.hud.ChatHud;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+
+@Mixin(ChatHud.class)
+public class ChatPeekingPatch {
+
+ @ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;isChatFocused()Z"))
+ public boolean onGetChatHud(boolean old) {
+ return old || Fixes.INSTANCE.shouldPeekChat();
+ }
+
+ @ModifyExpressionValue(method = "getHeight", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;isChatFocused()Z"))
+ public boolean onGetChatHudHeight(boolean old) {
+ return old || Fixes.INSTANCE.shouldPeekChat();
+ }
+
+}