[Fixed] Prevent crashes from null registry in Fog-Rendered (#69)

This commit is contained in:
Frank 2023-01-28 12:36:46 +01:00
parent 154e652991
commit ecc5ea0eec

View file

@ -438,12 +438,15 @@ public class BiomeAPI {
public static BCLBiome getRenderBiome(Biome biome) { public static BCLBiome getRenderBiome(Biome biome) {
BCLBiome endBiome = InternalBiomeAPI.CLIENT.get(biome); BCLBiome endBiome = InternalBiomeAPI.CLIENT.get(biome);
if (endBiome == null) { if (endBiome == null) {
var reg = BCLBiomeRegistry.registryOrNull(); var acc = WorldBootstrap.getLastRegistryAccessOrElseBuiltin();
ResourceLocation id = WorldBootstrap.getLastRegistryAccessOrElseBuiltin() if (acc != null) {
.registryOrThrow(Registries.BIOME) final Registry<BCLBiome> reg = BCLBiomeRegistry.registryOrNull();
.getKey(biome); ResourceLocation id = acc
endBiome = BCLBiomeRegistry.getBiomeOrEmpty(id, reg); .registryOrThrow(Registries.BIOME)
InternalBiomeAPI.CLIENT.put(biome, endBiome); .getKey(biome);
endBiome = BCLBiomeRegistry.getBiomeOrEmpty(id, reg);
InternalBiomeAPI.CLIENT.put(biome, endBiome);
}
} }
return endBiome; return endBiome;
} }