aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/isxander/yacl/gui/YACLScreen.java
diff options
context:
space:
mode:
authorxander <xander@isxander.dev>2022-09-23 14:12:38 +0100
committerxander <xander@isxander.dev>2022-09-23 14:12:38 +0100
commit5e288e914f015adda495b3cd8570943b399172ff (patch)
treed91b309e0fbeb6c5b9d420ac818637ba3170ec73 /src/main/java/dev/isxander/yacl/gui/YACLScreen.java
parentf77914f74903164c34bf44bfbe4c298da87e1e32 (diff)
downloadYetAnotherConfigLib-5e288e914f015adda495b3cd8570943b399172ff.tar.gz
YetAnotherConfigLib-5e288e914f015adda495b3cd8570943b399172ff.tar.bz2
YetAnotherConfigLib-5e288e914f015adda495b3cd8570943b399172ff.zip
1.4.4
Fix search not behaving properly with default collapsed option groups Minor refactors
Diffstat (limited to 'src/main/java/dev/isxander/yacl/gui/YACLScreen.java')
-rw-r--r--src/main/java/dev/isxander/yacl/gui/YACLScreen.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/main/java/dev/isxander/yacl/gui/YACLScreen.java b/src/main/java/dev/isxander/yacl/gui/YACLScreen.java
index 63cb2f6..70c61c1 100644
--- a/src/main/java/dev/isxander/yacl/gui/YACLScreen.java
+++ b/src/main/java/dev/isxander/yacl/gui/YACLScreen.java
@@ -21,7 +21,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
public class YACLScreen extends Screen {
public final YetAnotherConfigLib config;
- public int currentCategoryIdx;
+ private int currentCategoryIdx;
private final Screen parent;
@@ -139,6 +139,9 @@ public class YACLScreen extends Screen {
}
public void changeCategory(int idx) {
+ if (idx == currentCategoryIdx)
+ return;
+
if (idx != -1 && config.categories().get(idx) instanceof PlaceholderCategory placeholderCategory) {
client.setScreen(placeholderCategory.screen().apply(client, this));
} else {
@@ -147,6 +150,10 @@ public class YACLScreen extends Screen {
}
}
+ public int getCurrentCategoryIdx() {
+ return currentCategoryIdx;
+ }
+
private void updateActionAvailability() {
boolean pendingChanges = pendingChanges();
@@ -160,12 +167,6 @@ public class YACLScreen extends Screen {
@Override
public void tick() {
searchFieldWidget.tick();
- if (!searchFieldWidget.getText().isEmpty() && currentCategoryIdx != -1) {
- changeCategory(-1);
- }
- if (searchFieldWidget.getText().isEmpty() && currentCategoryIdx == -1) {
- changeCategory(0);
- }
updateActionAvailability();