diff options
author | Lulonaut <lulonaut@tutanota.de> | 2022-11-11 13:39:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-11 23:39:16 +1100 |
commit | 160f6d40ba3e0ce13e06533561f567f389547511 (patch) | |
tree | 2b44924b829b808a7976c0ba9f47fd131f2decdd | |
parent | 3ffff3428b72371b35ea3067ae33588d89e7fc85 (diff) | |
download | NotEnoughUpdates-160f6d40ba3e0ce13e06533561f567f389547511.tar.gz NotEnoughUpdates-160f6d40ba3e0ce13e06533561f567f389547511.tar.bz2 NotEnoughUpdates-160f6d40ba3e0ce13e06533561f567f389547511.zip |
ctrl +f support (#423)
5 files changed, 40 insertions, 10 deletions
diff --git a/Update Notes/2.1.1.md b/Update Notes/2.1.1.md index bdb2d199..52f0f7f4 100644 --- a/Update Notes/2.1.1.md +++ b/Update Notes/2.1.1.md @@ -49,3 +49,4 @@ - Fixed pickaxe cooldown not working on first world join - Ascynx - Added searchbar to Kills/Deaths section in pv - Cobble8 - Added Ender Node Highlighter, Endermite Nest Alert - GodOfPro + - Added CTRL + F support to searchbar and config menu - Lulonaut diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 87ce915b..cff83cca 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -1035,14 +1035,30 @@ public class NEUOverlay extends Gui { return false; } - if ((Keyboard.isKeyDown(Keyboard.KEY_Y) && !Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) && NotEnoughUpdates.INSTANCE.config.hidden.dev) { - displayInformationPane(new DevInfoPane(this, manager)); + if (NotEnoughUpdates.INSTANCE.config.hidden.dev && (Keyboard.isKeyDown(Keyboard.KEY_Y) && !Keyboard.isKeyDown( + Keyboard.KEY_LCONTROL)) && !searchBarHasFocus) { + DevInfoPane devInfoPane = new DevInfoPane(this, manager); + if (devInfoPane.getText().isEmpty()) { + Utils.addChatMessage(EnumChatFormatting.AQUA + "[NEU] No missing items!"); + } else { + displayInformationPane(devInfoPane); + } } if (Keyboard.getEventKeyState()) { if (!NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { searchBarHasFocus = false; } + + if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && Keyboard.isKeyDown(Keyboard.KEY_F) && + NotEnoughUpdates.INSTANCE.config.toolbar.searchBar && NotEnoughUpdates.INSTANCE.config.toolbar.ctrlF) { + searchBarHasFocus = !searchBarHasFocus; + if (searchBarHasFocus) { + itemPaneOpen = true; + } + return true; + } + if (searchBarHasFocus) { if (keyPressed == 1) { searchBarHasFocus = false; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java index c44a9f71..1ae3c17c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java @@ -55,19 +55,18 @@ public class DevInfoPane extends TextInfoPane { text = getText(); } - private String getText() { - String text = ""; + public String getText() { + StringBuilder text = new StringBuilder(0); for (String internalname : manager.auctionManager.getItemAuctionInfoKeySet()) { if (internalname.matches("^.*-[0-9]{1,3}$")) continue; - if (!manager.getItemInformation().containsKey(internalname)) { - if (internalname.equals("RUNE") || internalname.contains("PARTY_HAT_CRAB") || internalname.equals("ABICASE")) continue; - text += internalname + "\n"; + if (!manager.isValidInternalName(internalname)) { + if (internalname.equals("RUNE") || internalname.contains("PARTY_HAT_CRAB") || internalname.equals("ABICASE")) + continue; + text.append(internalname).append("\n"); } } - - - return text; + return text.toString(); } //#region add vanilla items diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java index cee994b7..e3881f44 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java @@ -850,6 +850,11 @@ public class NEUConfigEditor extends GuiElement { int innerWidth = xSize - 154 - innerPadding * 2; if (Keyboard.getEventKeyState()) { + if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && Keyboard.isKeyDown(Keyboard.KEY_F)) { + searchField.setFocus(!searchField.getFocus()); + return true; + } + String old = searchField.getText(); searchField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey()); searchField.setText(Minecraft.getMinecraft().fontRendererObj.trimStringToWidth( diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java index 7d2f4fc4..2d88544e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java @@ -73,6 +73,15 @@ public class Toolbar { @Expose @ConfigOption( + name = "CTRL+F keybind", + desc = "Change the focus of the search bar when pressing CTRL + F" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean ctrlF = true; + + @Expose + @ConfigOption( name = "Search Bar Width", desc = "Change the width of the search bar" ) |