aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.idea/codeStyles/Project.xml2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java37
2 files changed, 25 insertions, 14 deletions
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index c2c50913..68a0c5f9 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -56,4 +56,4 @@
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
-</component> \ No newline at end of file
+</component>
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
index 073b3d50..4794b6e7 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
@@ -99,8 +99,10 @@ import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.NavigableSet;
import java.util.Objects;
import java.util.Set;
+import java.util.TreeSet;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -462,24 +464,33 @@ public class RenderListener {
}
}
- private static final String[] dungeonMenus =
- {
- "Spirit Leap",
- "Revive A Teammate",
- "Click in order!",
- "What starts with",
- "Select all the",
- "Click the button on time!",
- "Correct all the panes!",
- "Change all to same color!"
- };
- private static final Set<String> dungeonMenuSet = new HashSet<>(Arrays.asList(dungeonMenus));
+ private static final Set<String> dungeonMenuSet = new HashSet<>(Arrays.asList(
+ "Spirit Leap",
+ "Revive A Teammate",
+ "Click in order!",
+ "Click the button on time!",
+ "Correct all the panes!",
+ "Change all to same color!"
+ ));
+
+ private static final NavigableSet<String> dungeonMenuStartsWithSet = new TreeSet<>(Arrays.asList(
+ "What starts with",
+ "Select all the"
+ ));
+
+ private boolean isInDungeonMenu(String chestName) {
+ if (!SBInfo.getInstance().isInDungeon) {
+ return false;
+ }
+ String nearestStartsWith = dungeonMenuStartsWithSet.floor(chestName);
+ return dungeonMenuSet.contains(chestName) || (nearestStartsWith != null && chestName.startsWith(nearestStartsWith));
+ }
public void iterateButtons(GuiContainer gui, BiConsumer<NEUConfig.InventoryButton, Rectangle> acceptButton) {
if (NEUApi.disableInventoryButtons || EnchantingSolvers.disableButtons() || gui == null ||
!NotEnoughUpdates.INSTANCE.config.inventoryButtons.enableInventoryButtons ||
(NotEnoughUpdates.INSTANCE.config.inventoryButtons.hideInDungeonMenus &&
- dungeonMenuSet.contains(Utils.getOpenChestName()))) {
+ isInDungeonMenu(Utils.getOpenChestName()))) {
return;
}