From 3adeadb8eca478f23111676fa82afdaa11a42896 Mon Sep 17 00:00:00 2001 From: Roman / Linnea Gräf Date: Sat, 11 Mar 2023 17:13:16 +0100 Subject: Fix mouse button chat peek and early launch crashes (#14) --- .../hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java index 31a915b05..bdc0b01c2 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.mixins.transformers.gui; import at.hannibal2.skyhanni.SkyHanniMod; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiNewChat; import org.lwjgl.input.Keyboard; import org.spongepowered.asm.mixin.Mixin; @@ -13,7 +14,9 @@ public class MixinGuiNewChat { @Inject(method = "getChatOpen", at = @At("HEAD"), cancellable = true) public void onIsOpen(CallbackInfoReturnable cir) { - if (SkyHanniMod.feature.chat.peekChat != Keyboard.KEY_NONE && Keyboard.isKeyDown(SkyHanniMod.feature.chat.peekChat)) + if (SkyHanniMod.feature.chat.peekChat > Keyboard.KEY_NONE + && Minecraft.getMinecraft().thePlayer != null + && Keyboard.isKeyDown(SkyHanniMod.feature.chat.peekChat)) cir.setReturnValue(true); } } -- cgit