diff options
author | Roman / Linnea Gräf <romangraef@gmail.com> | 2022-11-05 20:23:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-05 20:23:46 +0100 |
commit | c9b5b020ecbbc48cdbb7580c60125589a2529604 (patch) | |
tree | 7fe9970955551f994b23bdec1ccc267406a738b9 /src/main/java/at | |
parent | 5588d2ec85891cd6cee669a81514b39dd3711767 (diff) | |
download | skyhanni-c9b5b020ecbbc48cdbb7580c60125589a2529604.tar.gz skyhanni-c9b5b020ecbbc48cdbb7580c60125589a2529604.tar.bz2 skyhanni-c9b5b020ecbbc48cdbb7580c60125589a2529604.zip |
Chat peeking (#6)
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/Chat.java | 6 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java | 20 |
2 files changed, 26 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); + } + +} |