aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/AbstractDropdownController.java9
-rw-r--r--common/src/main/java/dev/isxander/yacl3/gui/utils/ItemRegistryHelper.java6
2 files changed, 9 insertions, 6 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/AbstractDropdownController.java b/common/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/AbstractDropdownController.java
index 8251f9e..b4e4304 100644
--- a/common/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/AbstractDropdownController.java
+++ b/common/src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/AbstractDropdownController.java
@@ -65,11 +65,14 @@ public abstract class AbstractDropdownController<T> implements IStringController
protected String getValidValue(String value, int offset) {
if (offset == -1) return getString();
+ String valueLowerCase = value.toLowerCase();
return getAllowedValues(value).stream()
- .filter(val -> val.toLowerCase().contains(value.toLowerCase()))
+ .filter(val -> val.toLowerCase().contains(valueLowerCase))
.sorted((s1, s2) -> {
- if (s1.startsWith(value) && !s2.startsWith(value)) return -1;
- if (!s1.startsWith(value) && s2.startsWith(value)) return 1;
+ String s1LowerCase = s1.toLowerCase();
+ String s2LowerCase = s2.toLowerCase();
+ if (s1LowerCase.startsWith(valueLowerCase) && !s2LowerCase.startsWith(valueLowerCase)) return -1;
+ if (!s1LowerCase.startsWith(valueLowerCase) && s2LowerCase.startsWith(valueLowerCase)) return 1;
return s1.compareTo(s2);
})
.skip(offset)
diff --git a/common/src/main/java/dev/isxander/yacl3/gui/utils/ItemRegistryHelper.java b/common/src/main/java/dev/isxander/yacl3/gui/utils/ItemRegistryHelper.java
index 5b52246..5bfbefb 100644
--- a/common/src/main/java/dev/isxander/yacl3/gui/utils/ItemRegistryHelper.java
+++ b/common/src/main/java/dev/isxander/yacl3/gui/utils/ItemRegistryHelper.java
@@ -86,9 +86,9 @@ public final class ItemRegistryHelper {
"minecraft:deepslate_diamond_ore", even though the second is lexicographically smaller
*/
.sorted((id1, id2) -> {
- String path = (sep == -1 ? value : value.substring(sep + 1));
- boolean id1StartsWith = id1.getPath().startsWith(path);
- boolean id2StartsWith = id2.getPath().startsWith(path);
+ String path = (sep == -1 ? value : value.substring(sep + 1)).toLowerCase();
+ boolean id1StartsWith = id1.getPath().toLowerCase().startsWith(path);
+ boolean id2StartsWith = id2.getPath().toLowerCase().startsWith(path);
if (id1StartsWith) {
if (id2StartsWith) {
return id1.compareTo(id2);