Make sure biomes are sorted
This commit is contained in:
parent
9ac0d78d30
commit
86a92c560b
1 changed files with 9 additions and 1 deletions
|
@ -9,6 +9,7 @@ import net.minecraft.world.level.biome.BiomeSource;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import org.betterx.bclib.api.biomes.BiomeAPI;
|
import org.betterx.bclib.api.biomes.BiomeAPI;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -25,6 +26,11 @@ public abstract class BCLBiomeSource extends BiomeSource {
|
||||||
public final int biomeSourceVersion;
|
public final int biomeSourceVersion;
|
||||||
|
|
||||||
private static List<Holder<Biome>> preInit(Registry<Biome> biomeRegistry, List<Holder<Biome>> biomes) {
|
private static List<Holder<Biome>> preInit(Registry<Biome> biomeRegistry, List<Holder<Biome>> biomes) {
|
||||||
|
biomes = biomes.stream().sorted(Comparator.comparing(holder -> holder.unwrapKey()
|
||||||
|
.get()
|
||||||
|
.location()
|
||||||
|
.toString()))
|
||||||
|
.toList();
|
||||||
biomes.forEach(biome -> BiomeAPI.sortBiomeFeatures(biome));
|
biomes.forEach(biome -> BiomeAPI.sortBiomeFeatures(biome));
|
||||||
return biomes;
|
return biomes;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +94,7 @@ public abstract class BCLBiomeSource extends BiomeSource {
|
||||||
BCLibNetherBiomeSource.ValidBiomePredicate test) {
|
BCLibNetherBiomeSource.ValidBiomePredicate test) {
|
||||||
return biomeRegistry.stream()
|
return biomeRegistry.stream()
|
||||||
.filter(biome -> biomeRegistry.getResourceKey(biome).isPresent())
|
.filter(biome -> biomeRegistry.getResourceKey(biome).isPresent())
|
||||||
|
|
||||||
.map(biome -> biomeRegistry.getOrCreateHolderOrThrow(biomeRegistry.getResourceKey(biome)
|
.map(biome -> biomeRegistry.getOrCreateHolderOrThrow(biomeRegistry.getResourceKey(biome)
|
||||||
.get()))
|
.get()))
|
||||||
.filter(biome -> {
|
.filter(biome -> {
|
||||||
|
@ -97,6 +104,7 @@ public abstract class BCLBiomeSource extends BiomeSource {
|
||||||
if (include.contains(strLocation)) return true;
|
if (include.contains(strLocation)) return true;
|
||||||
|
|
||||||
return test.isValid(biome, location);
|
return test.isValid(biome, location);
|
||||||
}).toList();
|
})
|
||||||
|
.toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue