diff options
author | DoKM <mcazzyman@gmail.com> | 2021-08-02 18:21:33 +0200 |
---|---|---|
committer | DoKM <mcazzyman@gmail.com> | 2021-08-02 18:21:33 +0200 |
commit | b1de14337c4481eb922ecbe5a5c008b308fdfa68 (patch) | |
tree | 64b02b41d80a14257ad76ef199b10bc51183c013 | |
parent | 7b45f7826968ca8c3c5fde108f0af4e56fb96033 (diff) | |
download | NotEnoughUpdates-b1de14337c4481eb922ecbe5a5c008b308fdfa68.tar.gz NotEnoughUpdates-b1de14337c4481eb922ecbe5a5c008b308fdfa68.tar.bz2 NotEnoughUpdates-b1de14337c4481eb922ecbe5a5c008b308fdfa68.zip |
Add explanation to search highlight feature
4 files changed, 37 insertions, 5 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 43b43277..856dcfc6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -174,6 +174,7 @@ public class NEUEventListener { private static long notificationDisplayMillis = 0; private static List<String> notificationLines = null; + private static boolean showNotificationOverInv = false; private static final Pattern BAD_ITEM_REGEX = Pattern.compile("x[0-9]{1,2}$"); @@ -192,14 +193,18 @@ public class NEUEventListener { private int inventoryLoadedTicks = 0; private String loadedInvName = ""; public static boolean inventoryLoaded = false; - public static void displayNotification(List<String> lines, boolean showForever) { + displayNotification(lines, showForever, false); + } + + public static void displayNotification(List<String> lines, boolean showForever, boolean overInventory) { if(showForever) { notificationDisplayMillis = -420; } else { notificationDisplayMillis = System.currentTimeMillis(); } notificationLines = lines; + showNotificationOverInv = overInventory; } @SubscribeEvent @@ -501,13 +506,20 @@ public class NEUEventListener { if(Keyboard.isKeyDown(Keyboard.KEY_X)) { notificationDisplayMillis = 0; } + + if(event.type == RenderGameOverlayEvent.ElementType.ALL){ + renderNotification(); + } + + } + private static void renderNotification(){ + long timeRemaining = 15000 - (System.currentTimeMillis() - notificationDisplayMillis); boolean display = timeRemaining > 0 || notificationDisplayMillis == -420; - if(event.type == RenderGameOverlayEvent.ElementType.ALL && - display && notificationLines != null && notificationLines.size() > 0) { + if(display && notificationLines != null && notificationLines.size() > 0) { int width = 0; int height = notificationLines.size()*10+10; - + for(String line : notificationLines) { int len = Minecraft.getMinecraft().fontRendererObj.getStringWidth(line) + 8; if(len > width) { @@ -836,6 +848,11 @@ public class NEUEventListener { */ @SubscribeEvent public void onGuiBackgroundDraw(GuiScreenEvent.BackgroundDrawnEvent event) { + if(showNotificationOverInv){ + + renderNotification(); + + } if((shouldRenderOverlay(event.gui) || event.gui instanceof CustomAHGui) && neu.isOnSkyblock()) { ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft()); int width = scaledresolution.getScaledWidth(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 4859e5a6..9872e70e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -191,6 +191,18 @@ public class NEUOverlay extends Gui { } else { if(System.currentTimeMillis() - millisLastLeftClick < 300) { searchMode = !searchMode; + if (searchMode && NotEnoughUpdates.INSTANCE.config.hidden.firstTimeSearchFocus) { + NEUEventListener.displayNotification(Lists.newArrayList( + "\u00a7eSearch Highlight", + "\u00a77In this mode NEU will gray out non matching items in", + "\u00a77your inventory or chests.", + "\u00a77This allows you easily find items as the item will stand out.", + "\u00a77To toggle this please double click on the search bar in your inventory.", + "\u00a77", + "\u00a77Press X on your keyboard to close this notifcation"), true, true); + NotEnoughUpdates.INSTANCE.config.hidden.firstTimeSearchFocus = false; + + } } textField.setCursorPosition(getClickedIndex(mouseX, mouseY)); millisLastLeftClick = System.currentTimeMillis(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java index 48b7ff46..0266772c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -286,6 +286,9 @@ public class NEUConfig extends Config { "Looting:\u003e:3:5:0"); @Expose public String repoURL = "https://github.com/Moulberry/NotEnoughUpdates-REPO/archive/master.zip"; @Expose public String repoCommitsURL = "https://api.github.com/repos/Moulberry/NotEnoughUpdates-REPO/commits/master"; + + @Expose public boolean firstTimeSearchFocus = true; + //These config options were added due to a graphical bug that caused the player to be unable to see the screen @Expose public boolean disableBrokenCapes = false; @Expose public boolean disableAllCapes = false; 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 15262aeb..d45f6406 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 @@ -19,7 +19,7 @@ public class Toolbar { desc = ""
)
@ConfigEditorAccordion(id = 0)
- public boolean todoAccordion = false;
+ public boolean searchBarAccordion = false;
@Expose
@ConfigOption(
|