aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorLulonaut <lulonaut@tutanota.de>2021-09-07 21:19:58 +0200
committerLulonaut <lulonaut@tutanota.de>2021-09-07 21:19:58 +0200
commita373c31ba136020d088c569c76008ecdc7744c3d (patch)
tree9f749c5f19f060294824b1130d9741ed585768e0 /src/main/java/io
parent5dff658657c24581a6dc30f2b5a4785bde96b8ac (diff)
downloadNotEnoughUpdates-a373c31ba136020d088c569c76008ecdc7744c3d.tar.gz
NotEnoughUpdates-a373c31ba136020d088c569c76008ecdc7744c3d.tar.bz2
NotEnoughUpdates-a373c31ba136020d088c569c76008ecdc7744c3d.zip
ah search overlay tab completion
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java
index 816a6c63..2cfe176b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java
@@ -20,6 +20,7 @@ import net.minecraft.tileentity.TileEntitySign;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ResourceLocation;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.text.WordUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -334,6 +335,17 @@ public class AuctionSearchOverlay {
} else if(Keyboard.getEventKey() == Keyboard.KEY_RETURN) {
searchStringExtra = "";
close();
+ } else if(Keyboard.getEventKey() == Keyboard.KEY_TAB){
+ searchString = autocompletedItems.iterator().next();
+ JsonObject repoObject = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(autocompletedItems.iterator().next());
+ String displayname = repoObject.get("displayname").getAsString();
+ if (displayname.contains("Enchanted Book")){
+ String lore = repoObject.get("lore").getAsJsonArray().iterator().next().getAsString();
+ String name = lore.substring(0, lore.lastIndexOf(" "));
+ searchString = Utils.cleanColour(name);
+ } else {
+ searchString = Utils.cleanColour(displayname);
+ }
} else if(Keyboard.getEventKeyState()) {
textField.setFocus(true);
textField.setText(searchString);