diff --git a/src/main/java/meteordevelopment/meteorclient/settings/EntityTypeListSetting.java b/src/main/java/meteordevelopment/meteorclient/settings/EntityTypeListSetting.java index 1b867478d5..edc48908e0 100644 --- a/src/main/java/meteordevelopment/meteorclient/settings/EntityTypeListSetting.java +++ b/src/main/java/meteordevelopment/meteorclient/settings/EntityTypeListSetting.java @@ -24,7 +24,7 @@ public class EntityTypeListSetting extends Setting>> { public final Predicate> filter; - private static List suggestions; + private List suggestions; private final static List groups = List.of("animal", "wateranimal", "monster", "ambient", "misc"); public EntityTypeListSetting(String name, String description, Set> defaultValue, Consumer>> onChanged, Consumer>>> onModuleActivated, IVisible visible, Predicate> filter) { @@ -51,7 +51,9 @@ protected Set> parseImpl(String str) { String lowerValue = value.trim().toLowerCase(); if (!groups.contains(lowerValue)) continue; - Registries.ENTITY_TYPE.forEach(entityType -> { + for (EntityType entityType : Registries.ENTITY_TYPE) { + if (filter != null && !filter.test(entityType)) continue; + switch (lowerValue) { case "animal" -> { if (entityType.getSpawnGroup() == SpawnGroup.CREATURE) entities.add(entityType); @@ -72,7 +74,7 @@ protected Set> parseImpl(String str) { if (entityType.getSpawnGroup() == SpawnGroup.MISC) entities.add(entityType); } } - }); + } } } } catch (Exception ignored) {} @@ -89,7 +91,9 @@ protected boolean isValueValid(Set> value) { public List getSuggestions() { if (suggestions == null) { suggestions = new ArrayList<>(groups); - Registries.ENTITY_TYPE.getIds().forEach(id -> suggestions.add(id.toString())); + for (EntityType entityType : Registries.ENTITY_TYPE) { + if (filter == null || filter.test(entityType)) suggestions.add(Registries.ENTITY_TYPE.getId(entityType).toString()); + } } return suggestions;