[Change] Include Biome count when printing the description of a BiomeSource
This commit is contained in:
parent
010ca1f598
commit
f337595222
1 changed files with 14 additions and 2 deletions
|
@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue