[Fix] Do not implicitly add keys to Biome registry (#16)

This commit is contained in:
Frank 2022-07-03 23:36:42 +02:00
parent de94a808d0
commit 3b0f609776
2 changed files with 6 additions and 4 deletions

View file

@ -511,12 +511,12 @@ public class BiomeAPI {
@Nullable
public static Holder<Biome> getFromBuiltinRegistry(ResourceLocation biomeID) {
return BuiltinRegistries.BIOME.getHolder(ResourceKey.create(Registry.BIOME_REGISTRY, biomeID)).orElseThrow();
return BuiltinRegistries.BIOME.getHolder(ResourceKey.create(Registry.BIOME_REGISTRY, biomeID)).orElse(null);
}
@Nullable
public static Holder<Biome> getFromBuiltinRegistry(ResourceKey<Biome> key) {
return BuiltinRegistries.BIOME.getOrCreateHolderOrThrow(key);
return BuiltinRegistries.BIOME.getHolder(key).orElse(null);
}
@Deprecated(forRemoval = true)

View file

@ -177,9 +177,11 @@ public class InternalBiomeAPI {
.map(e -> e.getKey());
if (s != null) {
s.forEach(id -> {
Holder<Biome> biomeHolder = BiomeAPI.getBiomeHolder(id);
if (biomeHolder.isBound()) {
Holder<Biome> biomeHolder = BiomeAPI.getFromRegistry(id);
if (biomeHolder != null && biomeHolder.isBound()) {
mod.getValue().forEach(c -> c.accept(id, biomeHolder));
} else {
BCLib.LOGGER.info("No Holder for " + id);
}
});
}