diff options
author | Walker Selby <git@walkerselby.com> | 2023-12-08 07:59:28 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-08 16:59:28 +0100 |
commit | 9867f18f4c5b0f51a6ecc9274152a1fb9d1dedb5 (patch) | |
tree | 161f9ed28b70bedbec2de3d9a078ea40398c4ec2 /src/main/java/at/hannibal2/skyhanni/features | |
parent | f87b7f68cbbcfd7a940fc4e3888ac94545132543 (diff) | |
download | skyhanni-9867f18f4c5b0f51a6ecc9274152a1fb9d1dedb5.tar.gz skyhanni-9867f18f4c5b0f51a6ecc9274152a1fb9d1dedb5.tar.bz2 skyhanni-9867f18f4c5b0f51a6ecc9274152a1fb9d1dedb5.zip |
Localize Keypresses (#754)
Fixed control/modifier key logic on apple devices. #754
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
5 files changed, 18 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index ffb08f93b..5d14fc142 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -421,7 +421,7 @@ object ComposterOverlay { val name = itemName.substring(0, 2) + selected + rawItemName list.add(Renderable.link("$name §8x${itemsNeeded.addSeparators()} §7(§6$format§7)") { onClick(internalName) - if (KeyboardManager.isControlKeyDown() && lastAttemptTime.passedSince() > 500.milliseconds) { + if (KeyboardManager.isModifierKeyDown() && lastAttemptTime.passedSince() > 500.milliseconds) { lastAttemptTime = SimpleTimeMark.now() retrieveMaterials(internalName, itemName, itemsNeeded.toInt()) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt index d0c6d91f8..3ea8ac0e3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -4,6 +4,9 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.background import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.borderLine +import at.hannibal2.skyhanni.data.jsonobjects.repo.HideNotClickableItemsJson +import at.hannibal2.skyhanni.data.jsonobjects.repo.HideNotClickableItemsJson.SalvageFilter +import at.hannibal2.skyhanni.data.jsonobjects.repo.MultiFilterJson import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi @@ -27,9 +30,6 @@ import at.hannibal2.skyhanni.utils.MultiFilter import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRiftExportable import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRiftTransferable import at.hannibal2.skyhanni.utils.StringUtils.removeColor -import at.hannibal2.skyhanni.data.jsonobjects.repo.HideNotClickableItemsJson -import at.hannibal2.skyhanni.data.jsonobjects.repo.HideNotClickableItemsJson.SalvageFilter -import at.hannibal2.skyhanni.data.jsonobjects.repo.MultiFilterJson import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest @@ -131,7 +131,7 @@ class HideNotClickableItems { } else { event.toolTip.add("§c$hideReason") if (config.itemsBypass) { - event.toolTip.add(" §7(Bypass by holding the control key)") + event.toolTip.add(" §7(Bypass by holding the ${KeyboardManager.getModifierKeyName()} key)") } } } @@ -162,7 +162,7 @@ class HideNotClickableItems { } } - private fun bypasssActive() = config.itemsBypass && KeyboardManager.isControlKeyDown() + private fun bypasssActive() = config.itemsBypass && KeyboardManager.isModifierKeyDown() private fun isDisabled(): Boolean { if (bypassUntil > System.currentTimeMillis()) return true diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt index 5265d6cfd..a72d5624f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt @@ -32,14 +32,19 @@ class QuickCraftFeatures { if (!isEnabled() || !quickCraftSlots.contains(event.slot.slotNumber)) return
if (needsQuickCraftConfirmation(event.itemStack)) {
- event.toolTip.replaceAll { it.replace("Click to craft!", "§cCtrl+Click to craft!") }
+ event.toolTip.replaceAll {
+ it.replace(
+ "Click to craft!",
+ "§c${KeyboardManager.getModifierKeyName()} + Click to craft!"
+ )
+ }
}
}
@SubscribeEvent
fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) {
if (!isEnabled()) return
- if (KeyboardManager.isControlKeyDown()) return
+ if (KeyboardManager.isModifierKeyDown()) return
if (event.gui !is GuiChest) return
val chest = event.gui.inventorySlots as ContainerChest
@@ -62,7 +67,7 @@ class QuickCraftFeatures { val clickedItem = event.slot?.stack ?: return
- if (!KeyboardManager.isControlKeyDown() && needsQuickCraftConfirmation(clickedItem)) {
+ if (!KeyboardManager.isModifierKeyDown() && needsQuickCraftConfirmation(clickedItem)) {
event.isCanceled = true
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt index 2eac62d1f..5598386f8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt @@ -140,7 +140,7 @@ object AdvancedPlayerList { } fun ignoreCustomTabList(): Boolean { - val denyKeyPressed = SkyHanniMod.feature.dev.debug.enabled && KeyboardManager.isControlKeyDown() + val denyKeyPressed = SkyHanniMod.feature.dev.debug.enabled && KeyboardManager.isModifierKeyDown() return denyKeyPressed || !SkyHanniDebugsAndTests.globalRender } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt index a996d7277..03cf21b1d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt @@ -459,7 +459,7 @@ open class VisualWordGui : GuiScreen() { super.keyTyped(typedChar, keyCode) if (!currentlyEditing) { if (keyCode == Keyboard.KEY_DOWN || keyCode == Keyboard.KEY_S) { - if (KeyboardManager.isControlKeyDown()) { + if (KeyboardManager.isModifierKeyDown()) { pageScroll = -(SkyHanniMod.feature.storage.modifiedWords.size * 30 - 100) } else { pageScroll -= 30 @@ -467,7 +467,7 @@ open class VisualWordGui : GuiScreen() { scrollScreen() } if (keyCode == Keyboard.KEY_UP || keyCode == Keyboard.KEY_W) { - if (KeyboardManager.isControlKeyDown()) { + if (KeyboardManager.isModifierKeyDown()) { pageScroll = 0 } else { pageScroll += 30 @@ -481,7 +481,7 @@ open class VisualWordGui : GuiScreen() { if (keyCode == Keyboard.KEY_BACK) { if (currentText.isNotEmpty()) { - currentText = if (KeyboardManager.isControlKeyDown()) { + currentText = if (KeyboardManager.isModifierKeyDown()) { "" } else if (KeyboardManager.isShiftKeyDown()) { val lastSpaceIndex = currentText.lastIndexOf(' ') |