Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Wardrobe Keybinds #2198

Merged
merged 2 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/java/at/hannibal2/skyhanni/data/GuiData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ object GuiData {
if (preDrawEventCancelled) event.isCanceled = true
}

@SubscribeEvent(priority = EventPriority.HIGH)
@SubscribeEvent(priority = EventPriority.HIGHEST)
fun onGuiKeyPress(event: GuiScreenEvent.KeyboardInputEvent.Pre) {
val keys = Minecraft.getMinecraft().gameSettings.let {
val allowedKeys = Minecraft.getMinecraft().gameSettings.let {
listOf(
Keyboard.KEY_ESCAPE,
it.keyBindInventory.keyCode,
it.keyBindScreenshot.keyCode,
it.keyBindFullscreen.keyCode,
)
}
if (keys.any { it.isKeyHeld() }) return
if (allowedKeys.any { it.isKeyHeld() }) return

if (CustomWardrobeKeybinds.allowKeyboardClick()) return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.GuiKeyPressEvent
import at.hannibal2.skyhanni.features.inventory.wardrobe.CustomWardrobe.clickSlot
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyClicked
import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
Expand Down Expand Up @@ -33,8 +34,8 @@ object CustomWardrobeKeybinds {
if (!isEnabled()) return
val slots = WardrobeAPI.slots.filter { it.isInCurrentPage() }

for ((key, index) in keybinds.withIndex().map { it.value to it.index }) {
if (!key.isKeyClicked()) continue
for ((index, key) in keybinds.withIndex()) {
if (!key.isKeyHeld()) continue
if (lastClick.passedSince() < 200.milliseconds) break
val slot = slots.getOrNull(index) ?: continue

Expand Down
Loading