Skip to content

Commit

Permalink
findit/util/AbstractStackFinder: Add check for whether NEI Search is …
Browse files Browse the repository at this point in the history
…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 <[email protected]>

* 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 <[email protected]>

* findit/util/AbstractStackFinder: Code cleanup

Signed-off-by: Firenoo <[email protected]>

* findit/service: Revert default keybinds to T/Y.

Signed-off-by: Firenoo <[email protected]>

Signed-off-by: Firenoo <[email protected]>
  • Loading branch information
firenoo authored Aug 31, 2022
1 parent 84f2cf1 commit bdf41e7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
24 changes: 12 additions & 12 deletions src/main/java/com/gtnh/findit/util/AbstractStackFinder.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
}
Expand All @@ -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;
Expand Down

0 comments on commit bdf41e7

Please sign in to comment.