[Change] Include Biome count when printing the description of a BiomeSource

This commit is contained in:
Frank 2023-06-19 23:10:45 +02:00
parent 010ca1f598
commit f337595222

View file

@ -7,13 +7,25 @@ import java.util.Collection;
import java.util.stream.Collectors;
public class BiomeSourceHelper {
/**
* Get a list of namespaces from a collection of biomes.
*
* @param biomes The collection of biomes.
* @return A comma-separated list of namespaces including the number of biomes found in each namespace.
*/
public static String getNamespaces(Collection<Holder<Biome>> biomes) {
String namespaces = biomes
var namespaces = biomes
.stream()
.filter(h -> h.unwrapKey().isPresent())
.map(h -> h.unwrapKey().get().location().getNamespace())
.toList();
return namespaces
.stream()
.distinct()
.map(n -> n + "(" + namespaces.stream().filter(n::equals).count() + ")")
.collect(Collectors.joining(", "));
return namespaces;
}
}