diff options
author | isXander <xander@isxander.dev> | 2024-10-19 19:22:45 +0100 |
---|---|---|
committer | isXander <xander@isxander.dev> | 2024-10-19 19:22:45 +0100 |
commit | e73a08e6672fb380cab8db71340158969c5ef56b (patch) | |
tree | dd08a311f4eff9a91b465ef1854caa1286fc6f9a /src/main/java/dev/isxander/yacl3/gui/utils/ItemRegistryHelper.java | |
parent | 519ac2fc0e23587defcf4a8259979961d35d0ce2 (diff) | |
download | YetAnotherConfigLib-e73a08e6672fb380cab8db71340158969c5ef56b.tar.gz YetAnotherConfigLib-e73a08e6672fb380cab8db71340158969c5ef56b.tar.bz2 YetAnotherConfigLib-e73a08e6672fb380cab8db71340158969c5ef56b.zip |
3.6.0
Diffstat (limited to 'src/main/java/dev/isxander/yacl3/gui/utils/ItemRegistryHelper.java')
-rw-r--r-- | src/main/java/dev/isxander/yacl3/gui/utils/ItemRegistryHelper.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/dev/isxander/yacl3/gui/utils/ItemRegistryHelper.java b/src/main/java/dev/isxander/yacl3/gui/utils/ItemRegistryHelper.java index bb6c664..dc769bc 100644 --- a/src/main/java/dev/isxander/yacl3/gui/utils/ItemRegistryHelper.java +++ b/src/main/java/dev/isxander/yacl3/gui/utils/ItemRegistryHelper.java @@ -46,7 +46,7 @@ public final class ItemRegistryHelper { try { ResourceLocation itemIdentifier = YACLPlatform.parseRl(identifier.toLowerCase()); if (BuiltInRegistries.ITEM.containsKey(itemIdentifier)) { - return BuiltInRegistries.ITEM.get(itemIdentifier); + return MiscUtil.getFromRegistry(BuiltInRegistries.ITEM, itemIdentifier); } } catch (ResourceLocationException ignored) { } @@ -80,14 +80,15 @@ public final class ItemRegistryHelper { if (sep == -1) { filterPredicate = identifier -> identifier.getPath().contains(value) - || BuiltInRegistries.ITEM.get(identifier).getDescription().getString().toLowerCase().contains(value.toLowerCase()); + || MiscUtil.getFromRegistry(BuiltInRegistries.ITEM, identifier) + /*? if >=1.21.2 {*/ .getName() /*?} else {*/ /*.getDescription() *//*?}*/ + .getString().toLowerCase().contains(value.toLowerCase()); } else { String namespace = value.substring(0, sep); String path = value.substring(sep + 1); filterPredicate = identifier -> identifier.getNamespace().equals(namespace) && identifier.getPath().startsWith(path); } - return BuiltInRegistries.ITEM.holders() - .map(holder -> holder.key().location()) + return BuiltInRegistries.ITEM.keySet().stream() .filter(filterPredicate) /* Sort items as follows based on the given "value" string's path: |