From 19231489adc73aa7aa41c89ff90eaff6d9dd7bd4 Mon Sep 17 00:00:00 2001 From: nea Date: Mon, 4 Sep 2023 16:28:00 +0200 Subject: Add chat peeking keybinding --- src/main/java/moe/nea/firmament/mixins/MixinChatHud.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/moe/nea/firmament/mixins/MixinChatHud.java b/src/main/java/moe/nea/firmament/mixins/MixinChatHud.java index 12217d2..bc7c036 100644 --- a/src/main/java/moe/nea/firmament/mixins/MixinChatHud.java +++ b/src/main/java/moe/nea/firmament/mixins/MixinChatHud.java @@ -6,7 +6,9 @@ package moe.nea.firmament.mixins; +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import moe.nea.firmament.events.ClientChatLineReceivedEvent; +import moe.nea.firmament.features.fixes.Fixes; import net.minecraft.client.gui.hud.ChatHud; import net.minecraft.client.gui.hud.MessageIndicator; import net.minecraft.network.message.MessageSignatureData; @@ -19,6 +21,16 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(ChatHud.class) public class MixinChatHud { + + @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(); + } + @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;ILnet/minecraft/client/gui/hud/MessageIndicator;Z)V"), method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V") public Text onAddMessage(Text message) { var event = new ClientChatLineReceivedEvent(message); -- cgit