aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Chat.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java20
-rw-r--r--src/main/resources/mixins.skyhanni.json3
3 files changed, 29 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java b/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java
index d00813c2b..e12d96f57 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java
@@ -2,10 +2,16 @@ package at.hannibal2.skyhanni.config.features;
import at.hannibal2.skyhanni.config.core.config.annotations.*;
import com.google.gson.annotations.Expose;
+import org.lwjgl.input.Keyboard;
public class Chat {
@Expose
+ @ConfigOption(name = "Peek Chat", desc = "Hold this key to keep the chat open")
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_Z)
+ public int peekChat = Keyboard.KEY_Z;
+
+ @Expose
@ConfigOption(name = "Chat Filter Types", desc = "")
@ConfigEditorAccordion(id = 0)
public boolean filterTypes = false;
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
new file mode 100644
index 000000000..f21b4c948
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java
@@ -0,0 +1,20 @@
+package at.hannibal2.skyhanni.mixins.transformers.gui;
+
+import at.hannibal2.skyhanni.SkyHanniMod;
+import net.minecraft.client.gui.GuiNewChat;
+import org.lwjgl.input.Keyboard;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+@Mixin(GuiNewChat.class)
+public class MixinGuiNewChat {
+
+ @Inject(method = "getChatOpen", at = @At("HEAD"), cancellable = true)
+ public void onIsOpen(CallbackInfoReturnable<Boolean> cir) {
+ if (SkyHanniMod.feature.chat.peekChat != Keyboard.KEY_NONE && Keyboard.isKeyDown(SkyHanniMod.feature.chat.peekChat))
+ cir.setReturnValue(true);
+ }
+
+}
diff --git a/src/main/resources/mixins.skyhanni.json b/src/main/resources/mixins.skyhanni.json
index 0058e4053..dc5d80243 100644
--- a/src/main/resources/mixins.skyhanni.json
+++ b/src/main/resources/mixins.skyhanni.json
@@ -15,5 +15,8 @@
"renderer.MixinBlockRendererDispatcher",
"renderer.MixinRendererLivingEntity",
"tileentity.TileEntitySignMixin"
+ ],
+ "client": [
+ "gui.MixinGuiNewChat"
]
}