[Fix] Crash due to outdated Biome reference

This commit is contained in:
Frank 2023-05-16 16:59:07 +02:00
parent 9c46a0874c
commit 82dba8391e

View file

@ -537,9 +537,10 @@ public class BiomeAPI {
} }
public static Holder<Biome> getFromRegistry(ResourceLocation biomeID) { public static Holder<Biome> getFromRegistry(ResourceLocation biomeID) {
if (InternalBiomeAPI.biomeRegistry != null) if (InternalBiomeAPI.biomeRegistry != null) {
return InternalBiomeAPI.biomeRegistry.getHolder(ResourceKey.create(Registries.BIOME, biomeID)) var holder = InternalBiomeAPI.biomeRegistry.getHolder(ResourceKey.create(Registries.BIOME, biomeID));
.orElseThrow(); if (holder.isPresent()) return holder.get();
}
if (WorldBootstrap.getLastRegistryAccess() != null) { if (WorldBootstrap.getLastRegistryAccess() != null) {
var reg = WorldBootstrap.getLastRegistryAccess().registryOrThrow(Registries.BIOME); var reg = WorldBootstrap.getLastRegistryAccess().registryOrThrow(Registries.BIOME);