use of com.silverminer.shrines.structures.AbstractStructure in project Shrines by Silverminer007.
the class StructuresList method refreshList.
public void refreshList(Supplier<String> search) {
this.clearEntries();
List<AbstractStructure<NoFeatureConfig>> structs = NewStructureInit.STRUCTURES.values().stream().collect(Collectors.toList());
structs.removeIf(struct -> struct == null);
this.structures = structs.stream().map((config) -> {
AbstractStructure<?> st = (AbstractStructure<?>) config.getStructure();
return st.getConfig();
}).collect(Collectors.toList());
this.structures.removeIf(entry -> entry == null);
List<String> structures = this.structures.stream().map(st -> st.getName()).collect(Collectors.toList());
for (CustomStructureData d : Utils.getStructures(false)) {
if (!structures.contains(d.getName())) {
this.structures.add(d);
}
}
if (!this.screen.builtInV) {
this.structures.removeIf(st -> st.isBuiltIn());
}
if (!this.screen.customsV) {
this.structures.removeIf(st -> !st.isBuiltIn());
}
Collections.sort(this.structures);
String s = search.get().toLowerCase(Locale.ROOT);
for (IStructureConfig cfg : this.structures) {
if (cfg.getName().toLowerCase(Locale.ROOT).contains(s)) {
this.addEntry(new StructuresList.Entry(this, cfg));
}
}
}
Aggregations