Enchantment are now sorted on select gui.

This commit is contained in:
alexcrea 2024-07-24 16:57:22 +02:00
parent 9b3402e45f
commit b70887c5ca
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F
2 changed files with 6 additions and 6 deletions

View file

@ -152,10 +152,10 @@ public class CAEnchantmentRegistry {
/** /**
* Gets a map of all the registered enchantments. * Gets a map of all the registered enchantments.
* @return Map of enchantments. * @return Immutable map of enchantments.
*/ */
public Map<NamespacedKey, CAEnchantment> registeredEnchantments() { public Map<NamespacedKey, CAEnchantment> registeredEnchantments() {
return byKeyMap; return Collections.unmodifiableMap(byKeyMap);
} }
/** /**
@ -178,7 +178,7 @@ public class CAEnchantmentRegistry {
/** /**
* Get "clean optimised operation" for get enchantments. * Get "clean optimised operation" for get enchantments.
* @return Get mutable "clean enchantments optimised operation" list. * @return Mutable "clean enchantments optimised operation" list.
*/ */
public List<BulkCleanEnchantOperation> getOptimisedCleanOperators() { public List<BulkCleanEnchantOperation> getOptimisedCleanOperators() {
return optimisedCleanOperators; return optimisedCleanOperators;
@ -186,7 +186,7 @@ public class CAEnchantmentRegistry {
/** /**
* Get "get optimised operation" for get enchantments. * Get "get optimised operation" for get enchantments.
* @return Get mutable "get enchantments optimised operation" list. * @return Mutable "get enchantments optimised operation" list.
*/ */
public List<BulkGetEnchantOperation> getOptimisedGetOperators() { public List<BulkGetEnchantOperation> getOptimisedGetOperators() {
return optimisedGetOperators; return optimisedGetOperators;

View file

@ -65,9 +65,9 @@ public class EnchantSelectSettingGui extends SettingGuiListConfigGui<CAEnchantme
protected Collection<CAEnchantment> getEveryDisplayableInstanceOfGeneric() { protected Collection<CAEnchantment> getEveryDisplayableInstanceOfGeneric() {
Stream<CAEnchantment> toDisplayStream; Stream<CAEnchantment> toDisplayStream;
if(this.displayUnselected){ if(this.displayUnselected){
toDisplayStream = CAEnchantmentRegistry.getInstance().values().stream(); toDisplayStream = CAEnchantmentRegistry.getInstance().getNameSortedEnchantments().stream();
}else{ }else{
toDisplayStream = this.selectedEnchant.stream(); toDisplayStream = this.selectedEnchant.stream().sorted(Comparator.comparing(CAEnchantment::getName));
} }
Set<CAEnchantment> illegalEnchantments = this.enchantContainer.illegalEnchantments(); Set<CAEnchantment> illegalEnchantments = this.enchantContainer.illegalEnchantments();