Skip to content

Commit 2683f92

Browse files
committed
Add kill switch for all splicing table keybinds
1 parent c91af86 commit 2683f92

File tree

5 files changed

+27
-11
lines changed

5 files changed

+27
-11
lines changed

Common/src/main/java/gay/object/hexdebug/mixin/interop/emi/MixinEmiScreenManager.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
66
import com.llamalad7.mixinextras.sugar.Local;
77
import dev.emi.emi.screen.EmiScreenManager;
8+
import gay.object.hexdebug.config.HexDebugClientConfig;
89
import gay.object.hexdebug.gui.splicing.SplicingTableScreen;
910
import net.minecraft.client.Minecraft;
1011
import org.spongepowered.asm.mixin.Mixin;
@@ -16,7 +17,10 @@ public abstract class MixinEmiScreenManager {
1617
@Expression("keyCode == 89")
1718
@ModifyExpressionValue(method = "keyPressed", at = @At(value = "MIXINEXTRAS:EXPRESSION"), require = 0)
1819
private static boolean hexdebug$cancelHardcodedKeybindInSplicingTable(boolean original) {
19-
if (Minecraft.getInstance().screen instanceof SplicingTableScreen) {
20+
if (
21+
HexDebugClientConfig.getConfig().getEnableSplicingTableKeybinds()
22+
&& Minecraft.getInstance().screen instanceof SplicingTableScreen
23+
) {
2024
return false;
2125
}
2226
return original;

Common/src/main/kotlin/gay/object/hexdebug/config/HexDebugClientConfig.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ object HexDebugClientConfig {
9696
@Tooltip
9797
val invertSplicingTableScrollDirection: Boolean = false
9898

99+
@Tooltip
100+
val enableSplicingTableKeybinds: Boolean = true
101+
99102
@Tooltip
100103
@CollapsibleObject
101104
val splicingTableKeybinds = SplicingTableKeybinds()

Common/src/main/kotlin/gay/object/hexdebug/gui/splicing/SplicingTableScreen.kt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -538,15 +538,17 @@ class SplicingTableScreen(
538538
}
539539

540540
override fun keyPressed(keyCode: Int, scanCode: Int, modifiers: Int): Boolean {
541-
// AbstractContainerScreen.keyPressed always returns true, so check our keys first
542-
if (keyPressedInner(keyCode, scanCode)) return true
543-
544-
if (HexDebugClientConfig.config.splicingTableKeybinds.overrideVanillaArrowKeys) {
545-
when (keyCode) {
546-
GLFW.GLFW_KEY_UP,
547-
GLFW.GLFW_KEY_DOWN,
548-
GLFW.GLFW_KEY_LEFT,
549-
GLFW.GLFW_KEY_RIGHT -> return true
541+
if (HexDebugClientConfig.config.enableSplicingTableKeybinds) {
542+
// AbstractContainerScreen.keyPressed always returns true, so check our keys first
543+
if (keyPressedInner(keyCode, scanCode)) return true
544+
545+
if (HexDebugClientConfig.config.splicingTableKeybinds.overrideVanillaArrowKeys) {
546+
when (keyCode) {
547+
GLFW.GLFW_KEY_UP,
548+
GLFW.GLFW_KEY_DOWN,
549+
GLFW.GLFW_KEY_LEFT,
550+
GLFW.GLFW_KEY_RIGHT -> return true
551+
}
550552
}
551553
}
552554

Common/src/main/kotlin/gay/object/hexdebug/gui/splicing/widgets/SplicingTableButton.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ abstract class SplicingTableButton(
6666
open fun reload() {}
6767

6868
override fun updateTooltip() {
69-
if (HexDebugClientConfig.config.splicingTableKeybinds.overrideVanillaArrowKeys) {
69+
if (
70+
HexDebugClientConfig.config.enableSplicingTableKeybinds
71+
&& HexDebugClientConfig.config.splicingTableKeybinds.overrideVanillaArrowKeys
72+
) {
7073
updateFocus()
7174
}
7275
super.updateTooltip()

Common/src/main/resources/assets/hexdebug/lang/en_us.flatten.json5

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@
9595
"": "Invert Splicing Table Scroll Direction",
9696
"@Tooltip": "Whether scrolling up (as opposed to down) will increase the view index of the splicing table, and vice versa.",
9797
},
98+
enableSplicingTableKeybinds: {
99+
"": "Enable Splicing/Mindsplice Table Keybinds",
100+
"@Tooltip": "Enable custom keybinds in the Splicing Table and Mindsplice Table GUIs. If disabled, all settings in the next two categories are ignored.",
101+
},
98102
splicingTableKeybinds: {
99103
"": "Splicing Table Keybinds",
100104
"@Tooltip": "Keybinds for actions in the Splicing Table GUI.",

0 commit comments

Comments
 (0)