From bdf41e7ed840384a7a0f4cae68eaebaf63c28c17 Mon Sep 17 00:00:00 2001 From: firenoo <49818773+firenoo@users.noreply.github.com> Date: Wed, 31 Aug 2022 01:24:49 -0700 Subject: [PATCH] findit/util/AbstractStackFinder: Add check for whether NEI Search is focused (#8) * findit/util/AbstractStackFinder: Add check for whether NEI Search is focused This adds a check to make sure that FindIt doesn't start a search when searching in NEI Signed-off-by: Firenoo <49818773+firenoo@users.noreply.github.com> * findit/util/AbstractStackFinder: Move key handling code to lastKeyTyped Moves FindIt's keyhandling code to lastKeyTyped to avoid conflicting with textfields. Signed-off-by: Firenoo <49818773+firenoo@users.noreply.github.com> * findit/util/AbstractStackFinder: Code cleanup Signed-off-by: Firenoo <49818773+firenoo@users.noreply.github.com> * findit/service: Revert default keybinds to T/Y. Signed-off-by: Firenoo <49818773+firenoo@users.noreply.github.com> Signed-off-by: Firenoo <49818773+firenoo@users.noreply.github.com> --- .../blockfinder/ClientBlockFindService.java | 2 +- .../itemfinder/ClientItemFindService.java | 2 +- .../gtnh/findit/util/AbstractStackFinder.java | 24 +++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gtnh/findit/service/blockfinder/ClientBlockFindService.java b/src/main/java/com/gtnh/findit/service/blockfinder/ClientBlockFindService.java index 579341a..392d82a 100644 --- a/src/main/java/com/gtnh/findit/service/blockfinder/ClientBlockFindService.java +++ b/src/main/java/com/gtnh/findit/service/blockfinder/ClientBlockFindService.java @@ -16,7 +16,7 @@ public class ClientBlockFindService extends BlockFindService { public ClientBlockFindService() { - API.addHashBind("gui.findit.find_block", Keyboard.KEY_Y + NEIClientUtils.SHIFT_HASH); + API.addHashBind("gui.findit.find_block", Keyboard.KEY_Y); GuiContainerManager.addInputHandler(new BlockFindInputHandler()); } diff --git a/src/main/java/com/gtnh/findit/service/itemfinder/ClientItemFindService.java b/src/main/java/com/gtnh/findit/service/itemfinder/ClientItemFindService.java index 4948b5f..0cf3cfd 100644 --- a/src/main/java/com/gtnh/findit/service/itemfinder/ClientItemFindService.java +++ b/src/main/java/com/gtnh/findit/service/itemfinder/ClientItemFindService.java @@ -33,7 +33,7 @@ public class ClientItemFindService extends ItemFindService { public ClientItemFindService() { if (!FindIt.isExtraUtilitiesLoaded()) { - API.addHashBind("gui.findit.find_item", Keyboard.KEY_T + NEIClientUtils.SHIFT_HASH); + API.addHashBind("gui.findit.find_item", Keyboard.KEY_T); } GuiContainerManager.addInputHandler(new ItemFindInputHandler()); diff --git a/src/main/java/com/gtnh/findit/util/AbstractStackFinder.java b/src/main/java/com/gtnh/findit/util/AbstractStackFinder.java index 2b3d7cb..22840a7 100644 --- a/src/main/java/com/gtnh/findit/util/AbstractStackFinder.java +++ b/src/main/java/com/gtnh/findit/util/AbstractStackFinder.java @@ -1,5 +1,6 @@ package com.gtnh.findit.util; +import appeng.client.gui.implementations.*; import codechicken.nei.LayoutManager; import codechicken.nei.NEIClientConfig; import codechicken.nei.guihook.GuiContainerManager; @@ -15,7 +16,16 @@ public abstract class AbstractStackFinder implements IContainerInputHandler { @Override public boolean keyTyped(GuiContainer window, char c, int key) { - + return false; + } + + @Override + public void onKeyTyped(GuiContainer guiContainer, char c, int i) { + + } + + @Override + public boolean lastKeyTyped(GuiContainer guiContainer, char c, int i) { if (!NEIClientConfig.isKeyHashDown(getKeyBindId())) { return false; } @@ -25,23 +35,13 @@ public boolean keyTyped(GuiContainer window, char c, int key) { return false; } - ItemStack stack = GuiContainerManager.getStackMouseOver(window); + ItemStack stack = GuiContainerManager.getStackMouseOver(guiContainer); if (stack == null || stack.getItem() == null) { return false; } return findStack(stack); } - @Override - public void onKeyTyped(GuiContainer guiContainer, char c, int i) { - - } - - @Override - public boolean lastKeyTyped(GuiContainer guiContainer, char c, int i) { - return false; - } - @Override public boolean mouseClicked(GuiContainer guiContainer, int i, int i1, int i2) { return false;