Skip biomes that are missing in registry (paulevsGitch/BCLib#145)

This commit is contained in:
Frank 2022-05-27 17:09:36 +02:00
parent 50fe9c2342
commit d985792cae

View file

@ -525,19 +525,28 @@ public class BiomeAPI {
public static void loadFabricAPIBiomes() {
FabricBiomesData.NETHER_BIOMES.forEach((key) -> {
if (!hasBiome(key.location())) {
registerNetherBiome(BuiltinRegistries.BIOME.get(key));
Optional<Holder<Biome>> optional = BuiltinRegistries.BIOME.getHolder(key);
if (optional.isPresent()) {
registerNetherBiome(optional.get().value());
}
}
});
FabricBiomesData.END_LAND_BIOMES.forEach((key, weight) -> {
if (!hasBiome(key.location())) {
registerEndLandBiome(BuiltinRegistries.BIOME.getHolder(key).orElseThrow(), weight);
Optional<Holder<Biome>> optional = BuiltinRegistries.BIOME.getHolder(key);
if (optional.isPresent()) {
registerEndLandBiome(optional.get(), weight);
}
}
});
FabricBiomesData.END_VOID_BIOMES.forEach((key, weight) -> {
if (!hasBiome(key.location())) {
registerEndVoidBiome(BuiltinRegistries.BIOME.getOrCreateHolderOrThrow(key), weight);
Optional<Holder<Biome>> optional = BuiltinRegistries.BIOME.getHolder(key);
if (optional.isPresent()) {
registerEndVoidBiome(optional.get(), weight);
}
}
});
}